Skip to content

Commit

Permalink
feat: add nodeclass tag validation during instance create (#7390)
Browse files Browse the repository at this point in the history
  • Loading branch information
rschalo authored Nov 15, 2024
1 parent 42b6da5 commit adb9f72
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
stderrors "errors"
"fmt"
"strings"
"time"

ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit adb9f72

Please sign in to comment.