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

Destroy AWS EFS volumes #5092

Merged
merged 2 commits into from Jul 23, 2021

Conversation

jsafrane
Copy link
Contributor

@jsafrane jsafrane commented Jul 20, 2021

Destroy AWS EFS volumes that have owner tag when destroying a cluster. Recursively destroy all access points and mount targets used by the volume, even when they are not tagged, otherwise EFS cannot be deleted. Not sure what's common practice for recursive deletion on cluster destroy - access points could be tagged (and thus we may require users to tag them), but mount targets do not have any tags.

AWS EFS CSI driver is an optional OCP component (installed via OLM). Right now, an EFS must be created manually by user. Since VPC and subnets cannot be deleted if they are used by an EFS volume, allow user to tag the EFS volume so cluster destruction deletes EFS, VPC + subnets (with two iterations to get the ordering right...)

KEP for whole AWS EFS support: openshift/enhancements#687

Destroy AWS EFS volumes that have owner tag when destroying a cluster.
Destroy all access points and mount targets used by the volume, even when
they are not tagged.

AWS EFS CSI driver is an optional OCP component (installed via OLM). Right
now, an EFS must be created manually by user.

Since VPC and subnets cannot be deleted if they are used by an EFS volume,
allow user to tag the EFS volume so cluster destruction deletes EFS and
thus allows deletion of VPC + subnets.
@patrickdillon
Copy link
Contributor

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 21, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: patrickdillon

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 21, 2021
Copy link
Contributor

@jstuever jstuever left a comment

Choose a reason for hiding this comment

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

A few questions regarding how errors are handled when resources were previously deleted. It's important that we handle these properly as the destroy is ran in a loop and some resources are deleted between loops, etc.


_, err = client.DeleteFileSystemWithContext(ctx, &efs.DeleteFileSystemInput{FileSystemId: aws.String(fsid)})
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a case here where the error is that the file system doesn't exist (as it may have been previously deleted)? If you look elsewhere in the code, we handle this differently from other errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed everywhere

pkg/destroy/aws/aws.go Show resolved Hide resolved
pkg/destroy/aws/aws.go Show resolved Hide resolved
@jstuever jstuever self-assigned this Jul 21, 2021
@jsafrane
Copy link
Contributor Author

jsafrane commented Jul 22, 2021

I added checks for various NotFound errors and tested in a real cluster (with some hacks around to use invalid IDs)

@patrickdillon
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2021
@jsafrane
Copy link
Contributor Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 23, 2021

@jsafrane: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-openstack-kuryr 62ec122 link /test e2e-openstack-kuryr
ci/prow/e2e-crc 62ec122 link /test e2e-crc
ci/prow/e2e-aws-workers-rhel7 62ec122 link /test e2e-aws-workers-rhel7
ci/prow/e2e-aws-single-node 62ec122 link /test e2e-aws-single-node
ci/prow/e2e-metal-ipi-ovn-ipv6 62ec122 link /test e2e-metal-ipi-ovn-ipv6

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 9f81548 into openshift:master Jul 23, 2021
wking added a commit to wking/openshift-release that referenced this pull request Jan 6, 2022
Like part of 4d66658 (Use 4.8 cli/installer in CI-related content,
2021-04-19, openshift#17834).  Among other fixes, this should pull in deletion
of AWS EFS volumes [1], which is occasionally causing leaked resources
like [2]:

  $ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/logs/periodic-ipi-deprovision-aws/1478982622368501760/artifacts/deprovision/ci-ln-lwnyy5b-/.openshift_install.log | tail -6
  time="2022-01-06T07:52:51Z" level=debug msg="unrecognized ARN service elasticfilesystem (arn:aws:elasticfilesystem:us-west-2:460538899914:access-point/fsap-012a52e782c7ed0ac)" arn="arn:aws:elasticfilesystem:us-west-2:460538899914:access-point/fsap-012a52e782c7ed0ac"
  time="2022-01-06T07:52:51Z" level=debug msg="DependencyViolation: The subnet 'subnet-02146773c4035ad4e' has dependencies and cannot be deleted.\n\tstatus code: 400, request id: 3c014d42-3538-4422-86f5-d6d740e15669" arn="arn:aws:ec2:us-west-2:460538899914:subnet/subnet-02146773c4035ad4e"
  time="2022-01-06T07:52:51Z" level=debug msg="search for matching resources by tag in us-west-2 matching aws.Filter{\"kubernetes.io/cluster/ci-ln-lwnyy5b-76ef8-mr89d\":\"owned\"}"
  time="2022-01-06T07:52:52Z" level=debug msg="search for IAM roles"
  time="2022-01-06T07:52:52Z" level=debug msg="search for IAM users"
  time="2022-01-06T07:52:52Z" level=debug msg="search for IAM instance profiles"

[1]: openshift/installer#5092
[2]: https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/periodic-ipi-deprovision-aws/1478982622368501760
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants