Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions test/extended/pods/priorityclasses.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package pods
import (
"context"
"fmt"
"path/filepath"
"strings"

. "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
e2e "k8s.io/kubernetes/test/e2e/framework"
Expand Down Expand Up @@ -88,6 +90,37 @@ var _ = Describe("[sig-arch] Managed cluster should", func() {
})
})

var _ = Describe("[sig-node] Pod priority should match the default priorityClassName values", func() {
defer GinkgoRecover()
var (
oc = exutil.NewCLI("priority-class-name")
systemNodeCriticalPodFile = filepath.Join("testdata", "priority-class-name", "system-node-critical.yaml")
systemClusterCriticalPodFile = filepath.Join("testdata", "priority-class-name", "system-cluster-critical.yaml")
)

It("system-node-critical=2000001000", func() {
By("creating the pods")
err := oc.Run("create").Args("-f", systemNodeCriticalPodFile).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

By("checking the pod priority")
out, err := oc.Run("get").Args("pods/pod-with-system-node-critical-priority-class").Template("{{.spec.priority}}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(out).To(o.Equal("2000001000"))
})

It("system-cluster-critical=2000000000", func() {
By("creating the pods")
err := oc.Run("create").Args("-f", systemClusterCriticalPodFile).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

By("checking the pod priority")
out, err := oc.Run("get").Args("pods/pod-with-system-cluster-critical-priority-class").Template("{{.spec.priority}}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(out).To(o.Equal("2000000000"))
})
})

func hasPrefixSet(name string, set sets.String) bool {
for _, prefix := range set.List() {
if strings.HasPrefix(name, prefix) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kind: Template
apiVersion: template.openshift.io/v1
metadata:
name: template
objects:
- kind: Pod
apiVersion: v1
metadata:
name: pod-with-system-cluster-critical-priority-class
spec:
containers:
- name: new-container
image: busybox
command:
- ls
priorityClassName: system-cluster-critical
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kind: Template
apiVersion: template.openshift.io/v1
metadata:
name: template
objects:
- kind: Pod
apiVersion: v1
metadata:
name: pod-with-system-node-critical-priority-class
spec:
containers:
- name: new-container
image: busybox
command:
- ls
priorityClassName: system-node-critical

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.