From d585f07ae8ce144467e2008c69af7cfc91f9e57f Mon Sep 17 00:00:00 2001 From: Ania Borowiec Date: Wed, 8 Jul 2026 10:13:48 +0000 Subject: [PATCH] Add PreemptionPolicy to PodGroupTemplate Kubernetes-commit: 9beead05cde4f50e57b02784038b8fd16dc8baec --- applyconfigurations/internal/internal.go | 3 +++ .../scheduling/v1alpha3/podgrouptemplate.go | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 110c1127c..e44150ec5 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -14946,6 +14946,9 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: preemptionPolicy + type: + scalar: string - name: priority type: scalar: numeric diff --git a/applyconfigurations/scheduling/v1alpha3/podgrouptemplate.go b/applyconfigurations/scheduling/v1alpha3/podgrouptemplate.go index dfa8f578e..233a984d9 100644 --- a/applyconfigurations/scheduling/v1alpha3/podgrouptemplate.go +++ b/applyconfigurations/scheduling/v1alpha3/podgrouptemplate.go @@ -18,6 +18,10 @@ limitations under the License. package v1alpha3 +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + // PodGroupTemplateApplyConfiguration represents a declarative configuration of the PodGroupTemplate type for use // with apply. // @@ -56,6 +60,11 @@ type PodGroupTemplateApplyConfiguration struct { // The higher the value, the higher the priority. // This field is immutable. Priority *int32 `json:"priority,omitempty"` + // PreemptionPolicy is the Policy for preempting pods/podgroups with lower priority. + // One of Never, PreemptLowerPriority. + // This field is immutable. + // This field is available only when the PodGroupPreemptionPolicy feature gate is enabled. + PreemptionPolicy *schedulingv1alpha3.PreemptionPolicy `json:"preemptionPolicy,omitempty"` } // PodGroupTemplateApplyConfiguration constructs a declarative configuration of the PodGroupTemplate type for use with @@ -124,3 +133,11 @@ func (b *PodGroupTemplateApplyConfiguration) WithPriority(value int32) *PodGroup b.Priority = &value return b } + +// WithPreemptionPolicy sets the PreemptionPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreemptionPolicy field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithPreemptionPolicy(value schedulingv1alpha3.PreemptionPolicy) *PodGroupTemplateApplyConfiguration { + b.PreemptionPolicy = &value + return b +}