-
Notifications
You must be signed in to change notification settings - Fork 570
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
AWSMachine controller leaks EC2 instances when specifying a Name tag in additionalTags
#4629
Comments
This issue is currently awaiting triage. If CAPA/CAPI contributors determines this is a relevant issue, they will accept it by applying the The 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. |
As for why cluster-api-provider-aws/pkg/cloud/services/ec2/instances.go Lines 272 to 281 in abd444c
findInstance needing to fallback to tag-based detection
|
I am surprised the AWSMachine controller uses |
@celebdor: Re-titling can only be requested by trusted users, like repository collaborators. In response to this:
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. |
sorry for the noise |
From today's office hours: I wonder if can address this once and for all by using the client token strategy described in https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html |
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 |
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 |
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-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
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-sigs/prow repository. |
/kind bug
What steps did you take and what happened:
After applying two
infrastructure.cluster.x-k8s.io/v1beta2
AWSMachines with the following additionalTags:124 EC2 instances were created in quick succession for these AWSMachines before
.spec.providerID
was populated. All of the EC2 instances (leaked and not-leaked) do have the tagsName: sample-name-tag
What did you expect to happen:
One EC2 instance to be created per AWSMachine, with the tag
Name: sample-name-tag
Anything else you would like to add:
I think this occurs because:
cluster-api-provider-aws/controllers/awsmachine_controller.go
Lines 483 to 489 in 56c9a39
cluster-api-provider-aws/pkg/cloud/services/ec2/instances.go
Lines 46 to 53 in abd444c
instance == nil
, then a new EC2 instance is created https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/56c9a39dd834640ee4a027e679ad2a5757098dfd/controllers/awsmachine_controller.go#L517C29-L522Name
tag: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/api/v1beta2/tags.go#L244-L264vs v1beta1
cluster-api-provider-aws/api/v1beta1/tags.go
Lines 250 to 269 in abd444c
.metadata.name
had precedenceSo I think we need to either not allow overwriting the
Name
tag or we need to be smarter about how we find the instance based off of tags. Even if we update the filtering logic to account for the additional Name tag, we don't want to find an instance that's already been claimed by another AWSMachine.Environment:
kubectl version
):/etc/os-release
):The text was updated successfully, but these errors were encountered: