mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Fleet] Update platformSelector component (#127900)
* [Fleet] Update platformSelector component * Use PlatformSelector for on prem instructions too * Fix tests * Fix translations
This commit is contained in:
parent
58613d351d
commit
9319280203
12 changed files with 307 additions and 157 deletions
|
@ -16,10 +16,6 @@ export const FLEET_ENDPOINT_PACKAGE = 'endpoint';
|
|||
export const FLEET_APM_PACKAGE = 'apm';
|
||||
export const FLEET_SYNTHETICS_PACKAGE = 'synthetics';
|
||||
export const FLEET_KUBERNETES_PACKAGE = 'kubernetes';
|
||||
export const KUBERNETES_RUN_INSTRUCTIONS =
|
||||
'kubectl apply -f elastic-agent-standalone-kubernetes.yaml';
|
||||
export const STANDALONE_RUN_INSTRUCTIONS_LINUXMAC = 'sudo ./elastic-agent install';
|
||||
export const STANDALONE_RUN_INSTRUCTIONS_WINDOWS = '.\\elastic-agent.exe install';
|
||||
|
||||
export const FLEET_ELASTIC_AGENT_DETAILS_DASHBOARD_ID =
|
||||
'elastic_agent-f47f18cc-9c7d-4278-b2ea-a6dee816d395';
|
||||
|
|
|
@ -21,7 +21,6 @@ import {
|
|||
EuiFieldText,
|
||||
EuiForm,
|
||||
EuiFormErrorText,
|
||||
EuiButtonGroup,
|
||||
} from '@elastic/eui';
|
||||
import type { EuiStepProps } from '@elastic/eui/src/components/steps/step';
|
||||
import styled from 'styled-components';
|
||||
|
@ -34,7 +33,6 @@ import {
|
|||
useDefaultOutput,
|
||||
sendGenerateServiceToken,
|
||||
usePlatform,
|
||||
PLATFORM_OPTIONS,
|
||||
useGetAgentPolicies,
|
||||
useGetSettings,
|
||||
sendPutSettings,
|
||||
|
@ -48,6 +46,9 @@ import { FleetServerOnPremRequiredCallout } from '../../components';
|
|||
|
||||
import { policyHasFleetServer } from '../../services/has_fleet_server';
|
||||
|
||||
import { PlatformSelector } from '../../../../../../components/enrollment_instructions/manual/platform_selector';
|
||||
|
||||
import type { CommandsByPlatform } from './install_command_utils';
|
||||
import { getInstallCommandForPlatform } from './install_command_utils';
|
||||
|
||||
const URL_REGEX = /^(https?):\/\/[^\s$.?#].[^\s]*$/gm;
|
||||
|
@ -162,7 +163,7 @@ export const FleetServerCommandStep = ({
|
|||
setPlatform,
|
||||
}: {
|
||||
serviceToken?: string;
|
||||
installCommand: string;
|
||||
installCommand: CommandsByPlatform;
|
||||
platform: string;
|
||||
setPlatform: (platform: PLATFORM_TYPE) => void;
|
||||
}): EuiStepProps => {
|
||||
|
@ -196,41 +197,15 @@ export const FleetServerCommandStep = ({
|
|||
/>
|
||||
</EuiText>
|
||||
<EuiSpacer size="l" />
|
||||
<EuiButtonGroup
|
||||
options={PLATFORM_OPTIONS}
|
||||
idSelected={platform}
|
||||
onChange={(id) => setPlatform(id as PLATFORM_TYPE)}
|
||||
legend={i18n.translate('xpack.fleet.fleetServerSetup.platformSelectAriaLabel', {
|
||||
defaultMessage: 'Platform',
|
||||
})}
|
||||
<PlatformSelector
|
||||
linuxCommand={installCommand.linux}
|
||||
macCommand={installCommand.mac}
|
||||
windowsCommand={installCommand.windows}
|
||||
linuxDebCommand={installCommand.deb}
|
||||
linuxRpmCommand={installCommand.rpm}
|
||||
troubleshootLink={docLinks.links.fleet.troubleshooting}
|
||||
isK8s={false}
|
||||
/>
|
||||
<EuiSpacer size="s" />
|
||||
<EuiCodeBlock
|
||||
fontSize="m"
|
||||
isCopyable={true}
|
||||
paddingSize="m"
|
||||
language="console"
|
||||
whiteSpace="pre-wrap"
|
||||
>
|
||||
<CommandCode>{installCommand}</CommandCode>
|
||||
</EuiCodeBlock>
|
||||
<EuiSpacer size="s" />
|
||||
<EuiText>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.enrollmentInstructions.troubleshootingText"
|
||||
defaultMessage="If you are having trouble connecting, see our {link}."
|
||||
values={{
|
||||
link: (
|
||||
<EuiLink target="_blank" external href={docLinks.links.fleet.troubleshooting}>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.enrollmentInstructions.troubleshootingLink"
|
||||
defaultMessage="troubleshooting guide"
|
||||
/>
|
||||
</EuiLink>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</EuiText>
|
||||
</>
|
||||
) : null,
|
||||
};
|
||||
|
@ -248,9 +223,15 @@ export const useFleetServerInstructions = (policyId?: string) => {
|
|||
const esHost = output?.hosts?.[0];
|
||||
const sslCATrustedFingerprint: string | undefined = output?.ca_trusted_fingerprint;
|
||||
|
||||
const installCommand = useMemo((): string => {
|
||||
const installCommand = useMemo((): CommandsByPlatform => {
|
||||
if (!serviceToken || !esHost) {
|
||||
return '';
|
||||
return {
|
||||
linux: '',
|
||||
mac: '',
|
||||
windows: '',
|
||||
deb: '',
|
||||
rpm: '',
|
||||
};
|
||||
}
|
||||
|
||||
return getInstallCommandForPlatform(
|
||||
|
|
|
@ -9,14 +9,29 @@ import { getInstallCommandForPlatform } from './install_command_utils';
|
|||
|
||||
describe('getInstallCommandForPlatform', () => {
|
||||
describe('without policy id', () => {
|
||||
it('should return the correct command if the the policyId is not set for linux-mac', () => {
|
||||
it('should return the correct command if the the policyId is not set for linux', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'linux-mac',
|
||||
'linux',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.linux).toMatchInlineSnapshot(`
|
||||
"sudo ./elastic-agent install \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
--fleet-server-insecure-http"
|
||||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is not set for mac', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'mac',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1'
|
||||
);
|
||||
|
||||
expect(res.mac).toMatchInlineSnapshot(`
|
||||
"sudo ./elastic-agent install \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
|
@ -31,7 +46,7 @@ describe('getInstallCommandForPlatform', () => {
|
|||
'service-token-1'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.windows).toMatchInlineSnapshot(`
|
||||
".\\\\elastic-agent.exe install \`
|
||||
--fleet-server-es=http://elasticsearch:9200 \`
|
||||
--fleet-server-service-token=service-token-1 \`
|
||||
|
@ -39,14 +54,29 @@ describe('getInstallCommandForPlatform', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is not set for rpm-deb', () => {
|
||||
it('should return the correct command if the the policyId is not set for rpm', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'rpm-deb',
|
||||
'rpm',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.rpm).toMatchInlineSnapshot(`
|
||||
"sudo elastic-agent enroll \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
--fleet-server-insecure-http"
|
||||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is not set for deb', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'deb',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1'
|
||||
);
|
||||
|
||||
expect(res.deb).toMatchInlineSnapshot(`
|
||||
"sudo elastic-agent enroll \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
|
@ -56,7 +86,7 @@ describe('getInstallCommandForPlatform', () => {
|
|||
|
||||
it('should return the correct command sslCATrustedFingerprint option is passed', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'linux-mac',
|
||||
'linux',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
undefined,
|
||||
|
@ -65,7 +95,7 @@ describe('getInstallCommandForPlatform', () => {
|
|||
'fingerprint123456'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.linux).toMatchInlineSnapshot(`
|
||||
"sudo ./elastic-agent install \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
|
@ -76,15 +106,32 @@ describe('getInstallCommandForPlatform', () => {
|
|||
});
|
||||
|
||||
describe('with policy id', () => {
|
||||
it('should return the correct command if the the policyId is set for linux-mac', () => {
|
||||
it('should return the correct command if the the policyId is set for linux', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'linux-mac',
|
||||
'linux',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.linux).toMatchInlineSnapshot(`
|
||||
"sudo ./elastic-agent install \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
--fleet-server-policy=policy-1 \\\\
|
||||
--fleet-server-insecure-http"
|
||||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is set for mac', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'mac',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1'
|
||||
);
|
||||
|
||||
expect(res.mac).toMatchInlineSnapshot(`
|
||||
"sudo ./elastic-agent install \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
|
@ -101,7 +148,7 @@ describe('getInstallCommandForPlatform', () => {
|
|||
'policy-1'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.windows).toMatchInlineSnapshot(`
|
||||
".\\\\elastic-agent.exe install \`
|
||||
--fleet-server-es=http://elasticsearch:9200 \`
|
||||
--fleet-server-service-token=service-token-1 \`
|
||||
|
@ -110,15 +157,32 @@ describe('getInstallCommandForPlatform', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is set for rpm-deb', () => {
|
||||
it('should return the correct command if the the policyId is set for rpm', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'rpm-deb',
|
||||
'rpm',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.rpm).toMatchInlineSnapshot(`
|
||||
"sudo elastic-agent enroll \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
--fleet-server-policy=policy-1 \\\\
|
||||
--fleet-server-insecure-http"
|
||||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is set for deb', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'deb',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1'
|
||||
);
|
||||
|
||||
expect(res.deb).toMatchInlineSnapshot(`
|
||||
"sudo elastic-agent enroll \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
|
@ -129,9 +193,9 @@ describe('getInstallCommandForPlatform', () => {
|
|||
});
|
||||
|
||||
describe('with policy id and fleet server host and production deployment', () => {
|
||||
it('should return the correct command if the the policyId is set for linux-mac', () => {
|
||||
it('should return the correct command if the the policyId is set for linux', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'linux-mac',
|
||||
'linux',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1',
|
||||
|
@ -139,7 +203,29 @@ describe('getInstallCommandForPlatform', () => {
|
|||
true
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.linux).toMatchInlineSnapshot(`
|
||||
"sudo ./elastic-agent install --url=http://fleetserver:8220 \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
--fleet-server-policy=policy-1 \\\\
|
||||
--certificate-authorities=<PATH_TO_CA> \\\\
|
||||
--fleet-server-es-ca=<PATH_TO_ES_CERT> \\\\
|
||||
--fleet-server-cert=<PATH_TO_FLEET_SERVER_CERT> \\\\
|
||||
--fleet-server-cert-key=<PATH_TO_FLEET_SERVER_CERT_KEY>"
|
||||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is set for mac', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'mac',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1',
|
||||
'http://fleetserver:8220',
|
||||
true
|
||||
);
|
||||
|
||||
expect(res.mac).toMatchInlineSnapshot(`
|
||||
"sudo ./elastic-agent install --url=http://fleetserver:8220 \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
|
@ -161,7 +247,7 @@ describe('getInstallCommandForPlatform', () => {
|
|||
true
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.windows).toMatchInlineSnapshot(`
|
||||
".\\\\elastic-agent.exe install --url=http://fleetserver:8220 \`
|
||||
--fleet-server-es=http://elasticsearch:9200 \`
|
||||
--fleet-server-service-token=service-token-1 \`
|
||||
|
@ -173,9 +259,9 @@ describe('getInstallCommandForPlatform', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is set for rpm-deb', () => {
|
||||
it('should return the correct command if the the policyId is set for rpm', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'rpm-deb',
|
||||
'rpm',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1',
|
||||
|
@ -183,7 +269,29 @@ describe('getInstallCommandForPlatform', () => {
|
|||
true
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
expect(res.rpm).toMatchInlineSnapshot(`
|
||||
"sudo elastic-agent enroll --url=http://fleetserver:8220 \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
--fleet-server-policy=policy-1 \\\\
|
||||
--certificate-authorities=<PATH_TO_CA> \\\\
|
||||
--fleet-server-es-ca=<PATH_TO_ES_CERT> \\\\
|
||||
--fleet-server-cert=<PATH_TO_FLEET_SERVER_CERT> \\\\
|
||||
--fleet-server-cert-key=<PATH_TO_FLEET_SERVER_CERT_KEY>"
|
||||
`);
|
||||
});
|
||||
|
||||
it('should return the correct command if the the policyId is set for deb', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'deb',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1',
|
||||
'policy-1',
|
||||
'http://fleetserver:8220',
|
||||
true
|
||||
);
|
||||
|
||||
expect(res.deb).toMatchInlineSnapshot(`
|
||||
"sudo elastic-agent enroll --url=http://fleetserver:8220 \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
|
@ -195,19 +303,4 @@ describe('getInstallCommandForPlatform', () => {
|
|||
`);
|
||||
});
|
||||
});
|
||||
|
||||
it('should return nothing for an invalid platform', () => {
|
||||
const res = getInstallCommandForPlatform(
|
||||
'rpm-deb',
|
||||
'http://elasticsearch:9200',
|
||||
'service-token-1'
|
||||
);
|
||||
|
||||
expect(res).toMatchInlineSnapshot(`
|
||||
"sudo elastic-agent enroll \\\\
|
||||
--fleet-server-es=http://elasticsearch:9200 \\\\
|
||||
--fleet-server-service-token=service-token-1 \\\\
|
||||
--fleet-server-insecure-http"
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
|
||||
import type { PLATFORM_TYPE } from '../../../../hooks';
|
||||
|
||||
export type CommandsByPlatform = {
|
||||
[key in PLATFORM_TYPE]: string;
|
||||
};
|
||||
|
||||
export function getInstallCommandForPlatform(
|
||||
platform: PLATFORM_TYPE,
|
||||
esHost: string,
|
||||
|
@ -15,7 +19,7 @@ export function getInstallCommandForPlatform(
|
|||
fleetServerHost?: string,
|
||||
isProductionDeployment?: boolean,
|
||||
sslCATrustedFingerprint?: string
|
||||
) {
|
||||
): CommandsByPlatform {
|
||||
const commandArguments = [];
|
||||
const newLineSeparator = platform === 'windows' ? '`\n' : '\\\n';
|
||||
|
||||
|
@ -52,14 +56,11 @@ export function getInstallCommandForPlatform(
|
|||
return (acc += ` ${newLineSeparator} --${key}${valOrEmpty}`);
|
||||
}, '');
|
||||
|
||||
switch (platform) {
|
||||
case 'linux-mac':
|
||||
return `sudo ./elastic-agent install ${commandArgumentsStr}`;
|
||||
case 'windows':
|
||||
return `.\\elastic-agent.exe install ${commandArgumentsStr}`;
|
||||
case 'rpm-deb':
|
||||
return `sudo elastic-agent enroll ${commandArgumentsStr}`;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
return {
|
||||
linux: `sudo ./elastic-agent install ${commandArgumentsStr}`,
|
||||
mac: `sudo ./elastic-agent install ${commandArgumentsStr}`,
|
||||
windows: `.\\elastic-agent.exe install ${commandArgumentsStr}`,
|
||||
deb: `sudo elastic-agent enroll ${commandArgumentsStr}`,
|
||||
rpm: `sudo elastic-agent enroll ${commandArgumentsStr}`,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,7 +22,12 @@ import {
|
|||
sendGetOneAgentPolicy,
|
||||
useGetAgents,
|
||||
} from '../../hooks/use_request';
|
||||
import { FleetStatusProvider, ConfigContext, useAgentEnrollmentFlyoutData } from '../../hooks';
|
||||
import {
|
||||
FleetStatusProvider,
|
||||
ConfigContext,
|
||||
useAgentEnrollmentFlyoutData,
|
||||
KibanaVersionContext,
|
||||
} from '../../hooks';
|
||||
|
||||
import { useFleetServerInstructions } from '../../applications/fleet/sections/agents/agent_requirements_page/components';
|
||||
|
||||
|
@ -34,9 +39,11 @@ import { AgentEnrollmentFlyout } from '.';
|
|||
const TestComponent = (props: Props) => (
|
||||
<KibanaContextProvider services={coreMock.createStart()}>
|
||||
<ConfigContext.Provider value={{ agents: { enabled: true, elasticsearch: {} }, enabled: true }}>
|
||||
<FleetStatusProvider>
|
||||
<AgentEnrollmentFlyout {...props} />
|
||||
</FleetStatusProvider>
|
||||
<KibanaVersionContext.Provider value={'8.1.0'}>
|
||||
<FleetStatusProvider>
|
||||
<AgentEnrollmentFlyout {...props} />
|
||||
</FleetStatusProvider>
|
||||
</KibanaVersionContext.Provider>
|
||||
</ConfigContext.Provider>
|
||||
</KibanaContextProvider>
|
||||
);
|
||||
|
|
|
@ -28,17 +28,13 @@ import {
|
|||
useLink,
|
||||
sendGetOneAgentPolicyFull,
|
||||
sendGetOneAgentPolicy,
|
||||
useKibanaVersion,
|
||||
} from '../../hooks';
|
||||
import { fullAgentPolicyToYaml, agentPolicyRouteService } from '../../services';
|
||||
|
||||
import type { PackagePolicy } from '../../../common';
|
||||
|
||||
import {
|
||||
FLEET_KUBERNETES_PACKAGE,
|
||||
KUBERNETES_RUN_INSTRUCTIONS,
|
||||
STANDALONE_RUN_INSTRUCTIONS_LINUXMAC,
|
||||
STANDALONE_RUN_INSTRUCTIONS_WINDOWS,
|
||||
} from '../../../common';
|
||||
import { FLEET_KUBERNETES_PACKAGE } from '../../../common';
|
||||
|
||||
import { PlatformSelector } from '../enrollment_instructions/manual/platform_selector';
|
||||
|
||||
|
@ -57,12 +53,35 @@ export const StandaloneInstructions = React.memo<InstructionProps>(
|
|||
'IS_LOADING'
|
||||
);
|
||||
const [yaml, setYaml] = useState<string | string>('');
|
||||
const linuxMacCommand =
|
||||
isK8s === 'IS_KUBERNETES'
|
||||
? KUBERNETES_RUN_INSTRUCTIONS
|
||||
: STANDALONE_RUN_INSTRUCTIONS_LINUXMAC;
|
||||
const kibanaVersion = useKibanaVersion();
|
||||
|
||||
const KUBERNETES_RUN_INSTRUCTIONS = 'kubectl apply -f elastic-agent-standalone-kubernetes.yaml';
|
||||
|
||||
const STANDALONE_RUN_INSTRUCTIONS_LINUX = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-linux-x86_64.tar.gz
|
||||
tar xzvf elastic-agent-${kibanaVersion}-linux-x86_64.tar.gz
|
||||
sudo ./elastic-agent install`;
|
||||
|
||||
const STANDALONE_RUN_INSTRUCTIONS_MAC = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-darwin-x86_64.tar.gz
|
||||
tar xzvf elastic-agent-${kibanaVersion}-darwin-x86_64.tar.gz
|
||||
sudo ./elastic-agent install`;
|
||||
|
||||
const STANDALONE_RUN_INSTRUCTIONS_WINDOWS = `wget https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-windows-x86_64.zip -OutFile elastic-agent-${kibanaVersion}-windows-x86_64.zip
|
||||
Expand-Archive .\elastic-agent-${kibanaVersion}-windows-x86_64.zip
|
||||
.\\elastic-agent.exe install`;
|
||||
|
||||
const linuxDebCommand = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-amd64.deb
|
||||
sudo dpkg -i elastic-agent-${kibanaVersion}-amd64.deb \nsudo systemctl enable elastic-agent \nsudo systemctl start elastic-agent`;
|
||||
|
||||
const linuxRpmCommand = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-x86_64.rpm
|
||||
sudo rpm -vi elastic-agent-${kibanaVersion}-x86_64.rpm \nsudo systemctl enable elastic-agent \nsudo systemctl start elastic-agent`;
|
||||
|
||||
const linuxCommand =
|
||||
isK8s === 'IS_KUBERNETES' ? KUBERNETES_RUN_INSTRUCTIONS : STANDALONE_RUN_INSTRUCTIONS_LINUX;
|
||||
const macCommand =
|
||||
isK8s === 'IS_KUBERNETES' ? KUBERNETES_RUN_INSTRUCTIONS : STANDALONE_RUN_INSTRUCTIONS_MAC;
|
||||
const windowsCommand =
|
||||
isK8s === 'IS_KUBERNETES' ? KUBERNETES_RUN_INSTRUCTIONS : STANDALONE_RUN_INSTRUCTIONS_WINDOWS;
|
||||
|
||||
const { docLinks } = useStartServices();
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -231,9 +250,11 @@ export const StandaloneInstructions = React.memo<InstructionProps>(
|
|||
}),
|
||||
children: (
|
||||
<PlatformSelector
|
||||
linuxMacCommand={linuxMacCommand}
|
||||
linuxCommand={linuxCommand}
|
||||
macCommand={macCommand}
|
||||
windowsCommand={windowsCommand}
|
||||
installAgentLink={docLinks.links.fleet.installElasticAgentStandalone}
|
||||
linuxDebCommand={linuxDebCommand}
|
||||
linuxRpmCommand={linuxRpmCommand}
|
||||
troubleshootLink={docLinks.links.fleet.troubleshooting}
|
||||
isK8s={isK8s === 'IS_KUBERNETES'}
|
||||
/>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import { useStartServices } from '../../../hooks';
|
||||
import { useStartServices, useKibanaVersion } from '../../../hooks';
|
||||
import type { EnrollmentAPIKey } from '../../../types';
|
||||
|
||||
import { PlatformSelector } from './platform_selector';
|
||||
|
@ -27,16 +27,37 @@ export const ManualInstructions: React.FunctionComponent<Props> = ({
|
|||
}) => {
|
||||
const { docLinks } = useStartServices();
|
||||
const enrollArgs = getfleetServerHostsEnrollArgs(apiKey, fleetServerHosts);
|
||||
const kibanaVersion = useKibanaVersion();
|
||||
|
||||
const linuxMacCommand = `sudo ./elastic-agent install ${enrollArgs}`;
|
||||
const linuxCommand = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-linux-x86_64.tar.gz
|
||||
tar xzvf elastic-agent-${kibanaVersion}-linux-x86_64.tar.gz
|
||||
cd elastic-agent-${kibanaVersion}-linux-x86_64
|
||||
sudo ./elastic-agent install ${enrollArgs}`;
|
||||
|
||||
const windowsCommand = `.\\elastic-agent.exe install ${enrollArgs}`;
|
||||
const macCommand = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-darwin-x86_64.tar.gz
|
||||
tar xzvf elastic-agent-${kibanaVersion}-darwin-x86_64.tar.gz
|
||||
cd elastic-agent-${kibanaVersion}-darwin-x86_64
|
||||
sudo ./elastic-agent install ${enrollArgs}`;
|
||||
|
||||
const windowsCommand = `wget https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-windows-x86_64.zip -OutFile elastic-agent-${kibanaVersion}-windows-x86_64.zip
|
||||
Expand-Archive .\elastic-agent-${kibanaVersion}-windows-x86_64.zip
|
||||
.\\elastic-agent.exe install ${enrollArgs}`;
|
||||
|
||||
const linuxDebCommand = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-amd64.deb
|
||||
sudo dpkg -i elastic-agent-${kibanaVersion}-amd64.deb
|
||||
sudo elastic-agent enroll ${enrollArgs} \nsudo systemctl enable elastic-agent \nsudo systemctl start elastic-agent`;
|
||||
|
||||
const linuxRpmCommand = `curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-${kibanaVersion}-x86_64.rpm
|
||||
sudo rpm -vi elastic-agent-${kibanaVersion}-x86_64.rpm
|
||||
sudo elastic-agent enroll ${enrollArgs} \nsudo systemctl enable elastic-agent \nsudo systemctl start elastic-agent`;
|
||||
|
||||
return (
|
||||
<PlatformSelector
|
||||
linuxMacCommand={linuxMacCommand}
|
||||
linuxCommand={linuxCommand}
|
||||
macCommand={macCommand}
|
||||
windowsCommand={windowsCommand}
|
||||
installAgentLink={docLinks.links.fleet.installElasticAgent}
|
||||
linuxDebCommand={linuxDebCommand}
|
||||
linuxRpmCommand={linuxRpmCommand}
|
||||
troubleshootLink={docLinks.links.fleet.troubleshooting}
|
||||
isK8s={false}
|
||||
/>
|
||||
|
|
|
@ -7,7 +7,14 @@
|
|||
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { EuiText, EuiSpacer, EuiLink, EuiCodeBlock, EuiButtonGroup } from '@elastic/eui';
|
||||
import {
|
||||
EuiText,
|
||||
EuiSpacer,
|
||||
EuiLink,
|
||||
EuiCodeBlock,
|
||||
EuiButtonGroup,
|
||||
EuiCallOut,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
|
@ -15,9 +22,11 @@ import type { PLATFORM_TYPE } from '../../../hooks';
|
|||
import { PLATFORM_OPTIONS, usePlatform } from '../../../hooks';
|
||||
|
||||
interface Props {
|
||||
linuxMacCommand: string;
|
||||
linuxCommand: string;
|
||||
macCommand: string;
|
||||
windowsCommand: string;
|
||||
installAgentLink: string;
|
||||
linuxDebCommand: string;
|
||||
linuxRpmCommand: string;
|
||||
troubleshootLink: string;
|
||||
isK8s: boolean;
|
||||
}
|
||||
|
@ -28,14 +37,27 @@ const CommandCode = styled.pre({
|
|||
});
|
||||
|
||||
export const PlatformSelector: React.FunctionComponent<Props> = ({
|
||||
linuxMacCommand,
|
||||
linuxCommand,
|
||||
macCommand,
|
||||
windowsCommand,
|
||||
installAgentLink,
|
||||
linuxDebCommand,
|
||||
linuxRpmCommand,
|
||||
troubleshootLink,
|
||||
isK8s,
|
||||
}) => {
|
||||
const { platform, setPlatform } = usePlatform();
|
||||
|
||||
const systemPackageCallout = (
|
||||
<EuiCallOut
|
||||
title={i18n.translate('xpack.fleet.enrollmentInstructions.callout', {
|
||||
defaultMessage:
|
||||
'We recommend using the installers (TAR/ZIP) over system packages (RPM/DEB) because they provide the ability to upgrade your agent with Fleet.',
|
||||
})}
|
||||
color="warning"
|
||||
iconType="alert"
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<EuiText>
|
||||
|
@ -54,7 +76,7 @@ export const PlatformSelector: React.FunctionComponent<Props> = ({
|
|||
<EuiSpacer size="l" />
|
||||
{isK8s ? (
|
||||
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
|
||||
<CommandCode>{linuxMacCommand}</CommandCode>
|
||||
<CommandCode>{linuxCommand}</CommandCode>
|
||||
</EuiCodeBlock>
|
||||
) : (
|
||||
<>
|
||||
|
@ -67,9 +89,14 @@ export const PlatformSelector: React.FunctionComponent<Props> = ({
|
|||
})}
|
||||
/>
|
||||
<EuiSpacer size="s" />
|
||||
{platform === 'linux-mac' && (
|
||||
{platform === 'linux' && (
|
||||
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
|
||||
<CommandCode>{linuxMacCommand}</CommandCode>
|
||||
<CommandCode>{linuxCommand}</CommandCode>
|
||||
</EuiCodeBlock>
|
||||
)}
|
||||
{platform === 'mac' && (
|
||||
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
|
||||
<CommandCode>{macCommand}</CommandCode>
|
||||
</EuiCodeBlock>
|
||||
)}
|
||||
{platform === 'windows' && (
|
||||
|
@ -77,23 +104,23 @@ export const PlatformSelector: React.FunctionComponent<Props> = ({
|
|||
<CommandCode>{windowsCommand}</CommandCode>
|
||||
</EuiCodeBlock>
|
||||
)}
|
||||
{platform === 'rpm-deb' && (
|
||||
<EuiText>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.enrollmentInstructions.moreInstructionsText"
|
||||
defaultMessage="See the {link} for RPM / DEB deploy instructions."
|
||||
values={{
|
||||
link: (
|
||||
<EuiLink target="_blank" external href={installAgentLink}>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.enrollmentInstructions.moreInstructionsLink"
|
||||
defaultMessage="Elastic Agent docs"
|
||||
/>
|
||||
</EuiLink>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</EuiText>
|
||||
{platform === 'deb' && (
|
||||
<>
|
||||
{systemPackageCallout}
|
||||
<EuiSpacer size="m" />
|
||||
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
|
||||
<CommandCode>{linuxDebCommand}</CommandCode>
|
||||
</EuiCodeBlock>
|
||||
</>
|
||||
)}
|
||||
{platform === 'rpm' && (
|
||||
<>
|
||||
{systemPackageCallout}
|
||||
<EuiSpacer size="m" />
|
||||
<EuiCodeBlock fontSize="m" isCopyable={true} paddingSize="m">
|
||||
<CommandCode>{linuxRpmCommand}</CommandCode>
|
||||
</EuiCodeBlock>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { useState } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export type PLATFORM_TYPE = 'linux-mac' | 'windows' | 'rpm-deb';
|
||||
export type PLATFORM_TYPE = 'linux' | 'mac' | 'windows' | 'rpm' | 'deb';
|
||||
|
||||
export const PLATFORM_OPTIONS: Array<{
|
||||
label: string;
|
||||
|
@ -16,12 +16,19 @@ export const PLATFORM_OPTIONS: Array<{
|
|||
'data-test-subj'?: string;
|
||||
}> = [
|
||||
{
|
||||
id: 'linux-mac',
|
||||
id: 'linux',
|
||||
label: i18n.translate('xpack.fleet.enrollmentInstructions.platformButtons.linux', {
|
||||
defaultMessage: 'Linux / macOS',
|
||||
defaultMessage: 'Linux',
|
||||
}),
|
||||
'data-test-subj': 'platformTypeLinux',
|
||||
},
|
||||
{
|
||||
id: 'mac',
|
||||
label: i18n.translate('xpack.fleet.enrollmentInstructions.platformButtons.mac', {
|
||||
defaultMessage: 'Mac',
|
||||
}),
|
||||
'data-test-subj': 'platformTypeMac',
|
||||
},
|
||||
{
|
||||
id: 'windows',
|
||||
label: i18n.translate('xpack.fleet.enrollmentInstructions.platformButtons.windows', {
|
||||
|
@ -30,16 +37,23 @@ export const PLATFORM_OPTIONS: Array<{
|
|||
'data-test-subj': 'platformTypeWindows',
|
||||
},
|
||||
{
|
||||
id: 'rpm-deb',
|
||||
label: i18n.translate('xpack.fleet.enrollmentInstructions.platformButtons.rpm', {
|
||||
defaultMessage: 'RPM / DEB',
|
||||
id: 'rpm',
|
||||
label: i18n.translate('xpack.fleet.enrollmentInstructions.platformButtons.linux.rpm', {
|
||||
defaultMessage: 'RPM',
|
||||
}),
|
||||
'data-test-subj': 'platformTypeRpm',
|
||||
'data-test-subj': 'platformTypeLinuxRpm',
|
||||
},
|
||||
{
|
||||
id: 'deb',
|
||||
label: i18n.translate('xpack.fleet.enrollmentInstructions.platformButtons.linux.deb', {
|
||||
defaultMessage: 'DEB',
|
||||
}),
|
||||
'data-test-subj': 'platformTypeLinuxDeb',
|
||||
},
|
||||
];
|
||||
|
||||
export function usePlatform() {
|
||||
const [platform, setPlatform] = useState<PLATFORM_TYPE>('linux-mac');
|
||||
const [platform, setPlatform] = useState<PLATFORM_TYPE>('linux');
|
||||
|
||||
return {
|
||||
platform,
|
||||
|
|
|
@ -10146,8 +10146,6 @@
|
|||
"xpack.fleet.editPackagePolicy.upgradePageTitleWithPackageName": "Mettre à niveau l'intégration {packageName}",
|
||||
"xpack.fleet.enrollemntAPIKeyList.emptyMessage": "Jeton d'enregistrement introuvable.",
|
||||
"xpack.fleet.enrollemntAPIKeyList.loadingTokensMessage": "Chargement des jetons d'enregistrement en cours…",
|
||||
"xpack.fleet.enrollmentInstructions.moreInstructionsLink": "Documentation sur Elastic Agent",
|
||||
"xpack.fleet.enrollmentInstructions.moreInstructionsText": "Consultez {link} pour obtenir les instructions de déploiement RPM/DEB.",
|
||||
"xpack.fleet.enrollmentInstructions.platformSelectAriaLabel": "Plateforme",
|
||||
"xpack.fleet.enrollmentInstructions.troubleshootingLink": "guide de résolution des problèmes",
|
||||
"xpack.fleet.enrollmentInstructions.troubleshootingText": "Si vous rencontrez des difficultés pour vous connecter, consultez notre {link}.",
|
||||
|
@ -10241,7 +10239,6 @@
|
|||
"xpack.fleet.fleetServerSetup.generateServiceTokenButton": "Générer un jeton de service",
|
||||
"xpack.fleet.fleetServerSetup.generateServiceTokenDescription": "Un jeton de service accorde au serveur Fleet les autorisations en écriture nécessaires dans Elasticsearch.",
|
||||
"xpack.fleet.fleetServerSetup.installAgentDescription": "Depuis le répertoire de l'agent, copiez et exécutez la commande de démarrage rapide appropriée pour lancer un agent Elastic en tant que serveur Fleet à l'aide du jeton généré et d'un certificat autosigné. Reportez-vous au {userGuideLink} pour obtenir les instructions d'utilisation de vos propres certificats à des fins de déploiement de production. Toutes les commandes nécessitent des privilèges d'administrateur.",
|
||||
"xpack.fleet.fleetServerSetup.platformSelectAriaLabel": "Plateforme",
|
||||
"xpack.fleet.fleetServerSetup.productionText": "Production",
|
||||
"xpack.fleet.fleetServerSetup.quickStartText": "Démarrage rapide",
|
||||
"xpack.fleet.fleetServerSetup.saveServiceTokenDescription": "Enregistrez les informations de votre jeton de service. Ce message s'affiche une seule fois.",
|
||||
|
|
|
@ -12007,10 +12007,7 @@
|
|||
"xpack.fleet.editPackagePolicy.upgradePageTitleWithPackageName": "{packageName}統合をアップグレード",
|
||||
"xpack.fleet.enrollemntAPIKeyList.emptyMessage": "登録トークンが見つかりません。",
|
||||
"xpack.fleet.enrollemntAPIKeyList.loadingTokensMessage": "登録トークンを読み込んでいます...",
|
||||
"xpack.fleet.enrollmentInstructions.moreInstructionsLink": "Elastic エージェントドキュメント",
|
||||
"xpack.fleet.enrollmentInstructions.moreInstructionsText": "RPM/DEB デプロイの手順については、{link}を参照してください。",
|
||||
"xpack.fleet.enrollmentInstructions.platformButtons.linux": "Linux / macOS",
|
||||
"xpack.fleet.enrollmentInstructions.platformButtons.rpm": "RPM / DEB",
|
||||
"xpack.fleet.enrollmentInstructions.platformButtons.windows": "Windows",
|
||||
"xpack.fleet.enrollmentInstructions.platformSelectAriaLabel": "プラットフォーム",
|
||||
"xpack.fleet.enrollmentInstructions.troubleshootingLink": "トラブルシューティングガイド",
|
||||
|
@ -12165,7 +12162,6 @@
|
|||
"xpack.fleet.fleetServerSetup.generateServiceTokenButton": "サービストークンを生成",
|
||||
"xpack.fleet.fleetServerSetup.generateServiceTokenDescription": "サービストークンは、Elasticsearchに書き込むためのFleetサーバーアクセス権を付与します。",
|
||||
"xpack.fleet.fleetServerSetup.installAgentDescription": "エージェントディレクトリから、適切なクイックスタートコマンドをコピーして実行し、生成されたトークンと自己署名証明書を使用して、ElasticエージェントをFleetサーバーとして起動します。本番デプロイで独自の証明書を使用する手順については、{userGuideLink}を参照してください。すべてのコマンドには管理者権限が必要です。",
|
||||
"xpack.fleet.fleetServerSetup.platformSelectAriaLabel": "プラットフォーム",
|
||||
"xpack.fleet.fleetServerSetup.productionText": "本番運用",
|
||||
"xpack.fleet.fleetServerSetup.quickStartText": "クイックスタート",
|
||||
"xpack.fleet.fleetServerSetup.saveServiceTokenDescription": "サービストークン情報を保存します。これは1回だけ表示されます。",
|
||||
|
|
|
@ -12030,10 +12030,7 @@
|
|||
"xpack.fleet.editPackagePolicy.upgradePageTitleWithPackageName": "升级 {packageName} 集成",
|
||||
"xpack.fleet.enrollemntAPIKeyList.emptyMessage": "未找到任何注册令牌。",
|
||||
"xpack.fleet.enrollemntAPIKeyList.loadingTokensMessage": "正在加载注册令牌......",
|
||||
"xpack.fleet.enrollmentInstructions.moreInstructionsLink": "Elastic 代理文档",
|
||||
"xpack.fleet.enrollmentInstructions.moreInstructionsText": "有关 RPM/DEB 部署说明,请参见 {link}。",
|
||||
"xpack.fleet.enrollmentInstructions.platformButtons.linux": "Linux/macOS",
|
||||
"xpack.fleet.enrollmentInstructions.platformButtons.rpm": "RPM/DEB",
|
||||
"xpack.fleet.enrollmentInstructions.platformButtons.windows": "Windows",
|
||||
"xpack.fleet.enrollmentInstructions.platformSelectAriaLabel": "平台",
|
||||
"xpack.fleet.enrollmentInstructions.troubleshootingLink": "故障排除指南",
|
||||
|
@ -12188,7 +12185,6 @@
|
|||
"xpack.fleet.fleetServerSetup.generateServiceTokenButton": "生成服务令牌",
|
||||
"xpack.fleet.fleetServerSetup.generateServiceTokenDescription": "服务令牌授予 Fleet 服务器向 Elasticsearch 写入的权限。",
|
||||
"xpack.fleet.fleetServerSetup.installAgentDescription": "从代理目录中,复制并运行适当的快速启动命令,以使用生成的令牌和自签名证书将 Elastic 代理启动为 Fleet 服务器。有关如何将自己的证书用于生产部署,请参阅 {userGuideLink}。所有命令都需要管理员权限。",
|
||||
"xpack.fleet.fleetServerSetup.platformSelectAriaLabel": "平台",
|
||||
"xpack.fleet.fleetServerSetup.productionText": "生产",
|
||||
"xpack.fleet.fleetServerSetup.quickStartText": "快速启动",
|
||||
"xpack.fleet.fleetServerSetup.saveServiceTokenDescription": "保存服务令牌信息。其仅显示一次。",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue