non-preempting-priorityclass
Co-authored-by: Vallery Lancey <vallery@zeitgeistlabs.io> Co-authored-by: Tan shanshan <tan.shanshan@zte.com.cn>
This commit is contained in:
@@ -89,6 +89,10 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
enableServiceLinks := corev1.DefaultEnableServiceLinks
|
||||
s.EnableServiceLinks = &enableServiceLinks
|
||||
}
|
||||
if s.Preempting == nil {
|
||||
preempting := corev1.DefaultPreempting
|
||||
s.Preempting = &preempting
|
||||
}
|
||||
},
|
||||
func(j *core.PodPhase, c fuzz.Continue) {
|
||||
statuses := []core.PodPhase{core.PodPending, core.PodRunning, core.PodFailed, core.PodUnknown}
|
||||
|
@@ -2662,6 +2662,10 @@ type PodSpec struct {
|
||||
// The higher the value, the higher the priority.
|
||||
// +optional
|
||||
Priority *int32
|
||||
// Preempting specifies whether a pod with this PriorityClass could start a preemption process.
|
||||
// If not specified, the default is true.
|
||||
// +optional
|
||||
Preempting *bool
|
||||
// Specifies the DNS parameters of a pod.
|
||||
// Parameters specified here will be merged to the generated DNS
|
||||
// configuration based on DNSPolicy.
|
||||
|
@@ -162,6 +162,11 @@ func SetDefaults_Pod(obj *v1.Pod) {
|
||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||
obj.Spec.EnableServiceLinks = &enableServiceLinks
|
||||
}
|
||||
if obj.Spec.Preempting == nil {
|
||||
// Set Preempting as true by default.
|
||||
Preempting := v1.DefaultPreempting
|
||||
obj.Spec.Preempting = &Preempting
|
||||
}
|
||||
}
|
||||
func SetDefaults_PodSpec(obj *v1.PodSpec) {
|
||||
// New fields added here will break upgrade tests:
|
||||
|
@@ -1390,3 +1390,11 @@ func TestSetDefaultEnableServiceLinks(t *testing.T) {
|
||||
t.Errorf("Expected enableServiceLinks value: %+v\ngot: %+v\n", v1.DefaultEnableServiceLinks, *output.Spec.EnableServiceLinks)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetDefaultPreempting(t *testing.T) {
|
||||
pod := &v1.Pod{}
|
||||
output := roundTrip(t, runtime.Object(pod)).(*v1.Pod)
|
||||
if output.Spec.Preempting == nil || *output.Spec.Preempting != v1.DefaultPreempting {
|
||||
t.Errorf("Expected enableServiceLinks value: %+v\ngot: %+v\n", v1.DefaultPreempting, *output.Spec.Preempting)
|
||||
}
|
||||
}
|
||||
|
2
pkg/apis/core/v1/zz_generated.conversion.go
generated
2
pkg/apis/core/v1/zz_generated.conversion.go
generated
@@ -5594,6 +5594,7 @@ func autoConvert_v1_PodSpec_To_core_PodSpec(in *v1.PodSpec, out *core.PodSpec, s
|
||||
out.HostAliases = *(*[]core.HostAlias)(unsafe.Pointer(&in.HostAliases))
|
||||
out.PriorityClassName = in.PriorityClassName
|
||||
out.Priority = (*int32)(unsafe.Pointer(in.Priority))
|
||||
out.Preempting = (*bool)(unsafe.Pointer(in.Preempting))
|
||||
out.DNSConfig = (*core.PodDNSConfig)(unsafe.Pointer(in.DNSConfig))
|
||||
out.ReadinessGates = *(*[]core.PodReadinessGate)(unsafe.Pointer(&in.ReadinessGates))
|
||||
out.RuntimeClassName = (*string)(unsafe.Pointer(in.RuntimeClassName))
|
||||
@@ -5641,6 +5642,7 @@ func autoConvert_core_PodSpec_To_v1_PodSpec(in *core.PodSpec, out *v1.PodSpec, s
|
||||
out.HostAliases = *(*[]v1.HostAlias)(unsafe.Pointer(&in.HostAliases))
|
||||
out.PriorityClassName = in.PriorityClassName
|
||||
out.Priority = (*int32)(unsafe.Pointer(in.Priority))
|
||||
out.Preempting = (*bool)(unsafe.Pointer(in.Preempting))
|
||||
out.DNSConfig = (*v1.PodDNSConfig)(unsafe.Pointer(in.DNSConfig))
|
||||
out.ReadinessGates = *(*[]v1.PodReadinessGate)(unsafe.Pointer(&in.ReadinessGates))
|
||||
out.RuntimeClassName = (*string)(unsafe.Pointer(in.RuntimeClassName))
|
||||
|
5
pkg/apis/core/zz_generated.deepcopy.go
generated
5
pkg/apis/core/zz_generated.deepcopy.go
generated
@@ -3610,6 +3610,11 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) {
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.Preempting != nil {
|
||||
in, out := &in.Preempting, &out.Preempting
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
if in.DNSConfig != nil {
|
||||
in, out := &in.DNSConfig, &out.DNSConfig
|
||||
*out = new(PodDNSConfig)
|
||||
|
Reference in New Issue
Block a user