Skip to content

Commit 281f426

Browse files
authored
0.9 - support k8s 1.34 dra (#536)
1 parent 032887b commit 281f426

File tree

63 files changed

+855
-668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+855
-668
lines changed

.github/workflows/on-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
uses: helm/[email protected]
131131
with:
132132
cluster_name: kind
133-
version: v0.26.0
133+
version: v0.30.0
134134
config: ./hack/e2e-kind-config.yaml
135135

136136
- name: Load docker images to kind

build/makefile/testenv.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ENVTEST_K8S_VERSION = 1.32.0
1+
ENVTEST_K8S_VERSION = 1.34.0
22
ENVTEST_VERSION=release-0.20
33

44
E2E_TESTS_DIR = "test/e2e/"
@@ -19,4 +19,4 @@ envtest-go: envtest
1919
ENVTEST = $(LOCALBIN)/setup-envtest
2020
.PHONY: envtest
2121
envtest: ## Download envtest locally if necessary.
22-
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@${ENVTEST_VERSION}
22+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@${ENVTEST_VERSION}

cmd/binder/app/app.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
3131

3232
schedulingv1alpha2 "github.com/NVIDIA/KAI-scheduler/pkg/apis/scheduling/v1alpha2"
33+
draversionawareclient "github.com/NVIDIA/KAI-scheduler/pkg/common/resources/dra_version_aware_client"
3334

3435
"github.com/NVIDIA/KAI-scheduler/pkg/binder/binding"
3536
"github.com/NVIDIA/KAI-scheduler/pkg/binder/binding/resourcereservation"
@@ -116,7 +117,7 @@ func New() (*App, error) {
116117
return nil, err
117118
}
118119

119-
kubeClient := kubernetes.NewForConfigOrDie(config)
120+
kubeClient := draversionawareclient.NewDRAAwareClient(kubernetes.NewForConfigOrDie(config))
120121
informerFactory := informers.NewSharedInformerFactory(kubeClient, 0)
121122

122123
rrs := resourcereservation.NewService(options.FakeGPUNodes, clientWithWatch, options.ResourceReservationPodImage,

cmd/operator/app/app.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ func New() (*App, error) {
8888
return nil, err
8989
}
9090

91-
config.SetDRAFeatureGate(mgr)
92-
9391
configReconciler := &controller.ConfigReconciler{
9492
Client: mgr.GetClient(),
9593
Scheme: mgr.GetScheme(),

cmd/scheduler/app/options/options_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,12 @@ func TestAddFlags(t *testing.T) {
7474
}
7575

7676
if !reflect.DeepEqual(expected, s) {
77-
difference := diff.ObjectDiff(expected, s)
77+
difference := diff.ObjectGoPrintSideBySide(expected, s)
7878
t.Errorf("Got different run options than expected.\nGot: %+v\nExpected: %+v\ndiff: %s", s, expected, difference)
7979
}
8080

8181
// Test that the feature gates are set correctly.
8282
if !utilfeature.DefaultFeatureGate.Enabled(features.DynamicResourceAllocation) {
8383
t.Errorf("DynamicResourceAllocation feature gate should be enabled")
8484
}
85-
if utilfeature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) {
86-
t.Errorf("VolumeCapacityPriority feature gate should be disabled")
87-
}
8885
}

cmd/snapshot-tool/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,21 @@ func loadClientsWithSnapshot(rawObjects *snapshot.RawKubernetesObjects) (*fake.C
210210
}
211211

212212
for _, resourceClaim := range rawObjects.ResourceClaims {
213-
_, err := kubeClient.ResourceV1beta1().ResourceClaims(resourceClaim.Namespace).Create(context.TODO(), resourceClaim, v1.CreateOptions{})
213+
_, err := kubeClient.ResourceV1().ResourceClaims(resourceClaim.Namespace).Create(context.TODO(), resourceClaim, v1.CreateOptions{})
214214
if err != nil {
215215
log.InfraLogger.Errorf("Failed to create resource claim: %v", err)
216216
}
217217
}
218218

219219
for _, resourceSlice := range rawObjects.ResourceSlices {
220-
_, err := kubeClient.ResourceV1beta1().ResourceSlices().Create(context.TODO(), resourceSlice, v1.CreateOptions{})
220+
_, err := kubeClient.ResourceV1().ResourceSlices().Create(context.TODO(), resourceSlice, v1.CreateOptions{})
221221
if err != nil {
222222
log.InfraLogger.Errorf("Failed to create resource slice: %v", err)
223223
}
224224
}
225225

226226
for _, deviceClass := range rawObjects.DeviceClasses {
227-
_, err := kubeClient.ResourceV1beta1().DeviceClasses().Create(context.TODO(), deviceClass, v1.CreateOptions{})
227+
_, err := kubeClient.ResourceV1().DeviceClasses().Create(context.TODO(), deviceClass, v1.CreateOptions{})
228228
if err != nil {
229229
log.InfraLogger.Errorf("Failed to create device class: %v", err)
230230
}

deployments/kai-scheduler/crds/kai.scheduler_configs.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ spec:
101101
Claims lists the names of resources, defined in spec.resourceClaims,
102102
that are used by this container.
103103
104-
This is an alpha field and requires enabling the
104+
This field depends on the
105105
DynamicResourceAllocation feature gate.
106106
107107
This field is immutable. It can only be set for containers.
@@ -273,7 +273,7 @@ spec:
273273
Claims lists the names of resources, defined in spec.resourceClaims,
274274
that are used by this container.
275275
276-
This is an alpha field and requires enabling the
276+
This field depends on the
277277
DynamicResourceAllocation feature gate.
278278
279279
This field is immutable. It can only be set for containers.
@@ -625,7 +625,6 @@ spec:
625625
pod labels will be ignored. The default value is empty.
626626
The same key is forbidden to exist in both matchLabelKeys and labelSelector.
627627
Also, matchLabelKeys cannot be set when labelSelector isn't set.
628-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
629628
items:
630629
type: string
631630
type: array
@@ -640,7 +639,6 @@ spec:
640639
pod labels will be ignored. The default value is empty.
641640
The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
642641
Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
643-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
644642
items:
645643
type: string
646644
type: array
@@ -807,7 +805,6 @@ spec:
807805
pod labels will be ignored. The default value is empty.
808806
The same key is forbidden to exist in both matchLabelKeys and labelSelector.
809807
Also, matchLabelKeys cannot be set when labelSelector isn't set.
810-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
811808
items:
812809
type: string
813810
type: array
@@ -822,7 +819,6 @@ spec:
822819
pod labels will be ignored. The default value is empty.
823820
The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
824821
Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
825-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
826822
items:
827823
type: string
828824
type: array
@@ -916,8 +912,8 @@ spec:
916912
most preferred is the one with the greatest sum of weights, i.e.
917913
for each node that meets all of the scheduling requirements (resource
918914
request, requiredDuringScheduling anti-affinity expressions, etc.),
919-
compute a sum by iterating through the elements of this field and adding
920-
"weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the
915+
compute a sum by iterating through the elements of this field and subtracting
916+
"weight" from the sum if the node has pods which matches the corresponding podAffinityTerm; the
921917
node(s) with the highest sum are the most preferred.
922918
items:
923919
description: The weights of all of the matched WeightedPodAffinityTerm
@@ -987,7 +983,6 @@ spec:
987983
pod labels will be ignored. The default value is empty.
988984
The same key is forbidden to exist in both matchLabelKeys and labelSelector.
989985
Also, matchLabelKeys cannot be set when labelSelector isn't set.
990-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
991986
items:
992987
type: string
993988
type: array
@@ -1002,7 +997,6 @@ spec:
1002997
pod labels will be ignored. The default value is empty.
1003998
The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
1004999
Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
1005-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
10061000
items:
10071001
type: string
10081002
type: array
@@ -1169,7 +1163,6 @@ spec:
11691163
pod labels will be ignored. The default value is empty.
11701164
The same key is forbidden to exist in both matchLabelKeys and labelSelector.
11711165
Also, matchLabelKeys cannot be set when labelSelector isn't set.
1172-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
11731166
items:
11741167
type: string
11751168
type: array
@@ -1184,7 +1177,6 @@ spec:
11841177
pod labels will be ignored. The default value is empty.
11851178
The same key is forbidden to exist in both mismatchLabelKeys and labelSelector.
11861179
Also, mismatchLabelKeys cannot be set when labelSelector isn't set.
1187-
This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default).
11881180
items:
11891181
type: string
11901182
type: array
@@ -1657,7 +1649,7 @@ spec:
16571649
Claims lists the names of resources, defined in spec.resourceClaims,
16581650
that are used by this container.
16591651
1660-
This is an alpha field and requires enabling the
1652+
This field depends on the
16611653
DynamicResourceAllocation feature gate.
16621654
16631655
This field is immutable. It can only be set for containers.
@@ -1766,7 +1758,7 @@ spec:
17661758
Claims lists the names of resources, defined in spec.resourceClaims,
17671759
that are used by this container.
17681760
1769-
This is an alpha field and requires enabling the
1761+
This field depends on the
17701762
DynamicResourceAllocation feature gate.
17711763
17721764
This field is immutable. It can only be set for containers.
@@ -1903,7 +1895,7 @@ spec:
19031895
Claims lists the names of resources, defined in spec.resourceClaims,
19041896
that are used by this container.
19051897
1906-
This is an alpha field and requires enabling the
1898+
This field depends on the
19071899
DynamicResourceAllocation feature gate.
19081900
19091901
This field is immutable. It can only be set for containers.
@@ -2051,7 +2043,7 @@ spec:
20512043
Claims lists the names of resources, defined in spec.resourceClaims,
20522044
that are used by this container.
20532045
2054-
This is an alpha field and requires enabling the
2046+
This field depends on the
20552047
DynamicResourceAllocation feature gate.
20562048
20572049
This field is immutable. It can only be set for containers.

0 commit comments

Comments
 (0)