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

Grant EKSCTL_ADMIN_ROLE admin access to eksctl clusters #933

Merged
merged 3 commits into from
Jun 17, 2021

Conversation

wongma7
Copy link
Contributor

@wongma7 wongma7 commented Jun 11, 2021

Is this a bug fix or adding new feature?

What is this PR about? / Why do we need it? this is part of the effort to get eksctl test CI in every PR.

To get Kubernetes API access to an EKS cluster you need to either be a) cluster creator or b) added to the aws-auth ConfigMap. Of course if you do not have Kubernetes API access in the first place then you can't edit the configmap, so the cluster creator has to do some bootstrapping. This PR enables the cluster creator to bootstrap one additional EKSCTL_ADMIN_ROLE with admin access to the cluster.

By contrast, with kops, if you have AWS API access to the kops cluster config in S3, then you can give yourself Kubernetes API access.

So why do we need one extra admin besides the cluster creator in the first place...I don't want to divulge too much pointless implementation detail about how the CI works but basically, the scripts are being run by an IAM entity in this account: https://github.com/kubernetes/test-infra/blob/master/config/jobs/kubernetes/sig-cloud-provider/aws/sig-aws-credentials.yaml#L17. The cluster creator will be that IAM entity. In case we need to access EKS clusters' Kubernetes API, we don't want to reuse that entity's creds. Better to at cluster-creation time grant a different, dedicated role the permission to access Kubernetes API via EKSCTL_ADMIN_ROLE.

What testing is done? will run eks test

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 11, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wongma7

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 11, 2021
@wongma7
Copy link
Contributor Author

wongma7 commented Jun 11, 2021

/test pull-aws-ebs-csi-driver-external-test-eks

@coveralls
Copy link

coveralls commented Jun 11, 2021

Coverage Status

Coverage remained the same at 79.578% when pulling 9098337 on wongma7:eksctldeleter into 54f1649 on kubernetes-sigs:master.

@wongma7
Copy link
Contributor Author

wongma7 commented Jun 14, 2021

Error: arn: invalid prefix

@wongma7
Copy link
Contributor Author

wongma7 commented Jun 14, 2021

/test pull-aws-ebs-csi-driver-external-test-eks

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 14, 2021
@wongma7
Copy link
Contributor Author

wongma7 commented Jun 14, 2021

2nd commit contains changes backported from fsx edition of scripts https://github.com/kubernetes-sigs/aws-fsx-csi-driver/commits/master/hack/e2e

function kops_patch_cluster_file() {
CLUSTER_FILE=${1} # input must be json
CLUSTER_FILE=${1} # input must be yaml

Choose a reason for hiding this comment

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

This is a function I'd like to see done in something other than bash. Good candidate for moving reusable parts of this to the test-infra repository? (Not PR blocking, but something we can consider for the future).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, see the comment.

I know I have gone back and forth on this a lot, I decided we should use Go. You can see here https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/927/files#diff-1174eb3051f9c1a9e1f65c760347ef47446d5b93c712925b446b29ff591184e8R36 I'm trying it out and it's fine.


loudecho "Patching cluster $CLUSTER_NAME with $KOPS_PATCH_FILE"

# Temporary intermediate files for patching
# Temporary intermediate files for patching, don't mutate CLUSTER_FILE until

Choose a reason for hiding this comment

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

Does this create the cluster.yaml file before the test? Is this something we can use KOPS_FEATURE_FLAGS="SpecOverrideFlag" for? Also, are these changes in kops.sh necessary for this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cluster.yaml gets created by the dry run create somewhere else. if it already exists, the pathcing won't hapepn.

No these changes aren't necessary, I just wanted to piggyback the changes from fsx repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to be clear the pr desription is only relevant for first commit.

commit 2 and 3 are snuck in

Choose a reason for hiding this comment

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

Ok, might want to break it up or update the PR description.

@nckturner
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 17, 2021
@k8s-ci-robot k8s-ci-robot merged commit 6135f47 into kubernetes-sigs:master Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants