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

feat(eks): kubernetes resource pruning #11932

Merged
merged 8 commits into from
Dec 10, 2020
Merged

feat(eks): kubernetes resource pruning #11932

merged 8 commits into from
Dec 10, 2020

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Dec 8, 2020

In order to support deletion of kubernetes manifest resources, the EKS module now automatically allocates and injects a "prune label" to all resources. This label is then passed down to kubectl apply with the --prune option so that any resources in the cluster that do not appear in the manifest will get deleted.

The prune option can be set to false (either at the Cluster level or at the KubernetesResource level) to disable this.

In order to avoid needing to update all tests, many of the existing tests set prune: false so that their outputs are not impacted.

Resolves #10495


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

In order to support deletion of kubernetes manifest resources, the EKS module now automatically allocates and injects a "prune label" to all resources. This label is then passed down to `kubectl apply` with the `--prune` option so that any resources in the cluster that do not appear in the manifest will get deleted.

The `prune` option can be set to `false` (either at the `Cluster` level or at the KubernetesResource level) to disable this.

In order to avoid needing to update all tests, many of the existing tests set `prune: false` so that their outputs are not impacted.

Resolves #10495
@gitpod-io
Copy link

gitpod-io bot commented Dec 8, 2020

@eladb eladb requested a review from iliapolo December 8, 2020 09:42
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Dec 8, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Dec 8, 2020
@eladb
Copy link
Contributor Author

eladb commented Dec 8, 2020

From the kubectl logs:

Running command: ['kubectl', 'apply', '--kubeconfig', '/tmp/kubeconfig', '-f', '/tmp/manifest.yaml', '--prune', '-l', 'aws.cdk.eks/prune-c8f0f7140f7358e29b7f58e81b507dcf744a3908f4']
b'deployment.apps/hello-kubernetes unchanged\nservice/hello-kubernetes pruned\n'

@mergify
Copy link
Contributor

mergify bot commented Dec 10, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Dec 10, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 1fdd549 into master Dec 10, 2020
@mergify mergify bot deleted the benisrae/eks-prune branch December 10, 2020 12:56
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: fa13592
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

flochaz pushed a commit to flochaz/aws-cdk that referenced this pull request Jan 5, 2021
In order to support deletion of kubernetes manifest resources, the EKS module now automatically allocates and injects a "prune label" to all resources. This label is then passed down to `kubectl apply` with the `--prune` option so that any resources in the cluster that do not appear in the manifest will get deleted.

The `prune` option can be set to `false` (either at the `Cluster` level or at the KubernetesResource level) to disable this.

In order to avoid needing to update all tests, many of the existing tests set `prune: false` so that their outputs are not impacted.

Resolves aws#10495

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[aws-eks] Support object pruning
4 participants