Skip to content

Commit

Permalink
fix: correctly check for latest alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdeal committed Oct 30, 2024
1 parent 883fbc0 commit 79e0519
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: ec2nodeclasses.karpenter.k8s.aws
spec:
group: karpenter.k8s.aws
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.16.5
name: ec2nodeclasses.karpenter.k8s.aws
spec:
group: karpenter.k8s.aws
Expand Down
5 changes: 4 additions & 1 deletion pkg/providers/amifamily/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ func (p *DefaultProvider) List(ctx context.Context, nodeClass *v1.EC2NodeClass)
// Discover deprecated AMIs if automatic AMI discovery and upgrade is enabled. This ensures we'll be able to
// provision in the event of an EKS optimized AMI being deprecated.
includeDeprecated := lo.ContainsBy(nodeClass.Spec.AMISelectorTerms, func(term v1.AMISelectorTerm) bool {
return term.Alias == "latest"
if term.Alias == "" {
return false
}
return v1.AMIVersionFromAlias(term.Alias) == "latest"
})
amis, err := p.amis(ctx, queries, includeDeprecated)
if err != nil {
Expand Down

0 comments on commit 79e0519

Please sign in to comment.