Skip to content

Commit 76bcca7

Browse files
committed
Add e2e test to validate the resource.k8s.io DRA API
- DynamicResourceAllocation has been graduated to GA in k8s 1.34 - Added tests to verify the DRA `v1` APIs are available Signed-off-by: Sai Ramesh Vanka <[email protected]>
1 parent 737f738 commit 76bcca7

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

test/extended/node/OWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
reviewers:
2+
- haircommander
3+
- harche
4+
- mrunalp
5+
- rphillips
6+
- sairameshv
7+
- saschagrunert
8+
approvers:
9+
- haircommander
10+
- mrunalp

test/extended/node/dra.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package node
2+
3+
import (
4+
"context"
5+
6+
g "github.com/onsi/ginkgo/v2"
7+
o "github.com/onsi/gomega"
8+
9+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
10+
"k8s.io/kubernetes/test/e2e/framework"
11+
admissionapi "k8s.io/pod-security-admission/api"
12+
13+
exutil "github.com/openshift/origin/test/extended/util"
14+
)
15+
16+
var _ = g.Describe("[sig-node][DRA][OCPFeatureGate:DynamicResourceAllocation]", func() {
17+
defer g.GinkgoRecover()
18+
19+
oc := exutil.NewCLIWithPodSecurityLevel("dra-scheduling", admissionapi.LevelPrivileged)
20+
21+
g.Context("Dynamic Resource Allocation", func() {
22+
23+
g.It("should verify beta and alpha DRA APIs are disabled [apigroup:resource.k8s.io]", func(ctx context.Context) {
24+
g.By("discovering available API versions for resource.k8s.io group")
25+
discoveryClient := oc.AdminKubeClient().Discovery()
26+
apiGroup, err := discoveryClient.ServerResourcesForGroupVersion("resource.k8s.io/v1")
27+
o.Expect(err).NotTo(o.HaveOccurred(), "v1 API should be available when DRA feature gate is enabled")
28+
o.Expect(apiGroup).NotTo(o.BeNil())
29+
framework.Logf("Found resource.k8s.io/v1 API with %d resources", len(apiGroup.APIResources))
30+
31+
g.By("listing all available versions for resource.k8s.io group")
32+
apiGroupList, err := discoveryClient.ServerGroups()
33+
o.Expect(err).NotTo(o.HaveOccurred(), "should be able to list API groups")
34+
35+
var resourceAPIGroup *metav1.APIGroup
36+
for _, group := range apiGroupList.Groups {
37+
if group.Name == "resource.k8s.io" {
38+
resourceAPIGroup = &group
39+
break
40+
}
41+
}
42+
o.Expect(resourceAPIGroup).NotTo(o.BeNil(), "resource.k8s.io group should exist")
43+
44+
framework.Logf("Available versions for resource.k8s.io: %v", resourceAPIGroup.Versions)
45+
// Verify only v1 is in the list
46+
expectedVersions := []metav1.GroupVersionForDiscovery{
47+
{
48+
GroupVersion: "resource.k8s.io/v1",
49+
Version: "v1",
50+
},
51+
}
52+
o.Expect(resourceAPIGroup.Versions).To(o.Equal(expectedVersions), "only v1 should be available")
53+
o.Expect(resourceAPIGroup.PreferredVersion.Version).To(o.Equal("v1"), "v1 should be the preferred version")
54+
})
55+
56+
})
57+
})

0 commit comments

Comments
 (0)