Skip to content

✨ eks: skip aws:-prefixed tags in nodegroup reconciliation#5965

Open
cPu1 wants to merge 1 commit into
kubernetes-sigs:mainfrom
cPu1:feat/nodegroup-reserved-tags
Open

✨ eks: skip aws:-prefixed tags in nodegroup reconciliation#5965
cPu1 wants to merge 1 commit into
kubernetes-sigs:mainfrom
cPu1:feat/nodegroup-reserved-tags

Conversation

@cPu1

@cPu1 cPu1 commented Apr 21, 2026

Copy link
Copy Markdown

What type of PR is this?

/kind feature

What this PR does / why we need it:

When reconciling tags for EKS managed nodegroups and Fargate profiles, ignore aws:-prefixed keys when building the list of keys to remove, using the same reserved-prefix logic as pkg/cloud/tags for tag application.

Those tags are not part of CAPA’s desired tag map since the validating webhooks forbid them in additionalTags, but they can exist on nodegroups created outside of CAPA (e.g., via CloudFormation). Including them in UntagResource triggers an API validation error, failing reconciliation and adoption of pre-existing nodegroups.

Additionally, this changelist also replaces manual copying of variables (kCopy/vCopy) with ptr.To() so the loop-variable aliasing workaround is not required.

This has been tested on an eksctl-provisioned cluster which creates nodegroups using CloudFormation. The AWS-reserved tags on the nodegroup (aws:cloudformation:stack-name, aws:cloudformation:logical-id and aws:cloudformation:stack-id) were correctly skipped and reconciliation passed.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #5964

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • includes AI generated content
  • includes emoji in title
  • adds unit tests
  • adds or updates e2e tests

Release note:

EKS: Skip aws:-prefixed tag keys when reconciling managed nodegroup and Fargate profile tags so `UntagResource` is not called for AWS-reserved keys.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 21, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign neolit123 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @cPu1!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-aws 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-aws has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot requested review from fiunchinho and nrb April 21, 2026 13:53
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @cPu1. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 21, 2026
@cPu1 cPu1 changed the title eks: skip aws:-prefixed tags in nodegroup reconciliation ✨ eks: skip aws:-prefixed tags in nodegroup reconciliation Apr 21, 2026
@cPu1 cPu1 force-pushed the feat/nodegroup-reserved-tags branch from 022ff1b to 101f50a Compare April 21, 2026 13:58
When reconciling tags for EKS managed nodegroups and Fargate profiles, ignore `aws:`-prefixed keys when building the list of keys to remove, using the same reserved-prefix logic as `pkg/cloud/tags` for tag application.

Those tags are not part of CAPA’s desired tag map since the validating webhooks forbid them in `additionalTags`, but they can exist on nodegroups created outside of CAPA (e.g., via CloudFormation). Including them in `UntagResource` triggers an API validation error, failing reconciliation and adoption of pre-existing nodegroups.

Additionally, this changelist also replaces manual copying of variables (`kCopy`/`vCopy`) with `ptr.To()` so the loop-variable aliasing workaround is not required.

This has been tested on an eksctl-provisioned cluster which creates nodegroups using CloudFormation. The AWS-reserved tags on the nodegroup (`aws:cloudformation:stack-name`, `aws:cloudformation:logical-id` and `aws:cloudformation:stack-id`) were correctly skipped and reconciliation passed.

Signed-off-by: cpu1 <patwal.chetan@gmail.com>
@cPu1 cPu1 force-pushed the feat/nodegroup-reserved-tags branch from 101f50a to b2e0926 Compare April 21, 2026 14:00
@nrb

nrb commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 24, 2026
@cPu1

cPu1 commented Apr 27, 2026

Copy link
Copy Markdown
Author

@nrb tests are passing. Can you review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nodegroup reconciliation untags aws:-prefixed keys for externally created nodegroups

3 participants