From adb9f72a20be69c30b4114c13d4cf18066c0796f Mon Sep 17 00:00:00 2001 From: Reed Schalo Date: Fri, 15 Nov 2024 12:06:31 -0800 Subject: [PATCH] feat: add nodeclass tag validation during instance create (#7390) --- pkg/cloudprovider/cloudprovider.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/cloudprovider.go b/pkg/cloudprovider/cloudprovider.go index d03be9193d07..9c02442ccbbd 100644 --- a/pkg/cloudprovider/cloudprovider.go +++ b/pkg/cloudprovider/cloudprovider.go @@ -18,6 +18,7 @@ import ( "context" stderrors "errors" "fmt" + "strings" "time" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" @@ -240,7 +241,9 @@ func getTags(ctx context.Context, nodeClass *v1.EC2NodeClass, nodeClaim *karpv1. v1.EKSClusterNameTagKey: options.FromContext(ctx).ClusterName, v1.LabelNodeClass: nodeClass.Name, } - return lo.Assign(nodeClass.Spec.Tags, staticTags) + return lo.Assign(lo.OmitBy(nodeClass.Spec.Tags, func(key string, _ string) bool { + return strings.HasPrefix(key, "kubernetes.io/cluster/") + }), staticTags) } func (c *CloudProvider) resolveNodeClassFromNodeClaim(ctx context.Context, nodeClaim *karpv1.NodeClaim) (*v1.EC2NodeClass, error) {