Merge pull request #140312 from ania-borowiec/policy_in_template

KEP-5710: Add PreemptionPolicy to PodGroupTemplate [WAS]

Kubernetes-commit: 319f3bc1aa3e5854adf7efcc668252eba0f592ad
This commit is contained in:
Kubernetes Publisher
2026-07-14 16:05:25 +00:00
4 changed files with 26 additions and 6 deletions

View File

@@ -14946,6 +14946,9 @@ var schemaYAML = typed.YAMLObject(`types:
type:
scalar: string
default: ""
- name: preemptionPolicy
type:
scalar: string
- name: priority
type:
scalar: numeric

View File

@@ -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
}

4
go.mod
View File

@@ -23,8 +23,8 @@ require (
golang.org/x/time v0.15.0
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
gopkg.in/evanphx/json-patch.v4 v4.13.0
k8s.io/api v0.0.0-20260710100122-271ac82bb297
k8s.io/apimachinery v0.0.0-20260710095601-0838f1f442d5
k8s.io/api v0.0.0-20260714180125-be6a9fe95b4e
k8s.io/apimachinery v0.0.0-20260714080237-16d43734bc5c
k8s.io/klog/v2 v2.140.0
k8s.io/kube-openapi v0.0.0-20260618221249-bc653b64f974
k8s.io/streaming v0.0.0-20260710095143-d1a4397cb62c

8
go.sum
View File

@@ -118,10 +118,10 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20260710100122-271ac82bb297 h1:weEXc5tGNMpuC1GGwkZht3bkcBc9Faiipyz9j2MEMYQ=
k8s.io/api v0.0.0-20260710100122-271ac82bb297/go.mod h1:be7u08H1x8iYfyScLY8cp3ezQA3oGUy9vuHbW6JMOBw=
k8s.io/apimachinery v0.0.0-20260710095601-0838f1f442d5 h1:cmJOur/9PSYcs6BUl8OMfsWUK0SF/wU3lLBo1n52dHw=
k8s.io/apimachinery v0.0.0-20260710095601-0838f1f442d5/go.mod h1:gUMHWz9sZCP7+vv/RiJJXhiPGY2mjS9OgfFcoqYul+M=
k8s.io/api v0.0.0-20260714180125-be6a9fe95b4e h1:Dao0OvbE8pYhakzMKF3cEAq80zUyN4+ybvYQwDErM3s=
k8s.io/api v0.0.0-20260714180125-be6a9fe95b4e/go.mod h1:oUftcBdVfUZQ1Ig2Tsk1lzfIaJJuWv9AuJj2CZo0H4Q=
k8s.io/apimachinery v0.0.0-20260714080237-16d43734bc5c h1:LmQCUrYjUcgZt6MUt5FOynsbvuY9v726NBZbp5a/Krg=
k8s.io/apimachinery v0.0.0-20260714080237-16d43734bc5c/go.mod h1:gUMHWz9sZCP7+vv/RiJJXhiPGY2mjS9OgfFcoqYul+M=
k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc=
k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0=
k8s.io/kube-openapi v0.0.0-20260618221249-bc653b64f974 h1:JVogoTvOj6gutlx8bUwGh0e8o8L4X8nDbTLyONmoVvk=