Skip to content

Add auto enrolling capability to EKS Discover flow#38432

Merged
AntonAM merged 21 commits intomasterfrom
anton/eks-auto-discover-ui
Feb 29, 2024
Merged

Add auto enrolling capability to EKS Discover flow#38432
AntonAM merged 21 commits intomasterfrom
anton/eks-auto-discover-ui

Conversation

@AntonAM
Copy link
Copy Markdown
Contributor

@AntonAM AntonAM commented Feb 20, 2024

This PR adds ability to setup autoenrollment of EKS clusters in the Discover UI using discover configs.

Autoenrollment of EKS is very similar to autoenrollment of RDS databases, so it follows same pattern, even a bit simpler because we don't need to think about deploying DB services. I extracted shared components -SelfHostedAutoDiscoverDirections and AutoEnrollDialog.

Demo in action: https://www.loom.com/share/5e4e6bb2d6494338ad96cad7964dc711

Changelog: Add auto-enrolling capabilities to EKS discover flow in the web UI

@AntonAM AntonAM added the ui label Feb 20, 2024
@AntonAM AntonAM force-pushed the anton/eks-auto-discover-ui branch 2 times, most recently from d89a7c0 to 243366b Compare February 20, 2024 19:55
@AntonAM AntonAM requested a review from kimlisa February 20, 2024 20:13
@AntonAM AntonAM force-pushed the anton/eks-auto-discover-ui branch from 243366b to 07d2cce Compare February 20, 2024 23:13
@AntonAM AntonAM marked this pull request as ready for review February 20, 2024 23:20
@AntonAM AntonAM requested review from gzdunek and ryanclark and removed request for ravicious and rudream February 20, 2024 23:26
Copy link
Copy Markdown
Contributor

@gzdunek gzdunek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the PR would be a bit simpler to review if extracting the shared components happened in a separate PR. Now it is difficult to distinguish between the moved code and the new one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I'd just keep move content of this function to the catch clause, we use it only in that place.
Also we have a logic that isn't use at all (cfg.setAttempt).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed ca14a4c

Comment thread web/packages/teleport/src/Discover/Kubernetes/SetupAccess/SetupAccess.tsx Outdated
@AntonAM
Copy link
Copy Markdown
Contributor Author

AntonAM commented Feb 22, 2024

@gzdunek thanks for the review! Yeah, you're right, it would be better if I at least did a dedicated commit for extraction. (AutoEnrollDialog was correctly identified as moved, SelfHostedAutoDiscoverDirections file content was copied almost exactly as is, except for changing databases text reference to "resources")

Copy link
Copy Markdown
Contributor

@kimlisa kimlisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we ask kenny for advice (if yes ignore my comment)? my initial reaction is that it should be stacked on top

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add a comment on what notifyAboutDelay means (i think skipDeployment made more sense tbh 🤷‍♀️ ). in the deployment section we let user know it'll take a few minutes, but since we are skipping deployment we have to show the note in the enrolling section

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment. EKS doesn't have service deployment but has same need to warn user. I think it's a general capability that we want to notify user that for auto discovery resources will take some time to appear. be00e9c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd leave it empty string if cloud, to make a point that that variable only applies to self-hosted

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure this is necessary, think you can just do this?

export const WithTraitsAutoDiscovery = () => (
  <MemoryRouter>
    <SetupAccess {...props}  agentMeta={...props.agentMeta, autoDiscovery= .....} />
  </MemoryRouter>
);

i wasn't sure if you knew, but this copy is a shallow copy, nested things dont get copied and you could be modifying the original

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it's shallow copy, that's why we did it twice so we don't change original props. I didn't figure out syntax at first for the inline change (it needs extra braces agentMeta={{...props.agentMeta, autoDiscovery: {...} }} ), changed. 0fd4f00

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i encourage a story :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :) f117d5c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if auto discovering, does duplicated users/groups gets de-duplicated in the network call? i'd add a test for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep it's deduplicated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd add a test similar to what's being done in RDS

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add test (and for useUserTraits), but will do it in a separate PR, since it will take me some time and I just want to make sure EKS auto discovery is merged for 15.1 release

Comment on lines 61 to 69
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is simple enough to just inline it like this:

   .post(cfg.getDiscoveryConfigUrl(clusterId), {
      name: req.name,
      discoveryGroup: req.discoveryGroup,
      aws: makeAwsMatchersReq(req.aws),
    })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@AntonAM
Copy link
Copy Markdown
Contributor Author

AntonAM commented Feb 23, 2024

@kimlisa I changed the toggles to be stacked on top of each other, will ask Kenny later.

@AntonAM AntonAM force-pushed the anton/eks-auto-discover-ui branch from 9b6b1e8 to ad5ab58 Compare February 23, 2024 21:14
@AntonAM
Copy link
Copy Markdown
Contributor Author

AntonAM commented Feb 27, 2024

@kimlisa @gzdunek I've addressed all feedback, PTAL

@AntonAM AntonAM requested review from gzdunek and kimlisa February 27, 2024 03:15
Comment thread web/packages/teleport/src/Discover/Shared/AutoDiscovery/AutoEnrollDialog.tsx Outdated
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from ryanclark February 28, 2024 02:33
@AntonAM AntonAM force-pushed the anton/eks-auto-enrollment branch from 736bd91 to fff35c4 Compare February 28, 2024 15:38
@AntonAM AntonAM force-pushed the anton/eks-auto-discover-ui branch from 1c5e0ff to 3cf8e63 Compare February 28, 2024 15:57
@AntonAM AntonAM force-pushed the anton/eks-auto-enrollment branch from a682f97 to 960584e Compare February 28, 2024 20:35
@AntonAM AntonAM force-pushed the anton/eks-auto-discover-ui branch from 3cf8e63 to 3b16910 Compare February 28, 2024 21:01
Base automatically changed from anton/eks-auto-enrollment to master February 29, 2024 00:29
@AntonAM AntonAM force-pushed the anton/eks-auto-discover-ui branch from 3b16910 to 79d30b4 Compare February 29, 2024 00:35
@AntonAM AntonAM enabled auto-merge February 29, 2024 00:43
@AntonAM AntonAM added this pull request to the merge queue Feb 29, 2024
Merged via the queue into master with commit ccb084c Feb 29, 2024
@AntonAM AntonAM deleted the anton/eks-auto-discover-ui branch February 29, 2024 00:56
@public-teleport-github-review-bot
Copy link
Copy Markdown

@AntonAM See the table below for backport results.

Branch Result
branch/v15 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants