Skip to content

Commit eca9ed4

Browse files
authored
chore: Bump Karpenter in the go.mod (#8082)
1 parent 454112b commit eca9ed4

File tree

7 files changed

+55
-12
lines changed

7 files changed

+55
-12
lines changed

charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
{{- with .Values.additionalAnnotations }}
77
{{- toYaml . | nindent 4 }}
88
{{- end }}
9-
controller-gen.kubebuilder.io/version: v0.17.3
9+
controller-gen.kubebuilder.io/version: v0.18.0
1010
name: nodeclaims.karpenter.sh
1111
spec:
1212
group: karpenter.sh

charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
{{- with .Values.additionalAnnotations }}
77
{{- toYaml . | nindent 4 }}
88
{{- end }}
9-
controller-gen.kubebuilder.io/version: v0.17.3
9+
controller-gen.kubebuilder.io/version: v0.18.0
1010
name: nodepools.karpenter.sh
1111
spec:
1212
group: karpenter.sh

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ require (
4545
k8s.io/klog/v2 v2.130.1
4646
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
4747
sigs.k8s.io/controller-runtime v0.20.4
48-
sigs.k8s.io/karpenter v1.4.1-0.20250506193715-4394e170fde6
48+
sigs.k8s.io/karpenter v1.4.1-0.20250513224127-bba636f59114
4949
sigs.k8s.io/yaml v1.4.0
5050
)
5151

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ sigs.k8s.io/controller-runtime v0.20.4 h1:X3c+Odnxz+iPTRobG4tp092+CvBU9UK0t/bRf+
357357
sigs.k8s.io/controller-runtime v0.20.4/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY=
358358
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
359359
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
360-
sigs.k8s.io/karpenter v1.4.1-0.20250506193715-4394e170fde6 h1:KlvmuMKgbEoakvqod5yHEqV0TC0ivaDVgvaLlwiLUuM=
361-
sigs.k8s.io/karpenter v1.4.1-0.20250506193715-4394e170fde6/go.mod h1:YuqGoQsLti+V7ugHQVGXuT4v1QwCMiKloHLcPDfwMbY=
360+
sigs.k8s.io/karpenter v1.4.1-0.20250513224127-bba636f59114 h1:f6iTiBjzndNJbP0uRAP01k21Jy3lQEuhn7pGFsRDPa4=
361+
sigs.k8s.io/karpenter v1.4.1-0.20250513224127-bba636f59114/go.mod h1:YuqGoQsLti+V7ugHQVGXuT4v1QwCMiKloHLcPDfwMbY=
362362
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
363363
sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4=
364364
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=

pkg/apis/crds/karpenter.sh_nodeclaims.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.17.3
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: nodeclaims.karpenter.sh
88
spec:
99
group: karpenter.sh

pkg/apis/crds/karpenter.sh_nodepools.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.17.3
6+
controller-gen.kubebuilder.io/version: v0.18.0
77
name: nodepools.karpenter.sh
88
spec:
99
group: karpenter.sh

pkg/apis/v1/nodepool_validation_cel_test.go

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"k8s.io/apimachinery/pkg/util/sets"
2626

2727
karpv1 "sigs.k8s.io/karpenter/pkg/apis/v1"
28+
"sigs.k8s.io/karpenter/pkg/test"
2829
)
2930

3031
var _ = Describe("CEL/Validation", func() {
@@ -65,23 +66,65 @@ var _ = Describe("CEL/Validation", func() {
6566
{NodeSelectorRequirement: corev1.NodeSelectorRequirement{Key: label + "/test", Operator: corev1.NodeSelectorOpIn, Values: []string{"test"}}},
6667
}
6768
Expect(env.Client.Create(ctx, nodePool)).To(Succeed())
68-
Expect(nodePool.RuntimeValidate()).To(Succeed())
69+
Expect(nodePool.RuntimeValidate(ctx)).To(Succeed())
6970
Expect(env.Client.Delete(ctx, nodePool)).To(Succeed())
7071
nodePool = oldNodePool.DeepCopy()
7172
}
7273
})
7374
It("should allow well known label exceptions", func() {
7475
oldNodePool := nodePool.DeepCopy()
75-
for label := range karpv1.WellKnownLabels.Difference(sets.New(karpv1.NodePoolLabelKey)) {
76+
for label := range karpv1.WellKnownLabels.Difference(sets.New(karpv1.NodePoolLabelKey, karpv1.CapacityTypeLabelKey)) {
7677
nodePool.Spec.Template.Spec.Requirements = []karpv1.NodeSelectorRequirementWithMinValues{
7778
{NodeSelectorRequirement: corev1.NodeSelectorRequirement{Key: label, Operator: corev1.NodeSelectorOpIn, Values: []string{"test"}}},
7879
}
7980
Expect(env.Client.Create(ctx, nodePool)).To(Succeed())
80-
Expect(nodePool.RuntimeValidate()).To(Succeed())
81+
Expect(nodePool.RuntimeValidate(ctx)).To(Succeed())
8182
Expect(env.Client.Delete(ctx, nodePool)).To(Succeed())
8283
nodePool = oldNodePool.DeepCopy()
8384
}
8485
})
86+
It("should fail validation with only invalid capacity types", func() {
87+
oldNodePool := nodePool.DeepCopy()
88+
test.ReplaceRequirements(nodePool, karpv1.NodeSelectorRequirementWithMinValues{
89+
NodeSelectorRequirement: corev1.NodeSelectorRequirement{
90+
Key: karpv1.CapacityTypeLabelKey,
91+
Operator: corev1.NodeSelectorOpIn,
92+
Values: []string{"xspot"}, // Invalid value
93+
},
94+
})
95+
Expect(env.Client.Create(ctx, nodePool)).To(Succeed())
96+
Expect(nodePool.RuntimeValidate(ctx)).ToNot(Succeed())
97+
Expect(env.Client.Delete(ctx, nodePool)).To(Succeed())
98+
nodePool = oldNodePool.DeepCopy()
99+
})
100+
It("should pass validation with valid capacity types", func() {
101+
oldNodePool := nodePool.DeepCopy()
102+
test.ReplaceRequirements(nodePool, karpv1.NodeSelectorRequirementWithMinValues{
103+
NodeSelectorRequirement: corev1.NodeSelectorRequirement{
104+
Key: karpv1.CapacityTypeLabelKey,
105+
Operator: corev1.NodeSelectorOpIn,
106+
Values: []string{karpv1.CapacityTypeOnDemand}, // Valid value
107+
},
108+
})
109+
Expect(env.Client.Create(ctx, nodePool)).To(Succeed())
110+
Expect(nodePool.RuntimeValidate(ctx)).To(Succeed())
111+
Expect(env.Client.Delete(ctx, nodePool)).To(Succeed())
112+
nodePool = oldNodePool.DeepCopy()
113+
})
114+
It("should fail open if invalid and valid capacity types are present", func() {
115+
oldNodePool := nodePool.DeepCopy()
116+
test.ReplaceRequirements(nodePool, karpv1.NodeSelectorRequirementWithMinValues{
117+
NodeSelectorRequirement: corev1.NodeSelectorRequirement{
118+
Key: karpv1.CapacityTypeLabelKey,
119+
Operator: corev1.NodeSelectorOpIn,
120+
Values: []string{karpv1.CapacityTypeOnDemand, "xspot"}, // Valid and invalid value
121+
},
122+
})
123+
Expect(env.Client.Create(ctx, nodePool)).To(Succeed())
124+
Expect(nodePool.RuntimeValidate(ctx)).To(Succeed())
125+
Expect(env.Client.Delete(ctx, nodePool)).To(Succeed())
126+
nodePool = oldNodePool.DeepCopy()
127+
})
85128
})
86129
Context("Labels", func() {
87130
It("should allow restricted domains exceptions", func() {
@@ -91,7 +134,7 @@ var _ = Describe("CEL/Validation", func() {
91134
label: "test",
92135
}
93136
Expect(env.Client.Create(ctx, nodePool)).To(Succeed())
94-
Expect(nodePool.RuntimeValidate()).To(Succeed())
137+
Expect(nodePool.RuntimeValidate(ctx)).To(Succeed())
95138
Expect(env.Client.Delete(ctx, nodePool)).To(Succeed())
96139
nodePool = oldNodePool.DeepCopy()
97140
}
@@ -103,7 +146,7 @@ var _ = Describe("CEL/Validation", func() {
103146
label: "test",
104147
}
105148
Expect(env.Client.Create(ctx, nodePool)).To(Succeed())
106-
Expect(nodePool.RuntimeValidate()).To(Succeed())
149+
Expect(nodePool.RuntimeValidate(ctx)).To(Succeed())
107150
Expect(env.Client.Delete(ctx, nodePool)).To(Succeed())
108151
nodePool = oldNodePool.DeepCopy()
109152
}

0 commit comments

Comments
 (0)