kubernetes-sigs / cluster-api-provider-aws

Kubernetes Cluster API Provider AWS provides consistent deployment and day 2 operations of "self-managed" and EKS Kubernetes clusters on AWS.
http://cluster-api-aws.sigs.k8s.io/
Apache License 2.0
636 stars 561 forks source link

Subnet tags of AWS Cluster don't get removed when cluster is deleted #3947

Closed vishu2498 closed 8 months ago

vishu2498 commented 1 year ago

/kind bug

What steps did you take and what happened:

  1. Create a AWS cluster (unmanaged) from cluster API which would use an already present VPC and subnet. (at this point, the subnets will now have the tags of the newly created cluster)
  2. Delete the cluster.
  3. After deletion of cluster, the subnet tags of the new cluster didn't get removed.
  4. If user manually deletes that tag, then on restart of controller-manager deployment, the tags again get re-added.

What did you expect to happen:

  1. Tags of new cluster should get deleted from subnet once cluster gets deleted.
  2. These tags shouldn't get re-added on restart of controller-manager deployment.

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

k8s-ci-robot commented 1 year ago

@vishu2498: This issue is currently awaiting triage.

If CAPA/CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
Ankitasw commented 1 year ago

@vishu2498 if you could reproduce this again, could you please let me know the list of tags that gets applied to your subnets?

wyike commented 1 year ago

I am curious about why "If user manually deletes that tag, then on restart of controller-manager deployment, the tags again get re-added" even after cluster has been removed ? Hi @Ankitasw Do you know the reason?

Ankitasw commented 1 year ago

I am curious about why "If user manually deletes that tag, then on restart of controller-manager deployment, the tags again get re-added" even after cluster has been removed ? Hi @Ankitasw Do you know the reason?

We dont have tag deletion in place for subnet tags while delete reconciliation, which is causing this issue. If you use BYO subnet, that subnet would get tagged again and again every time you use that subnet in your new cluster. So thats why we have decided to go ahead with the proposal described on parent issue.

wyike commented 1 year ago

Indeed, even the clusters deleted, their names are re-tagged to the shared subnet when capa reconciles the managed cluster which owns the subnet for any reason (for example restarting capa).

Add a note for myself: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/pkg/cloud/services/network/subnets.go#L51 (get existing tags from awscluster spec instead of aws service in real time) https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/pkg/cloud/services/network/subnets.go#L509 (re-tag all existing tags to the shared subnet when reconciling the managed cluster).

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 8 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 8 months ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/3947#issuecomment-1900388703): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.