Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check more indicators for EKS discovery #2615

Merged
merged 1 commit into from
May 4, 2023

Conversation

tmjd
Copy link
Member

@tmjd tmjd commented May 1, 2023

Description

We have found in testing that the provider is not being detected as EKS in setups that were detected as EKS before. Upon looking at our detection/discovery code and looking at some EKS clusters, there was and still isn't a great means of detecting an EKS cluster. This PR expands the detection a bit to include a couple more indicators.

For PR author

  • Tests for change.
    • I've also manually tested the discovery in a couple EKS clusters

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

@tmjd tmjd added the kind/enhancement New feature or request label May 1, 2023
@tmjd tmjd requested a review from a team as a code owner May 1, 2023 19:19
@marvin-tigera marvin-tigera added this to the v1.30.0 milestone May 1, 2023
Copy link
Member

@ozdanborne ozdanborne left a comment

Choose a reason for hiding this comment

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

1 optional suggestion but lgtm

return false, err
}
if cm != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I see you're just copying this logic from the existing code so that's fine but it looks odd to me because presence of this configmap is indicated by err being IsNotFound. I don't think cm being nil is behavior that's meant to be relied on for anything.

Fine to merge as is or take a crack at refactoring, either is ok to me

if err != nil {
if kerrors.IsNotFound(err) {
return false, nil
_, err := c.CoreV1().ConfigMaps("kube-system").Get(ctx, "aws-auth", metav1.GetOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice for future readers to add some comments to this code explaining what we're checking. I'm not sure what "aws-auth" is, so it's hard to review whether or not this is an appropriate way to determine if we're running on EKS (e.g., as opposed to other AWS based Kubernetes providers).

Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

One comment - basically, I think we should document what this code is trying to do with comments a bit better. Maybe with a link to details on what "aws-auth", "eks-certificates-controller" are.

@tmjd
Copy link
Member Author

tmjd commented May 3, 2023

I've put some comments in. Unfortunately eks-certificates-controller and the kube-dns label are not something I found any specific documentation about them.

@tmjd tmjd merged commit cef1611 into tigera:master May 4, 2023
@tmjd tmjd deleted the expand-eks-discovery branch May 4, 2023 18:28
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.

4 participants