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

Allow users to override Name tag in autoscaling group #859

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zeevallin
Copy link

Proposed changes

Currently you get confilcts every time you update the cluster through Pulumi if you've provided a Name tag using the AutoScaling group tags. This fix will allow you to override the Name tag to ensure you can control the name of the nodes.

Related issues (optional)

None (as far as I can tell)

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests. This PR will only perform build and linting.
Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

@thomas11
Copy link
Contributor

thomas11 commented Mar 7, 2023

/run-acceptance-tests

@github-actions
Copy link

github-actions bot commented Mar 7, 2023

Please view the PR build - https://github.com/pulumi/pulumi-eks/actions/runs/4359280434

Comment on lines -849 to -851
Name: `${clusterName}-worker`,
[`kubernetes.io/cluster/${clusterName}`]: "owned",
...asgTags,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spread in the original implementation is after the explicit name - and therefore if a Name exists in asgTags it should overwrite the Name specified before the spread.

Do you have example code which demonstrates the issue you're seeing with the custom name not being applied?

Copy link
Member

@danielrbradley danielrbradley Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick test run:

const clusterName = "test-cluster"
const asgTags = {
  Name: "overriden-name"
}
const result = {
  Name: `${clusterName}-worker`,
  [`kubernetes.io/cluster/${clusterName}`]: "owned",
  ...asgTags
};

console.log(result);

prints:

{
  kubernetes.io/cluster/test-cluster: "owned",
  Name: "overriden-name"
}

https://jsfiddle.net/5mgwru8t/

Copy link
Author

@zeevallin zeevallin Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it stands now it works to set your own name with the tag, that's not the issue. But everytime you re-run the command you get a diff on tags since the value fetched from AWS does not contain the Name: {clusterName}-worker value.

There might be a difference between your example and how it works when evaluating it the way it's done in the code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens every time you run preview or up but you've provided your own name tag.

                ~ aws:autoscaling/group:Group: (update)
                    [id=k8s-core]
                    [urn=urn:pulumi:dev.eu-central-1::k8s::eks:index:Cluster$aws:iam/instanceProfile:InstanceProfile$eks:index:NodeGroupV2$aws:autoscaling/group:Group::k8s-core]
                    [provider=urn:pulumi:dev.eu-central-1::k8s::pulumi:providers:aws::default_5_16_2::5f73b234-f1c8-489b-8de0-2c66cf783459]
                  ~ launchTemplate: {
                      ~ version: "18" => output<string>
                    }
                  ~ tags          : [
                      + [9]: {
                              + key              : "Name"
                              + propagateAtLaunch: true
                              + value            : "k8s-worker"
                            }
                    ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants