From d98492f371854f51e3b239c9f84d4d2d2912a5ef Mon Sep 17 00:00:00 2001 From: Jonathan Innis Date: Mon, 25 Nov 2024 23:14:53 -0800 Subject: [PATCH] chore: Move the launch template name prefix into api labels (#7442) --- pkg/apis/v1/labels.go | 11 ++++++----- pkg/providers/launchtemplate/launchtemplate.go | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/apis/v1/labels.go b/pkg/apis/v1/labels.go index a6f45815b50e..7090f623c9ab 100644 --- a/pkg/apis/v1/labels.go +++ b/pkg/apis/v1/labels.go @@ -126,9 +126,10 @@ var ( AnnotationEC2NodeClassHashVersion = apis.Group + "/ec2nodeclass-hash-version" AnnotationInstanceTagged = apis.Group + "/tagged" - NodeClaimTagKey = coreapis.Group + "/nodeclaim" - NameTagKey = "Name" - NodePoolTagKey = karpv1.NodePoolLabelKey - NodeClassTagKey = LabelNodeClass - EKSClusterNameTagKey = "eks:eks-cluster-name" + NodeClaimTagKey = coreapis.Group + "/nodeclaim" + NameTagKey = "Name" + NodePoolTagKey = karpv1.NodePoolLabelKey + NodeClassTagKey = LabelNodeClass + LaunchTemplateNamePrefix = apis.Group + EKSClusterNameTagKey = "eks:eks-cluster-name" ) diff --git a/pkg/providers/launchtemplate/launchtemplate.go b/pkg/providers/launchtemplate/launchtemplate.go index 6d92c2f61f21..c9cfa098b312 100644 --- a/pkg/providers/launchtemplate/launchtemplate.go +++ b/pkg/providers/launchtemplate/launchtemplate.go @@ -38,7 +38,6 @@ import ( "k8s.io/apimachinery/pkg/api/resource" karpv1 "sigs.k8s.io/karpenter/pkg/apis/v1" - "github.com/aws/karpenter-provider-aws/pkg/apis" v1 "github.com/aws/karpenter-provider-aws/pkg/apis/v1" awserrors "github.com/aws/karpenter-provider-aws/pkg/errors" "github.com/aws/karpenter-provider-aws/pkg/operator/options" @@ -145,7 +144,7 @@ func (p *DefaultProvider) InvalidateCache(ctx context.Context, ltName string, lt p.cache.Delete(ltName) } func LaunchTemplateName(options *amifamily.LaunchTemplate) string { - return fmt.Sprintf("%s/%d", apis.Group, lo.Must(hashstructure.Hash(options, hashstructure.FormatV2, &hashstructure.HashOptions{SlicesAsSets: true}))) + return fmt.Sprintf("%s/%d", v1.LaunchTemplateNamePrefix, lo.Must(hashstructure.Hash(options, hashstructure.FormatV2, &hashstructure.HashOptions{SlicesAsSets: true}))) } func (p *DefaultProvider) createAMIOptions(ctx context.Context, nodeClass *v1.EC2NodeClass, labels, tags map[string]string) (*amifamily.Options, error) { // Remove any labels passed into userData that are prefixed with "node-restriction.kubernetes.io" or "kops.k8s.io" since the kubelet can't