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

Amazon.CDK.AWS.EKS.Cluster does not apply stack tags while sub-resources do #26617

Closed
icelava opened this issue Aug 3, 2023 · 3 comments
Closed
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@icelava
Copy link

icelava commented Aug 3, 2023

Describe the bug

We have an L3 construct that deploys an EKS cluster with add-ons and node groups.

this.Cluster = new Cluster(this, this._clusterName, new ClusterProps
{
	ClusterName = this._clusterName,
	Version = KubernetesVersion.V1_26,
	Vpc = this._props.Vpc,
	VpcSubnets = this._props.DeploymentSubnets.ToArray(),
	Role = this._clusterRole,
	EndpointAccess = EndpointAccess.PRIVATE,
	KubectlLayer = new KubectlV26Layer(this, $"{this._props.ProductName}-kubectllayer-{this._props.Environment}"),
	DefaultCapacity = 0,
	AlbController = new AlbControllerOptions
	{
		Version = AlbControllerVersion.V2_4_1
	},
	MastersRole = this._props.MastersRole

});

Tags are applied at the Stack level, thus propagating to all resources.

public static void ApplyTags(Stack stack, Dictionary<string, string> stackTags)
{
	if (stackTags == null ||
		stackTags.Count < 1) return;

	foreach (var tag in stackTags)
	{
		Amazon.CDK.Tags.Of(stack).Add(tag.Key, tag.Value);
	}
}

Other stack resources get the tags except the EKS cluster. The sub-resources of the cluster like the node groups do get tagged, although the actual node instances don't get them either.

Expected Behavior

EKS cluster and nodes should be tagged accordingly to stack tags.

Current Behavior

EKS cluster and nodes don't get tagged.

Reproduction Steps

Apply tags at Stack level instead of individual construct as per above code example.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.88.0

Framework Version

.NET 6.0

Node.js Version

18.9.0

OS

Windows 10

Language

.NET

Language Version

C# 10

Other information

No response

@icelava icelava added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 3, 2023
@github-actions github-actions bot added the @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service label Aug 3, 2023
@peterwoodworth
Copy link
Contributor

Since our EKS L2s use Custom resources under the hood, aspects like this won't work because the resources aren't defined in the template. You can use the tags prop instead

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Aug 3, 2023
@github-actions
Copy link

github-actions bot commented Aug 5, 2023

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Aug 5, 2023
@icelava
Copy link
Author

icelava commented Aug 16, 2023

What about nodes in the node groups?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants