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

New vpc/subnet tag feature from #1170 clobbers existing tags when adopting existing resources #1236

Closed
jlee-idbydna opened this issue Mar 29, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@jlee-idbydna
Copy link

What happened?

In PR #1170,
adoption of existing VPC or Subnets via external-name annotation will clobber existing tags. This is especially problematic when adopting resources with aws: prefixed tags, such as EKSCTL created VPCs/Subnets.

I expect this behavior to be optional as stated in the PR. Currently there does not appear to be a simple way to bypass this behavior.

How can we reproduce it?

Adopt any existing VPC or Subnet with pre-existing tags, via external-name annotation.

What environment did it happen in?

Crossplane version: 1.7.0
provider-aws version: 0.25.0
EKS/Kubernetes: 1.21
OS: Amazon Linux 2

@jlee-idbydna jlee-idbydna added the bug Something isn't working label Mar 29, 2022
@haarchri
Copy link
Member

haarchri commented May 8, 2022

can you add the tags in the manifest definition before importing the resource ?

@jlee-idbydna
Copy link
Author

can you add the tags in the manifest definition before importing the resource ?

That is a possible workaround, although somewhat unreasonable with dynamically generated tags for resources provisioned with tools such as EKSCTL. It seems to me the fix is quite simple: to optionally allow a merge instead of an override strategy for tags.

@dlydiard
Copy link

dlydiard commented Nov 17, 2022

This is an issue if importing resources managed by another tool (such as Terraform). The auto-generated Terraform tags are clobbered by crossplane. Duplicating the tags is the manifest is also not a desired option as it forces to duplicate tags that were auto-generated from another tool. Crossplane should leave existing tags untouched and merge in the Crossplane related tags.

In addition, importing AWS subnets that have kubernetes.io/cluster/* tags using Subnet, when using EKS and OpenShift (ROSA) clusters will break networking for kube clusters running on AWS if those tags are removed.

@github-actions
Copy link

Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

@github-actions github-actions bot added the stale label Aug 28, 2023
@dlydiard
Copy link

We have a temporary workaround by denying crossplane access to create/delete VPC subnet tags.

        {
            "Effect": "Deny",
            "Action": [
                "ec2:DeleteTags",
                "ec2:CreateTags"
            ],
            "Resource": [
                "arn:aws:ec2:*:*:vpc/*",
                "arn:aws:ec2:*:*:subnet/*"
            ]
        }

The AWS provider seems to be working (importing the resource) even though it can't tag the resource.

@github-actions github-actions bot removed the stale label Aug 30, 2023
@MisterMX
Copy link
Collaborator

MisterMX commented Sep 4, 2023

The general design idea in Crossplane is to have the managed resources as the single source of truth. Unless there are very specific technical reasons to merge external changes with MR settings, the controller should always overwrite settings in the external resource if they are different from the MR.

Preventing tag updates by denying access to the tagging API is not recommended since it leads to reconcile failures and will constantly trigger a rescheduling of that resource.

I am going to close this as this behaviour is by design. The best approach to this issue is to copy the auto-generated tags from the external resource and add them to the MR manually.

@MisterMX MisterMX closed this as completed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants