mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 19:23:40 +00:00
Merge pull request #114338 from champtar/kubeadm-priority
kubeadm: set priority for "system-node-critical" Pods
This commit is contained in:
commit
f380944261
@ -56,6 +56,8 @@ var (
|
|||||||
|
|
||||||
// ComponentPod returns a Pod object from the container, volume and annotations specifications
|
// 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 {
|
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{
|
return v1.Pod{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
@ -71,6 +73,7 @@ func ComponentPod(container v1.Container, volumes map[string]v1.Volume, annotati
|
|||||||
},
|
},
|
||||||
Spec: v1.PodSpec{
|
Spec: v1.PodSpec{
|
||||||
Containers: []v1.Container{container},
|
Containers: []v1.Container{container},
|
||||||
|
Priority: &priority,
|
||||||
PriorityClassName: "system-node-critical",
|
PriorityClassName: "system-node-critical",
|
||||||
HostNetwork: true,
|
HostNetwork: true,
|
||||||
Volumes: VolumeMapToSlice(volumes),
|
Volumes: VolumeMapToSlice(volumes),
|
||||||
|
@ -392,6 +392,8 @@ func TestGetEtcdProbeEndpoint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestComponentPod(t *testing.T) {
|
func TestComponentPod(t *testing.T) {
|
||||||
|
// priority value for system-node-critical class
|
||||||
|
priority := int32(2000001000)
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
name string
|
name string
|
||||||
expected v1.Pod
|
expected v1.Pod
|
||||||
@ -419,6 +421,7 @@ func TestComponentPod(t *testing.T) {
|
|||||||
Name: "foo",
|
Name: "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Priority: &priority,
|
||||||
PriorityClassName: "system-node-critical",
|
PriorityClassName: "system-node-critical",
|
||||||
HostNetwork: true,
|
HostNetwork: true,
|
||||||
Volumes: []v1.Volume{},
|
Volumes: []v1.Volume{},
|
||||||
|
Loading…
Reference in New Issue
Block a user