diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/utils/install_command_utils.ts b/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/utils/install_command_utils.ts index b528c5092ea14..ff69a3b4f5edd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/utils/install_command_utils.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/components/fleet_server_instructions/utils/install_command_utils.ts @@ -52,9 +52,6 @@ function getArtifact(platform: PLATFORM_TYPE, kibanaVersion: string) { kubernetes: { downloadCommand: '', }, - googleCloudShell: { - downloadCommand: '', - }, }; return artifactMap[platform]; diff --git a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/compute_steps.tsx b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/compute_steps.tsx index a750fa48aae7f..08c967e98e04f 100644 --- a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/compute_steps.tsx +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/compute_steps.tsx @@ -37,6 +37,7 @@ import { AgentEnrollmentConfirmationStep, InstallManagedAgentStep, InstallCloudFormationManagedAgentStep, + InstallGoogleCloudShellManagedAgentStep, IncomingDataConfirmationStep, } from '.'; @@ -255,6 +256,15 @@ export const ManagedSteps: React.FunctionComponent = ({ cloudSecurityIntegration, }) ); + } else if (cloudSecurityIntegration?.cloudShellUrl) { + steps.push( + InstallGoogleCloudShellManagedAgentStep({ + apiKeyData, + selectedApiKeyId, + cloudShellUrl: cloudSecurityIntegration.cloudShellUrl, + cloudShellCommand: installManagedCommands.googleCloudShell, + }) + ); } else { steps.push( InstallManagedAgentStep({ diff --git a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/index.tsx b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/index.tsx index 1793a1b602e7e..8c9adb376f423 100644 --- a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/index.tsx +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/index.tsx @@ -11,6 +11,7 @@ export * from './agent_policy_selection_step'; export * from './configure_standalone_agent_step'; export * from './incoming_data_confirmation_step'; export * from './install_cloud_formation_managed_agent_step'; +export * from './install_google_cloud_shell_managed_agent_step'; export * from './install_managed_agent_step'; export * from './install_standalone_agent_step'; export * from './installation_mode_selection_step'; diff --git a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/install_google_cloud_shell_managed_agent_step.tsx b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/install_google_cloud_shell_managed_agent_step.tsx new file mode 100644 index 0000000000000..ff367be9125fd --- /dev/null +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/steps/install_google_cloud_shell_managed_agent_step.tsx @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { i18n } from '@kbn/i18n'; + +import type { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; + +import type { GetOneEnrollmentAPIKeyResponse } from '../../../../common/types/rest_spec/enrollment_api_key'; + +import { GoogleCloudShellInstructions } from '../google_cloud_shell_instructions'; + +export const InstallGoogleCloudShellManagedAgentStep = ({ + selectedApiKeyId, + apiKeyData, + isComplete, + cloudShellUrl, + cloudShellCommand, +}: { + selectedApiKeyId?: string; + apiKeyData?: GetOneEnrollmentAPIKeyResponse | null; + isComplete?: boolean; + cloudShellUrl?: string | undefined; + cloudShellCommand?: string; +}): EuiContainedStepProps => { + const nonCompleteStatus = selectedApiKeyId ? undefined : 'disabled'; + const status = isComplete ? 'complete' : nonCompleteStatus; + + return { + status, + title: i18n.translate('xpack.fleet.agentEnrollment.cloudShell.stepEnrollAndRunAgentTitle', { + defaultMessage: 'Install Elastic Agent on your cloud', + }), + children: + selectedApiKeyId && apiKeyData && cloudShellUrl ? ( + + ) : ( + + ), + }; +}; diff --git a/x-pack/plugins/fleet/public/components/enrollment_instructions/install_section.tsx b/x-pack/plugins/fleet/public/components/enrollment_instructions/install_section.tsx index 5c236e4aa7c09..b4f90212d8625 100644 --- a/x-pack/plugins/fleet/public/components/enrollment_instructions/install_section.tsx +++ b/x-pack/plugins/fleet/public/components/enrollment_instructions/install_section.tsx @@ -44,7 +44,6 @@ export const InstallSection: React.FunctionComponent = ({ windowsCommand={installCommand.windows} linuxDebCommand={installCommand.deb} linuxRpmCommand={installCommand.rpm} - googleCloudShellCommand={installCommand.googleCloudShell} k8sCommand={installCommand.kubernetes} hasK8sIntegration={isK8s === 'IS_KUBERNETES' || isK8s === 'IS_KUBERNETES_MULTIPAGE'} cloudSecurityIntegration={cloudSecurityIntegration} diff --git a/x-pack/plugins/fleet/public/components/enrollment_instructions/manual/index.tsx b/x-pack/plugins/fleet/public/components/enrollment_instructions/manual/index.tsx index ce3015dd2ccbd..ceda8b4c68905 100644 --- a/x-pack/plugins/fleet/public/components/enrollment_instructions/manual/index.tsx +++ b/x-pack/plugins/fleet/public/components/enrollment_instructions/manual/index.tsx @@ -64,7 +64,7 @@ sudo elastic-agent enroll ${enrollArgs} \nsudo systemctl enable elastic-agent \n sudo rpm -vi elastic-agent-${kibanaVersion}-x86_64.rpm sudo elastic-agent enroll ${enrollArgs} \nsudo systemctl enable elastic-agent \nsudo systemctl start elastic-agent`; - const googleCloudShellCommand = `FLEET_URL=${fleetServerUrl} ENROLLMENT_TOKEN=${enrollmentToken} STACK_VERSION=${kibanaVersion} ./deploy.sh`; + const googleCloudShellCommand = `gcloud config set project && \nFLEET_URL=${fleetServerUrl} ENROLLMENT_TOKEN=${enrollmentToken} STACK_VERSION=${kibanaVersion} ./deploy.sh`; return { linux: linuxCommand, diff --git a/x-pack/plugins/fleet/public/components/enrollment_instructions/standalone/index.tsx b/x-pack/plugins/fleet/public/components/enrollment_instructions/standalone/index.tsx index ca2754daf1b71..6994cf2a7ebc2 100644 --- a/x-pack/plugins/fleet/public/components/enrollment_instructions/standalone/index.tsx +++ b/x-pack/plugins/fleet/public/components/enrollment_instructions/standalone/index.tsx @@ -38,6 +38,5 @@ cd elastic-agent-${kibanaVersion}-windows-x86_64 deb: linuxDebCommand, rpm: linuxRpmCommand, kubernetes: k8sCommand, - googleCloudShell: '', }; }; diff --git a/x-pack/plugins/fleet/public/components/google_cloud_shell_guide.tsx b/x-pack/plugins/fleet/public/components/google_cloud_shell_guide.tsx index 0efe5719e3166..89b490f2d0967 100644 --- a/x-pack/plugins/fleet/public/components/google_cloud_shell_guide.tsx +++ b/x-pack/plugins/fleet/public/components/google_cloud_shell_guide.tsx @@ -26,7 +26,7 @@ const Link = ({ children, url }: { children: React.ReactNode; url: string }) => export const GoogleCloudShellGuide = (props: { commandText: string }) => { return ( <> - +

{

    -
  1. - -
  2. <> @@ -67,7 +61,7 @@ export const GoogleCloudShellGuide = (props: { commandText: string }) => {
diff --git a/x-pack/plugins/fleet/public/components/platform_selector.tsx b/x-pack/plugins/fleet/public/components/platform_selector.tsx index a4f08c265a565..a41194b472cbd 100644 --- a/x-pack/plugins/fleet/public/components/platform_selector.tsx +++ b/x-pack/plugins/fleet/public/components/platform_selector.tsx @@ -24,15 +24,9 @@ import { FLEET_CLOUD_SECURITY_POSTURE_CSPM_POLICY_TEMPLATE, } from '../../common/constants/epm'; import { type PLATFORM_TYPE } from '../hooks'; -import { - REDUCED_PLATFORM_OPTIONS, - PLATFORM_OPTIONS, - PLATFORM_OPTIONS_CLOUD_SHELL, - usePlatform, -} from '../hooks'; +import { REDUCED_PLATFORM_OPTIONS, PLATFORM_OPTIONS, usePlatform } from '../hooks'; import { KubernetesInstructions } from './agent_enrollment_flyout/kubernetes_instructions'; -import { GoogleCloudShellInstructions } from './agent_enrollment_flyout/google_cloud_shell_instructions'; import type { CloudSecurityIntegration } from './agent_enrollment_flyout/types'; interface Props { @@ -42,7 +36,6 @@ interface Props { linuxDebCommand: string; linuxRpmCommand: string; k8sCommand: string; - googleCloudShellCommand?: string | undefined; hasK8sIntegration: boolean; cloudSecurityIntegration?: CloudSecurityIntegration | undefined; hasK8sIntegrationMultiPage: boolean; @@ -65,7 +58,6 @@ export const PlatformSelector: React.FunctionComponent = ({ linuxDebCommand, linuxRpmCommand, k8sCommand, - googleCloudShellCommand, hasK8sIntegration, cloudSecurityIntegration, hasK8sIntegrationMultiPage, @@ -76,9 +68,6 @@ export const PlatformSelector: React.FunctionComponent = ({ onCopy, }) => { const getInitialPlatform = useCallback(() => { - if (cloudSecurityIntegration?.cloudShellUrl) { - return 'googleCloudShell'; - } if ( hasK8sIntegration || (cloudSecurityIntegration?.integrationType === @@ -88,12 +77,7 @@ export const PlatformSelector: React.FunctionComponent = ({ return 'kubernetes'; return 'linux'; - }, [ - hasK8sIntegration, - cloudSecurityIntegration?.integrationType, - isManaged, - cloudSecurityIntegration?.cloudShellUrl, - ]); + }, [hasK8sIntegration, cloudSecurityIntegration?.integrationType, isManaged]); const { platform, setPlatform } = usePlatform(getInitialPlatform()); @@ -104,12 +88,9 @@ export const PlatformSelector: React.FunctionComponent = ({ const getPlatformOptions = useCallback(() => { const platformOptions = isReduced ? REDUCED_PLATFORM_OPTIONS : PLATFORM_OPTIONS; - const platformOptionsWithCloudShell = cloudSecurityIntegration?.cloudShellUrl - ? PLATFORM_OPTIONS_CLOUD_SHELL - : platformOptions; - return platformOptionsWithCloudShell; - }, [isReduced, cloudSecurityIntegration?.cloudShellUrl]); + return platformOptions; + }, [isReduced]); const [copyButtonClicked, setCopyButtonClicked] = useState(false); @@ -164,7 +145,6 @@ export const PlatformSelector: React.FunctionComponent = ({ deb: linuxDebCommand, rpm: linuxRpmCommand, kubernetes: k8sCommand, - googleCloudShell: k8sCommand, }; const onTextAreaClick = () => { if (onCopy) onCopy(); @@ -229,15 +209,6 @@ export const PlatformSelector: React.FunctionComponent = ({ )} - {platform === 'googleCloudShell' && isManaged && ( - <> - - - - )} {!hasK8sIntegrationMultiPage && ( <> {platform === 'kubernetes' && ( @@ -250,19 +221,18 @@ export const PlatformSelector: React.FunctionComponent = ({
)} - {platform !== 'googleCloudShell' && ( - - {commandsByPlatform[platform]} - - )} + + + {commandsByPlatform[platform]} + {fullCopyButton && ( diff --git a/x-pack/plugins/fleet/public/hooks/use_platform.tsx b/x-pack/plugins/fleet/public/hooks/use_platform.tsx index 7a5a4aae323b3..94362a5c5ed7d 100644 --- a/x-pack/plugins/fleet/public/hooks/use_platform.tsx +++ b/x-pack/plugins/fleet/public/hooks/use_platform.tsx @@ -8,14 +8,7 @@ import { useState } from 'react'; import { i18n } from '@kbn/i18n'; -export type PLATFORM_TYPE = - | 'linux' - | 'mac' - | 'windows' - | 'rpm' - | 'deb' - | 'kubernetes' - | 'googleCloudShell'; +export type PLATFORM_TYPE = 'linux' | 'mac' | 'windows' | 'rpm' | 'deb' | 'kubernetes'; export const REDUCED_PLATFORM_OPTIONS: Array<{ label: string;