Skip to content

Commit

Permalink
Merge pull request #119117 from champtar/automated-cherry-pick-of-#11…
Browse files Browse the repository at this point in the history
…4338-upstream-release-1.26

Automated cherry pick of #114338: kubeadm: set priority for "system-node-critical" Pods
  • Loading branch information
k8s-ci-robot committed Jul 7, 2023
2 parents 728dfdf + a65e7a7 commit 99a5b2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/kubeadm/app/util/staticpod/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ var (

// ComponentPod returns a Pod object from the container, volume and annotations specifications
func ComponentPod(container v1.Container, volumes map[string]v1.Volume, annotations map[string]string) v1.Pod {
// priority value for system-node-critical class
priority := int32(2000001000)
return v1.Pod{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Expand All @@ -74,6 +76,7 @@ func ComponentPod(container v1.Container, volumes map[string]v1.Volume, annotati
},
Spec: v1.PodSpec{
Containers: []v1.Container{container},
Priority: &priority,
PriorityClassName: "system-node-critical",
HostNetwork: true,
Volumes: VolumeMapToSlice(volumes),
Expand Down
3 changes: 3 additions & 0 deletions cmd/kubeadm/app/util/staticpod/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ func TestGetEtcdProbeEndpoint(t *testing.T) {
}

func TestComponentPod(t *testing.T) {
// priority value for system-node-critical class
priority := int32(2000001000)
var tests = []struct {
name string
expected v1.Pod
Expand Down Expand Up @@ -419,6 +421,7 @@ func TestComponentPod(t *testing.T) {
Name: "foo",
},
},
Priority: &priority,
PriorityClassName: "system-node-critical",
HostNetwork: true,
Volumes: []v1.Volume{},
Expand Down

0 comments on commit 99a5b2c

Please sign in to comment.