mirror of
https://github.com/kubernetes/client-go.git
synced 2026-05-14 19:17:56 +00:00
Add Workload-Aware Preemption fields to Workload and PodGroup APIs
Co-authored-by: Omar Sayed <omarsayed@google.com> Kubernetes-commit: 59c9f75133f22ed24e944cf0b8a1a68e1c49af32
This commit is contained in:
committed by
Kubernetes Publisher
parent
df2d882697
commit
7e44ffcaa9
@@ -14801,9 +14801,19 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: io.k8s.api.scheduling.v1alpha2.PodGroupSpec
|
||||
map:
|
||||
fields:
|
||||
- name: disruptionMode
|
||||
type:
|
||||
scalar: string
|
||||
default: Pod
|
||||
- name: podGroupTemplateRef
|
||||
type:
|
||||
namedType: io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference
|
||||
- name: priority
|
||||
type:
|
||||
scalar: numeric
|
||||
- name: priorityClassName
|
||||
type:
|
||||
scalar: string
|
||||
- name: resourceClaims
|
||||
type:
|
||||
list:
|
||||
@@ -14841,10 +14851,19 @@ var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: io.k8s.api.scheduling.v1alpha2.PodGroupTemplate
|
||||
map:
|
||||
fields:
|
||||
- name: disruptionMode
|
||||
type:
|
||||
scalar: string
|
||||
- name: name
|
||||
type:
|
||||
scalar: string
|
||||
default: ""
|
||||
- name: priority
|
||||
type:
|
||||
scalar: numeric
|
||||
- name: priorityClassName
|
||||
type:
|
||||
scalar: string
|
||||
- name: resourceClaims
|
||||
type:
|
||||
list:
|
||||
|
||||
@@ -18,6 +18,10 @@ limitations under the License.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
|
||||
)
|
||||
|
||||
// PodGroupSpecApplyConfiguration represents a declarative configuration of the PodGroupSpec type for use
|
||||
// with apply.
|
||||
//
|
||||
@@ -46,6 +50,31 @@ type PodGroupSpecApplyConfiguration struct {
|
||||
//
|
||||
// This field is immutable.
|
||||
ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"`
|
||||
// DisruptionMode defines the mode in which a given PodGroup can be disrupted.
|
||||
// Controllers are expected to fill this field by copying it from a PodGroupTemplate.
|
||||
// One of Pod, PodGroup. Defaults to Pod if unset.
|
||||
// This field is immutable.
|
||||
// This field is available only when the WorkloadAwarePreemption feature gate
|
||||
// is enabled.
|
||||
DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"`
|
||||
// PriorityClassName defines the priority that should be considered when scheduling this pod group.
|
||||
// Controllers are expected to fill this field by copying it from a PodGroupTemplate.
|
||||
// Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate
|
||||
// (i.e. if no priority class is specified, admission control can set this to the global default
|
||||
// priority class if it exists. Otherwise, the pod group's priority will be zero).
|
||||
// This field is immutable.
|
||||
// This field is available only when the WorkloadAwarePreemption feature gate
|
||||
// is enabled.
|
||||
PriorityClassName *string `json:"priorityClassName,omitempty"`
|
||||
// Priority is the value of priority of this pod group. Various system components
|
||||
// use this field to find the priority of the pod group. When Priority Admission
|
||||
// Controller is enabled, it prevents users from setting this field. The admission
|
||||
// controller populates this field from PriorityClassName.
|
||||
// The higher the value, the higher the priority.
|
||||
// This field is immutable.
|
||||
// This field is available only when the WorkloadAwarePreemption feature gate
|
||||
// is enabled.
|
||||
Priority *int32 `json:"priority,omitempty"`
|
||||
}
|
||||
|
||||
// PodGroupSpecApplyConfiguration constructs a declarative configuration of the PodGroupSpec type for use with
|
||||
@@ -90,3 +119,27 @@ func (b *PodGroupSpecApplyConfiguration) WithResourceClaims(values ...*PodGroupR
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call.
|
||||
func (b *PodGroupSpecApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupSpecApplyConfiguration {
|
||||
b.DisruptionMode = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPriorityClassName sets the PriorityClassName 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 PriorityClassName field is set to the value of the last call.
|
||||
func (b *PodGroupSpecApplyConfiguration) WithPriorityClassName(value string) *PodGroupSpecApplyConfiguration {
|
||||
b.PriorityClassName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPriority sets the Priority 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 Priority field is set to the value of the last call.
|
||||
func (b *PodGroupSpecApplyConfiguration) WithPriority(value int32) *PodGroupSpecApplyConfiguration {
|
||||
b.Priority = &value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ limitations under the License.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2"
|
||||
)
|
||||
|
||||
// PodGroupTemplateApplyConfiguration represents a declarative configuration of the PodGroupTemplate type for use
|
||||
// with apply.
|
||||
//
|
||||
@@ -42,6 +46,26 @@ type PodGroupTemplateApplyConfiguration struct {
|
||||
//
|
||||
// This field is immutable.
|
||||
ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"`
|
||||
// DisruptionMode defines the mode in which a given PodGroup can be disrupted.
|
||||
// One of Pod, PodGroup.
|
||||
// This field is available only when the WorkloadAwarePreemption feature gate
|
||||
// is enabled.
|
||||
DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"`
|
||||
// PriorityClassName indicates the priority that should be considered when scheduling
|
||||
// a pod group created from this template. If no priority class is specified, admission
|
||||
// control can set this to the global default priority class if it exists. Otherwise,
|
||||
// pod groups created from this template will have the priority set to zero.
|
||||
// This field is available only when the WorkloadAwarePreemption feature gate
|
||||
// is enabled.
|
||||
PriorityClassName *string `json:"priorityClassName,omitempty"`
|
||||
// Priority is the value of priority of pod groups created from this template. Various
|
||||
// system components use this field to find the priority of the pod group. When
|
||||
// Priority Admission Controller is enabled, it prevents users from setting this field.
|
||||
// The admission controller populates this field from PriorityClassName.
|
||||
// The higher the value, the higher the priority.
|
||||
// This field is available only when the WorkloadAwarePreemption feature gate
|
||||
// is enabled.
|
||||
Priority *int32 `json:"priority,omitempty"`
|
||||
}
|
||||
|
||||
// PodGroupTemplateApplyConfiguration constructs a declarative configuration of the PodGroupTemplate type for use with
|
||||
@@ -86,3 +110,27 @@ func (b *PodGroupTemplateApplyConfiguration) WithResourceClaims(values ...*PodGr
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDisruptionMode sets the DisruptionMode 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 DisruptionMode field is set to the value of the last call.
|
||||
func (b *PodGroupTemplateApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupTemplateApplyConfiguration {
|
||||
b.DisruptionMode = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPriorityClassName sets the PriorityClassName 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 PriorityClassName field is set to the value of the last call.
|
||||
func (b *PodGroupTemplateApplyConfiguration) WithPriorityClassName(value string) *PodGroupTemplateApplyConfiguration {
|
||||
b.PriorityClassName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPriority sets the Priority 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 Priority field is set to the value of the last call.
|
||||
func (b *PodGroupTemplateApplyConfiguration) WithPriority(value int32) *PodGroupTemplateApplyConfiguration {
|
||||
b.Priority = &value
|
||||
return b
|
||||
}
|
||||
|
||||
6
go.mod
6
go.mod
@@ -23,11 +23,11 @@ require (
|
||||
golang.org/x/time v0.14.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-20260323181217-f8fce2ea6d49
|
||||
k8s.io/apimachinery v0.0.0-20260319035426-a76ee7450772
|
||||
k8s.io/api v0.0.0-20260324094416-91061ea648b7
|
||||
k8s.io/apimachinery v0.0.0-20260409182412-79b363268543
|
||||
k8s.io/klog/v2 v2.140.0
|
||||
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a
|
||||
k8s.io/streaming v0.0.0-20260317070603-951b6bf67777
|
||||
k8s.io/streaming v0.0.0-20260409181516-ff6889be5347
|
||||
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2
|
||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730
|
||||
sigs.k8s.io/randfill v1.0.0
|
||||
|
||||
12
go.sum
12
go.sum
@@ -105,16 +105,16 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
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-20260323181217-f8fce2ea6d49 h1:ZD+BmU96rwgzj9/HC2f4pX9+5s4t0ECB2oX0mafecNI=
|
||||
k8s.io/api v0.0.0-20260323181217-f8fce2ea6d49/go.mod h1:fj3AOwVJRH4zYT3LWoIZ4uKCWetMAIfelAD1pZFtdcw=
|
||||
k8s.io/apimachinery v0.0.0-20260319035426-a76ee7450772 h1:G8EM8vqSfIpITuNGsH/KVCiyELbL5Xe6tCRiJOWJuoU=
|
||||
k8s.io/apimachinery v0.0.0-20260319035426-a76ee7450772/go.mod h1:Fjag9BypDOzB4sV3iuZaNeDsRkf89asmbm8aWLerfeU=
|
||||
k8s.io/api v0.0.0-20260324094416-91061ea648b7 h1:CjC1wUoRaO79Ijr2EdUYsr9xfnTYiDwiLrIe6Zn33bw=
|
||||
k8s.io/api v0.0.0-20260324094416-91061ea648b7/go.mod h1:fj3AOwVJRH4zYT3LWoIZ4uKCWetMAIfelAD1pZFtdcw=
|
||||
k8s.io/apimachinery v0.0.0-20260409182412-79b363268543 h1:RvCzEK6Vy4ybi5sk1g8VUueHKL+L1tetaEkCgHJSHSM=
|
||||
k8s.io/apimachinery v0.0.0-20260409182412-79b363268543/go.mod h1:ScprwqlqUC4Ay7RkjkcWeQDj18u0xGIgqwGtnD8ZjPo=
|
||||
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-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hkbPJgdATINPMAxaynU2Ovg=
|
||||
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0=
|
||||
k8s.io/streaming v0.0.0-20260317070603-951b6bf67777 h1:EwFwvVp6vSJ41TUsv+DJx0UhkLnB8NizEcBJLgK/olU=
|
||||
k8s.io/streaming v0.0.0-20260317070603-951b6bf67777/go.mod h1:5Zm1U2Duu3uu1nG/ijKuwNWDkQk24aXVpScAhzRkzkk=
|
||||
k8s.io/streaming v0.0.0-20260409181516-ff6889be5347 h1:kRebECfasGEW70Zc8BT65RZGJoVqsAXf69v4+mcCazo=
|
||||
k8s.io/streaming v0.0.0-20260409181516-ff6889be5347/go.mod h1:5Zm1U2Duu3uu1nG/ijKuwNWDkQk24aXVpScAhzRkzkk=
|
||||
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU=
|
||||
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
|
||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
|
||||
|
||||
Reference in New Issue
Block a user