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

Support e2e test EFS create on EKS clusters by finding EKS node subnets #707

Merged
merged 5 commits into from
Jun 14, 2022

Conversation

wongma7
Copy link
Contributor

@wongma7 wongma7 commented Jun 8, 2022

Is this a bug fix or adding new feature? /bug

What is this PR about? / Why do we need it? The e2e test can run against an EKS cluster if an EFS file system is provided (i.e., --create-file-system=false). However, if an EFS file system is not provided then the e2e test EFS create fails because it fails to find EKS node subnets which are needed for creating EFS mount targets.

I don't know of a tag that is guaranteed to exist on ALL EKS clusters so I am trying


				Name: aws.String("tag:Name"),
				Values: []*string{
					aws.String(fmt.Sprintf("*%s*", clusterName)),
				},

eksctl does tag clusters with alpha.eksctl.io/cluster-name but not all EKS clusters are created by eksctl

What testing is done?

  • local test TEST_ID=1 CLEAN=false make test-e2e CLUSTER_TYPE=eksctl \ K8S_VERSION="1.20" \ DRIVER_NAME=aws-efs-csi-driver \ HELM_VALUES_FILE="./hack/values_eksctl.yaml" \ CONTAINER_NAME=efs-plugin \ TEST_EXTRA_FLAGS='--cluster-name=$CLUSTER_NAME' \ AWS_REGION=us-west-2 \ AWS_AVAILABILITY_ZONES=us-west-2a,us-west-2b,us-west-2c \ TEST_PATH=./test/e2e/... \ GINKGO_FOCUS="\[efs-csi\]" \ ./hack/e2e/run.sh
  • CI test EKS (trick CI into executing EKS by modifying Make rule)
  • CI test Kops (make sure my refactoring didn't break anything)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 8, 2022
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 8, 2022
@@ -26,9 +26,9 @@ ADD . .
ARG client_source=k8s
ENV EFS_CLIENT_SOURCE=$client_source

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make aws-efs-csi-driver
RUN OS=${TARGETOS} ARCH=${TARGETARCH} make $TARGETOS/$TARGETARCH
Copy link
Contributor

Choose a reason for hiding this comment

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

curious the purpose of the change on make here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i wanted to make it more consistent with fsx and ebs Makefiles so I copied this pattern from there. Specifically I need the make image rule for the e2e test to work beacuse the e2e test needs to build/push an image to a per-test tag and the current rule was pushing it to hardcoded master tag which is not usable since multijple tests could be running in parallel.

As for why ebs and fsx are this in the first place, it's because ebs must build for windows so I made a bunch of changes to its Makefile to use these generic OS/ARCH env variables. That comes at cost of readability/simplicity since for efs we only care about arm/x64... so I am open to simplifying the Makefile but probably not in the near future 😅

.PHONY: all-push
all-push:
docker buildx build \
--no-cache-filter=linux-amazon \
Copy link
Contributor

Choose a reason for hiding this comment

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

nice to build the no cache! would this be helpful on avoiding unnecessary image cache triggered CVEs?

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, this is to avoid case where somehow you have cache with older yum packages

Copy link
Contributor

Choose a reason for hiding this comment

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

nice, I will give it a build and push to my dev account to see this can help sort out most of our CVE mitigation

@@ -68,6 +71,7 @@ function eksctl_create_cluster() {

if [[ "$WINDOWS" == true ]]; then
${BIN} create nodegroup \
--managed=false \
Copy link
Contributor

@Ashley-wenyizha Ashley-wenyizha Jun 9, 2022

Choose a reason for hiding this comment

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

reading this flag description, do we change it to false because this is test nodegroups and we do not want to make it show up from the console?

setting --managed=false or using the nodeGroups field creates an unmanaged nodegroup. 
Bear in mind that unmanaged nodegroups do not appear in the EKS console, which as a general rule only knows about EKS-managed nodegroups.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's because "Windows is only supported for self-managed (--managed=false flag) nodegroups." (note this is in the WINDOWS clause) . https://eksctl.io/usage/windows-worker-nodes/ . I will add a comment in a follow-up PR for hack/e2e changes

Copy link

@wangnyue wangnyue left a comment

Choose a reason for hiding this comment

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

LGTM

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wangnyue, 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

@wangnyue
Copy link

/lgtm

@k8s-ci-robot
Copy link
Contributor

@wangnyue: changing LGTM is restricted to collaborators

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

{
Name: aws.String("tag:Name"),
Values: []*string{
aws.String(fmt.Sprintf("*%s*", clusterName)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Are all the eks clusters created with eksctl?

Copy link
Contributor

Choose a reason for hiding this comment

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

Another problem is that you may get more subnets than expected. In the event that you have cluster1 and cluster10, you will get additional subnets when looking for those that belong to cluster1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in GitHub CI, yes.

however I made this more generic because I also have clusters created with other tools/scripts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated:

first, call getEksctlSubnetIds. eksctl gives us reliable way to find the subnets "tag:alpha.eksctl.io/cluster-name"

second, call getEksCloudFormationSubnetIds. this is necessarily very generic since the name could be anything but for now i narrowed it to "%s-*", clusterName because that's how I name mine

@Ashley-wenyizha
Copy link
Contributor

/lgtm

@k8s-ci-robot
Copy link
Contributor

@Ashley-wenyizha: changing LGTM is restricted to collaborators

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nckturner
Copy link
Contributor

/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 14, 2022
@k8s-ci-robot k8s-ci-robot merged commit f2597bb into kubernetes-sigs:master Jun 14, 2022
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.

5 participants