Skip to content

Commit

Permalink
chore: Move the launch template name prefix into api labels (#7442)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis authored Nov 26, 2024
1 parent 20e3299 commit 6d7fdf6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions pkg/apis/v1/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
3 changes: 1 addition & 2 deletions pkg/providers/launchtemplate/launchtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6d7fdf6

Please sign in to comment.