-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Web: Add alternate EC2 auto discover flow using AWS Systems Manager (…
…SSM) (#42038) * Define ssm endpoint and related types * Define ssm as a selectable resource - Make refreshing optional for aws region selector - Define ssm ec2 flow * Create a manual configure discovery service view for self hosted * Create a discovery config with ssm view * Address design review: remove ec2 instance eice flow * Address CR
- Loading branch information
Showing
16 changed files
with
1,034 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
...eleport/src/Discover/Server/ConfigureDiscoveryService/ConfigureDiscoveryService.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { MemoryRouter } from 'react-router'; | ||
|
||
import { ContextProvider } from 'teleport'; | ||
import cfg from 'teleport/config'; | ||
import { createTeleportContext } from 'teleport/mocks/contexts'; | ||
import { | ||
DiscoverProvider, | ||
DiscoverContextState, | ||
} from 'teleport/Discover/useDiscover'; | ||
import { | ||
IntegrationKind, | ||
IntegrationStatusCode, | ||
} from 'teleport/services/integrations'; | ||
import { ResourceKind } from 'teleport/Discover/Shared'; | ||
import { | ||
DiscoverDiscoveryConfigMethod, | ||
DiscoverEventResource, | ||
} from 'teleport/services/userEvent'; | ||
import { ServerLocation } from 'teleport/Discover/SelectResource'; | ||
|
||
import { ConfigureDiscoveryService as Comp } from './ConfigureDiscoveryService'; | ||
|
||
export default { | ||
title: 'Teleport/Discover/Server/EC2', | ||
}; | ||
|
||
export const ConfigureDiscoveryService = () => { | ||
return <Component />; | ||
}; | ||
|
||
const Component = () => { | ||
const ctx = createTeleportContext(); | ||
const discoverCtx: DiscoverContextState = { | ||
agentMeta: { | ||
resourceName: 'aws-console', | ||
agentMatcherLabels: [], | ||
awsRegion: 'ap-south-1', | ||
awsIntegration: { | ||
kind: IntegrationKind.AwsOidc, | ||
name: 'some-oidc-name', | ||
resourceType: 'integration', | ||
spec: { | ||
roleArn: 'arn:aws:iam::123456789012:role/test-role-arn', | ||
issuerS3Bucket: '', | ||
issuerS3Prefix: '', | ||
}, | ||
statusCode: IntegrationStatusCode.Running, | ||
}, | ||
autoDiscovery: { | ||
config: { | ||
name: 'discovery-config-name', | ||
discoveryGroup: 'discovery-group-name', | ||
aws: [], | ||
}, | ||
}, | ||
}, | ||
currentStep: 0, | ||
nextStep: () => null, | ||
prevStep: () => null, | ||
onSelectResource: () => null, | ||
resourceSpec: { | ||
name: '', | ||
kind: ResourceKind.Application, | ||
icon: null, | ||
keywords: '', | ||
event: DiscoverEventResource.Ec2Instance, | ||
nodeMeta: { | ||
location: ServerLocation.Aws, | ||
discoveryConfigMethod: DiscoverDiscoveryConfigMethod.AwsEc2Ssm, | ||
}, | ||
}, | ||
exitFlow: () => null, | ||
viewConfig: null, | ||
indexedViews: [], | ||
setResourceSpec: () => null, | ||
updateAgentMeta: () => null, | ||
emitErrorEvent: () => null, | ||
emitEvent: () => null, | ||
eventState: null, | ||
}; | ||
|
||
cfg.proxyCluster = 'localhost'; | ||
return ( | ||
<MemoryRouter | ||
initialEntries={[ | ||
{ pathname: cfg.routes.discover, state: { entity: 'application' } }, | ||
]} | ||
> | ||
<ContextProvider ctx={ctx}> | ||
<DiscoverProvider mockCtx={discoverCtx}> | ||
<Comp /> | ||
</DiscoverProvider> | ||
</ContextProvider> | ||
</MemoryRouter> | ||
); | ||
}; |
67 changes: 67 additions & 0 deletions
67
...ages/teleport/src/Discover/Server/ConfigureDiscoveryService/ConfigureDiscoveryService.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { Box, Text } from 'design'; | ||
|
||
import { useDiscover } from 'teleport/Discover/useDiscover'; | ||
import useTeleport from 'teleport/useTeleport'; | ||
|
||
import { SelfHostedAutoDiscoverDirections } from 'teleport/Discover/Shared/AutoDiscovery/SelfHostedAutoDiscoverDirections'; | ||
import { DEFAULT_DISCOVERY_GROUP_NON_CLOUD } from 'teleport/services/discovery'; | ||
|
||
import { ActionButtons, Header } from '../../Shared'; | ||
import { SingleEc2InstanceInstallation } from '../Shared'; | ||
|
||
export function ConfigureDiscoveryService() { | ||
const { nextStep, prevStep, agentMeta, updateAgentMeta } = useDiscover(); | ||
|
||
const [discoveryGroupName, setDiscoveryGroupName] = useState( | ||
DEFAULT_DISCOVERY_GROUP_NON_CLOUD | ||
); | ||
|
||
const { storeUser } = useTeleport(); | ||
|
||
function handleNextStep() { | ||
updateAgentMeta({ | ||
...agentMeta, | ||
autoDiscovery: { | ||
config: { name: '', aws: [], discoveryGroup: discoveryGroupName }, | ||
}, | ||
}); | ||
nextStep(); | ||
} | ||
|
||
return ( | ||
<Box maxWidth="1000px"> | ||
<Header>Configure Teleport Discovery Service</Header> | ||
<Text mb={4}> | ||
The Teleport Discovery Service can connect to Amazon EC2 and | ||
automatically discover and enroll EC2 instances. | ||
</Text> | ||
<SingleEc2InstanceInstallation /> | ||
<SelfHostedAutoDiscoverDirections | ||
showSubHeader={false} | ||
clusterPublicUrl={storeUser.state.cluster.publicURL} | ||
discoveryGroupName={discoveryGroupName} | ||
setDiscoveryGroupName={setDiscoveryGroupName} | ||
/> | ||
<ActionButtons onProceed={handleNextStep} onPrev={prevStep} /> | ||
</Box> | ||
); | ||
} |
53 changes: 53 additions & 0 deletions
53
...packages/teleport/src/Discover/Server/DiscoveryConfigSsm/DiscoveryConfigCreatedDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Teleport | ||
* Copyright (C) 2024 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Text, Flex, ButtonPrimary, Box } from 'design'; | ||
import * as Icons from 'design/Icon'; | ||
import Dialog, { DialogContent } from 'design/DialogConfirmation'; | ||
|
||
export function DiscoveryConfigCreatedDialog({ | ||
toNextStep, | ||
}: { | ||
toNextStep: () => void; | ||
}) { | ||
return ( | ||
<Dialog disableEscapeKeyDown={false} open={true}> | ||
<DialogContent | ||
width="460px" | ||
alignItems="center" | ||
mb={0} | ||
textAlign="center" | ||
> | ||
<Flex mb={5}> | ||
<Icons.Check size="small" ml={1} mr={2} color="success.main" /> | ||
<Box> | ||
<Text>Discovery configuration successfully created.</Text> | ||
<Text> | ||
The discovery service can take a few minutes to finish | ||
auto-enrolling resources. | ||
</Text> | ||
</Box> | ||
</Flex> | ||
<ButtonPrimary width="100%" onClick={() => toNextStep()}> | ||
Next | ||
</ButtonPrimary> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
} |
Oops, something went wrong.