diff --git a/apis/kueue/v1beta1/workload_types.go b/apis/kueue/v1beta1/workload_types.go
index 9dfdc91863..7d9015aba9 100644
--- a/apis/kueue/v1beta1/workload_types.go
+++ b/apis/kueue/v1beta1/workload_types.go
@@ -52,6 +52,13 @@ type WorkloadSpec struct {
// The higher the value, the higher the priority.
// If priorityClassName is specified, priority must not be null.
Priority *int32 `json:"priority,omitempty"`
+
+ // priorityClassSource determines whether the priorityClass field refers to a pod PriorityClass or kueue.x-k8s.io/workloadpriorityclass.
+ // Workload's PriorityClass can accept the name of a pod priorityClass or a workloadPriorityClass.
+ // When using pod PriorityClass, a priorityClassSource field has the scheduling.k8s.io/priorityclass value.
+ // +kubebuilder:default=""
+ // +kubebuilder:validation:Enum=kueue.x-k8s.io/workloadpriorityclass;scheduling.k8s.io/priorityclass;""
+ PriorityClassSource string `json:"priorityClassSource,omitempty"`
}
type Admission struct {
diff --git a/apis/kueue/v1beta1/workloadpriorityclass_types.go b/apis/kueue/v1beta1/workloadpriorityclass_types.go
new file mode 100644
index 0000000000..6ada433788
--- /dev/null
+++ b/apis/kueue/v1beta1/workloadpriorityclass_types.go
@@ -0,0 +1,56 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package v1beta1
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+//+genclient
+//+kubebuilder:object:root=true
+//+kubebuilder:storageversion
+//+kubebuilder:resource:scope=Cluster
+//+kubebuilder:printcolumn:name="Value",JSONPath=".value",type=integer,description="Value of workloadPriorityClass's Priority"
+
+// WorkloadPriorityClass is the Schema for the workloadPriorityClass API
+type WorkloadPriorityClass struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ // value represents the integer value of this workloadPriorityClass. This is the actual priority that workloads
+ // receive when jobs have the name of this class in their workloadPriorityClass label.
+ // Changing the value of workloadPriorityClass doesn't affect the priority of workloads that were already created.
+ Value int32 `json:"value"`
+
+ // description is an arbitrary string that usually provides guidelines on
+ // when this workloadPriorityClass should be used.
+ // +optional
+ Description string `json:"description,omitempty"`
+}
+
+//+kubebuilder:object:root=true
+
+// WorkloadPriorityClassList contains a list of WorkloadPriorityClass
+type WorkloadPriorityClassList struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ListMeta `json:"metadata,omitempty"`
+ Items []WorkloadPriorityClass `json:"items"`
+}
+
+func init() {
+ SchemeBuilder.Register(&WorkloadPriorityClass{}, &WorkloadPriorityClassList{})
+}
diff --git a/apis/kueue/v1beta1/zz_generated.deepcopy.go b/apis/kueue/v1beta1/zz_generated.deepcopy.go
index ce250d0d02..a96d007518 100644
--- a/apis/kueue/v1beta1/zz_generated.deepcopy.go
+++ b/apis/kueue/v1beta1/zz_generated.deepcopy.go
@@ -810,6 +810,63 @@ func (in *WorkloadList) DeepCopyObject() runtime.Object {
return nil
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *WorkloadPriorityClass) DeepCopyInto(out *WorkloadPriorityClass) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPriorityClass.
+func (in *WorkloadPriorityClass) DeepCopy() *WorkloadPriorityClass {
+ if in == nil {
+ return nil
+ }
+ out := new(WorkloadPriorityClass)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *WorkloadPriorityClass) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *WorkloadPriorityClassList) DeepCopyInto(out *WorkloadPriorityClassList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]WorkloadPriorityClass, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPriorityClassList.
+func (in *WorkloadPriorityClassList) DeepCopy() *WorkloadPriorityClassList {
+ if in == nil {
+ return nil
+ }
+ out := new(WorkloadPriorityClassList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *WorkloadPriorityClassList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) {
*out = *in
diff --git a/charts/kueue/templates/crd/kueue.x-k8s.io_workloadpriorityclasses.yaml b/charts/kueue/templates/crd/kueue.x-k8s.io_workloadpriorityclasses.yaml
new file mode 100644
index 0000000000..afc43bd251
--- /dev/null
+++ b/charts/kueue/templates/crd/kueue.x-k8s.io_workloadpriorityclasses.yaml
@@ -0,0 +1,70 @@
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ {{- if .Values.enableCertManager }}
+ cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "kueue.fullname" . }}-serving-cert
+ {{- end }}
+ controller-gen.kubebuilder.io/version: v0.12.0
+ name: workloadpriorityclasses.kueue.x-k8s.io
+spec:
+ conversion:
+ strategy: Webhook
+ webhook:
+ clientConfig:
+ service:
+ name: {{ include "kueue.fullname" . }}-webhook-service
+ namespace: '{{ .Release.Namespace }}'
+ path: /convert
+ conversionReviewVersions:
+ - v1
+ group: kueue.x-k8s.io
+ names:
+ kind: WorkloadPriorityClass
+ listKind: WorkloadPriorityClassList
+ plural: workloadpriorityclasses
+ singular: workloadpriorityclass
+ scope: Cluster
+ versions:
+ - additionalPrinterColumns:
+ - description: Value of workloadPriorityClass's Priority
+ jsonPath: .value
+ name: Value
+ type: integer
+ name: v1beta1
+ schema:
+ openAPIV3Schema:
+ description: WorkloadPriorityClass is the Schema for the workloadPriorityClass
+ API
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
+ type: string
+ description:
+ description: description is an arbitrary string that usually provides
+ guidelines on when this workloadPriorityClass should be used.
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ value:
+ description: value represents the integer value of this workloadPriorityClass.
+ This is the actual priority that workloads receive when jobs have the
+ name of this class in their workloadPriorityClass label. Changing the
+ value of workloadPriorityClass doesn't affect the priority of workloads
+ that were already created.
+ format: int32
+ type: integer
+ required:
+ - value
+ type: object
+ served: true
+ storage: true
+ subresources: {}
diff --git a/charts/kueue/templates/crd/kueue.x-k8s.io_workloads.yaml b/charts/kueue/templates/crd/kueue.x-k8s.io_workloads.yaml
index 247f784760..bc33c5e284 100644
--- a/charts/kueue/templates/crd/kueue.x-k8s.io_workloads.yaml
+++ b/charts/kueue/templates/crd/kueue.x-k8s.io_workloads.yaml
@@ -8219,6 +8219,18 @@ spec:
with that name. If not specified, the workload priority will be
default or zero if there is no default.
type: string
+ priorityClassSource:
+ default: ""
+ description: priorityClassSource determines whether the priorityClass
+ field refers to a pod PriorityClass or kueue.x-k8s.io/workloadpriorityclass.
+ Workload's PriorityClass can accept the name of a pod priorityClass
+ or a workloadPriorityClass. When using pod PriorityClass, a priorityClassSource
+ field has the scheduling.k8s.io/priorityclass value.
+ enum:
+ - kueue.x-k8s.io/workloadpriorityclass
+ - scheduling.k8s.io/priorityclass
+ - ""
+ type: string
queueName:
description: queueName is the name of the LocalQueue the Workload
is associated with. queueName cannot be changed while .status.admission
diff --git a/charts/kueue/templates/rbac/role.yaml b/charts/kueue/templates/rbac/role.yaml
index 6ce2b1ba46..14d9316bf0 100644
--- a/charts/kueue/templates/rbac/role.yaml
+++ b/charts/kueue/templates/rbac/role.yaml
@@ -276,6 +276,14 @@ rules:
- resourceflavors/finalizers
verbs:
- update
+ - apiGroups:
+ - kueue.x-k8s.io
+ resources:
+ - workloadpriorityclasses
+ verbs:
+ - get
+ - list
+ - watch
- apiGroups:
- kueue.x-k8s.io
resources:
diff --git a/client-go/applyconfiguration/kueue/v1beta1/workloadpriorityclass.go b/client-go/applyconfiguration/kueue/v1beta1/workloadpriorityclass.go
new file mode 100644
index 0000000000..f907810c96
--- /dev/null
+++ b/client-go/applyconfiguration/kueue/v1beta1/workloadpriorityclass.go
@@ -0,0 +1,218 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1beta1
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ v1 "k8s.io/client-go/applyconfigurations/meta/v1"
+)
+
+// WorkloadPriorityClassApplyConfiguration represents an declarative configuration of the WorkloadPriorityClass type for use
+// with apply.
+type WorkloadPriorityClassApplyConfiguration struct {
+ v1.TypeMetaApplyConfiguration `json:",inline"`
+ *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
+ Value *int32 `json:"value,omitempty"`
+ Description *string `json:"description,omitempty"`
+}
+
+// WorkloadPriorityClass constructs an declarative configuration of the WorkloadPriorityClass type for use with
+// apply.
+func WorkloadPriorityClass(name, namespace string) *WorkloadPriorityClassApplyConfiguration {
+ b := &WorkloadPriorityClassApplyConfiguration{}
+ b.WithName(name)
+ b.WithNamespace(namespace)
+ b.WithKind("WorkloadPriorityClass")
+ b.WithAPIVersion("kueue.x-k8s.io/v1beta1")
+ return b
+}
+
+// WithKind sets the Kind 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 Kind field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithKind(value string) *WorkloadPriorityClassApplyConfiguration {
+ b.Kind = &value
+ return b
+}
+
+// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithAPIVersion(value string) *WorkloadPriorityClassApplyConfiguration {
+ b.APIVersion = &value
+ return b
+}
+
+// WithName sets the Name 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 Name field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithName(value string) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.Name = &value
+ return b
+}
+
+// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithGenerateName(value string) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.GenerateName = &value
+ return b
+}
+
+// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithNamespace(value string) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.Namespace = &value
+ return b
+}
+
+// WithUID sets the UID 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 UID field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithUID(value types.UID) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.UID = &value
+ return b
+}
+
+// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithResourceVersion(value string) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ResourceVersion = &value
+ return b
+}
+
+// WithGeneration sets the Generation 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 Generation field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithGeneration(value int64) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.Generation = &value
+ return b
+}
+
+// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.CreationTimestamp = &value
+ return b
+}
+
+// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.DeletionTimestamp = &value
+ return b
+}
+
+// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.DeletionGracePeriodSeconds = &value
+ return b
+}
+
+// WithLabels puts the entries into the Labels field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the Labels field,
+// overwriting an existing map entries in Labels field with the same key.
+func (b *WorkloadPriorityClassApplyConfiguration) WithLabels(entries map[string]string) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ if b.Labels == nil && len(entries) > 0 {
+ b.Labels = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.Labels[k] = v
+ }
+ return b
+}
+
+// WithAnnotations puts the entries into the Annotations field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the Annotations field,
+// overwriting an existing map entries in Annotations field with the same key.
+func (b *WorkloadPriorityClassApplyConfiguration) WithAnnotations(entries map[string]string) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ if b.Annotations == nil && len(entries) > 0 {
+ b.Annotations = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.Annotations[k] = v
+ }
+ return b
+}
+
+// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
+func (b *WorkloadPriorityClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ for i := range values {
+ if values[i] == nil {
+ panic("nil value passed to WithOwnerReferences")
+ }
+ b.OwnerReferences = append(b.OwnerReferences, *values[i])
+ }
+ return b
+}
+
+// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, values provided by each call will be appended to the Finalizers field.
+func (b *WorkloadPriorityClassApplyConfiguration) WithFinalizers(values ...string) *WorkloadPriorityClassApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ for i := range values {
+ b.Finalizers = append(b.Finalizers, values[i])
+ }
+ return b
+}
+
+func (b *WorkloadPriorityClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
+ if b.ObjectMetaApplyConfiguration == nil {
+ b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
+ }
+}
+
+// WithValue sets the Value 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 Value field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithValue(value int32) *WorkloadPriorityClassApplyConfiguration {
+ b.Value = &value
+ return b
+}
+
+// WithDescription sets the Description 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 Description field is set to the value of the last call.
+func (b *WorkloadPriorityClassApplyConfiguration) WithDescription(value string) *WorkloadPriorityClassApplyConfiguration {
+ b.Description = &value
+ return b
+}
diff --git a/client-go/applyconfiguration/kueue/v1beta1/workloadspec.go b/client-go/applyconfiguration/kueue/v1beta1/workloadspec.go
index 0b79dced99..04a855b67c 100644
--- a/client-go/applyconfiguration/kueue/v1beta1/workloadspec.go
+++ b/client-go/applyconfiguration/kueue/v1beta1/workloadspec.go
@@ -20,10 +20,11 @@ package v1beta1
// WorkloadSpecApplyConfiguration represents an declarative configuration of the WorkloadSpec type for use
// with apply.
type WorkloadSpecApplyConfiguration struct {
- PodSets []PodSetApplyConfiguration `json:"podSets,omitempty"`
- QueueName *string `json:"queueName,omitempty"`
- PriorityClassName *string `json:"priorityClassName,omitempty"`
- Priority *int32 `json:"priority,omitempty"`
+ PodSets []PodSetApplyConfiguration `json:"podSets,omitempty"`
+ QueueName *string `json:"queueName,omitempty"`
+ PriorityClassName *string `json:"priorityClassName,omitempty"`
+ Priority *int32 `json:"priority,omitempty"`
+ PriorityClassSource *string `json:"priorityClassSource,omitempty"`
}
// WorkloadSpecApplyConfiguration constructs an declarative configuration of the WorkloadSpec type for use with
@@ -68,3 +69,11 @@ func (b *WorkloadSpecApplyConfiguration) WithPriority(value int32) *WorkloadSpec
b.Priority = &value
return b
}
+
+// WithPriorityClassSource sets the PriorityClassSource 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 PriorityClassSource field is set to the value of the last call.
+func (b *WorkloadSpecApplyConfiguration) WithPriorityClassSource(value string) *WorkloadSpecApplyConfiguration {
+ b.PriorityClassSource = &value
+ return b
+}
diff --git a/client-go/applyconfiguration/utils.go b/client-go/applyconfiguration/utils.go
index 3e87f4e194..a9bc8d9115 100644
--- a/client-go/applyconfiguration/utils.go
+++ b/client-go/applyconfiguration/utils.go
@@ -80,6 +80,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &kueuev1beta1.ResourceUsageApplyConfiguration{}
case v1beta1.SchemeGroupVersion.WithKind("Workload"):
return &kueuev1beta1.WorkloadApplyConfiguration{}
+ case v1beta1.SchemeGroupVersion.WithKind("WorkloadPriorityClass"):
+ return &kueuev1beta1.WorkloadPriorityClassApplyConfiguration{}
case v1beta1.SchemeGroupVersion.WithKind("WorkloadSpec"):
return &kueuev1beta1.WorkloadSpecApplyConfiguration{}
case v1beta1.SchemeGroupVersion.WithKind("WorkloadStatus"):
diff --git a/client-go/clientset/versioned/typed/kueue/v1beta1/fake/fake_kueue_client.go b/client-go/clientset/versioned/typed/kueue/v1beta1/fake/fake_kueue_client.go
index 25812aa3a4..77feac2d86 100644
--- a/client-go/clientset/versioned/typed/kueue/v1beta1/fake/fake_kueue_client.go
+++ b/client-go/clientset/versioned/typed/kueue/v1beta1/fake/fake_kueue_client.go
@@ -47,6 +47,10 @@ func (c *FakeKueueV1beta1) Workloads(namespace string) v1beta1.WorkloadInterface
return &FakeWorkloads{c, namespace}
}
+func (c *FakeKueueV1beta1) WorkloadPriorityClasses(namespace string) v1beta1.WorkloadPriorityClassInterface {
+ return &FakeWorkloadPriorityClasses{c, namespace}
+}
+
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeKueueV1beta1) RESTClient() rest.Interface {
diff --git a/client-go/clientset/versioned/typed/kueue/v1beta1/fake/fake_workloadpriorityclass.go b/client-go/clientset/versioned/typed/kueue/v1beta1/fake/fake_workloadpriorityclass.go
new file mode 100644
index 0000000000..a43d167dca
--- /dev/null
+++ b/client-go/clientset/versioned/typed/kueue/v1beta1/fake/fake_workloadpriorityclass.go
@@ -0,0 +1,153 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ "context"
+ json "encoding/json"
+ "fmt"
+
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ testing "k8s.io/client-go/testing"
+ v1beta1 "sigs.k8s.io/kueue/apis/kueue/v1beta1"
+ kueuev1beta1 "sigs.k8s.io/kueue/client-go/applyconfiguration/kueue/v1beta1"
+)
+
+// FakeWorkloadPriorityClasses implements WorkloadPriorityClassInterface
+type FakeWorkloadPriorityClasses struct {
+ Fake *FakeKueueV1beta1
+ ns string
+}
+
+var workloadpriorityclassesResource = v1beta1.SchemeGroupVersion.WithResource("workloadpriorityclasses")
+
+var workloadpriorityclassesKind = v1beta1.SchemeGroupVersion.WithKind("WorkloadPriorityClass")
+
+// Get takes name of the workloadPriorityClass, and returns the corresponding workloadPriorityClass object, and an error if there is any.
+func (c *FakeWorkloadPriorityClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(workloadpriorityclassesResource, c.ns, name), &v1beta1.WorkloadPriorityClass{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.WorkloadPriorityClass), err
+}
+
+// List takes label and field selectors, and returns the list of WorkloadPriorityClasses that match those selectors.
+func (c *FakeWorkloadPriorityClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.WorkloadPriorityClassList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(workloadpriorityclassesResource, workloadpriorityclassesKind, c.ns, opts), &v1beta1.WorkloadPriorityClassList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1beta1.WorkloadPriorityClassList{ListMeta: obj.(*v1beta1.WorkloadPriorityClassList).ListMeta}
+ for _, item := range obj.(*v1beta1.WorkloadPriorityClassList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested workloadPriorityClasses.
+func (c *FakeWorkloadPriorityClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(workloadpriorityclassesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a workloadPriorityClass and creates it. Returns the server's representation of the workloadPriorityClass, and an error, if there is any.
+func (c *FakeWorkloadPriorityClasses) Create(ctx context.Context, workloadPriorityClass *v1beta1.WorkloadPriorityClass, opts v1.CreateOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(workloadpriorityclassesResource, c.ns, workloadPriorityClass), &v1beta1.WorkloadPriorityClass{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.WorkloadPriorityClass), err
+}
+
+// Update takes the representation of a workloadPriorityClass and updates it. Returns the server's representation of the workloadPriorityClass, and an error, if there is any.
+func (c *FakeWorkloadPriorityClasses) Update(ctx context.Context, workloadPriorityClass *v1beta1.WorkloadPriorityClass, opts v1.UpdateOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(workloadpriorityclassesResource, c.ns, workloadPriorityClass), &v1beta1.WorkloadPriorityClass{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.WorkloadPriorityClass), err
+}
+
+// Delete takes name of the workloadPriorityClass and deletes it. Returns an error if one occurs.
+func (c *FakeWorkloadPriorityClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteActionWithOptions(workloadpriorityclassesResource, c.ns, name, opts), &v1beta1.WorkloadPriorityClass{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeWorkloadPriorityClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(workloadpriorityclassesResource, c.ns, listOpts)
+
+ _, err := c.Fake.Invokes(action, &v1beta1.WorkloadPriorityClassList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched workloadPriorityClass.
+func (c *FakeWorkloadPriorityClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.WorkloadPriorityClass, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(workloadpriorityclassesResource, c.ns, name, pt, data, subresources...), &v1beta1.WorkloadPriorityClass{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.WorkloadPriorityClass), err
+}
+
+// Apply takes the given apply declarative configuration, applies it and returns the applied workloadPriorityClass.
+func (c *FakeWorkloadPriorityClasses) Apply(ctx context.Context, workloadPriorityClass *kueuev1beta1.WorkloadPriorityClassApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ if workloadPriorityClass == nil {
+ return nil, fmt.Errorf("workloadPriorityClass provided to Apply must not be nil")
+ }
+ data, err := json.Marshal(workloadPriorityClass)
+ if err != nil {
+ return nil, err
+ }
+ name := workloadPriorityClass.Name
+ if name == nil {
+ return nil, fmt.Errorf("workloadPriorityClass.Name must be provided to Apply")
+ }
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(workloadpriorityclassesResource, c.ns, *name, types.ApplyPatchType, data), &v1beta1.WorkloadPriorityClass{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1beta1.WorkloadPriorityClass), err
+}
diff --git a/client-go/clientset/versioned/typed/kueue/v1beta1/generated_expansion.go b/client-go/clientset/versioned/typed/kueue/v1beta1/generated_expansion.go
index 42a83adeeb..6c657129a4 100644
--- a/client-go/clientset/versioned/typed/kueue/v1beta1/generated_expansion.go
+++ b/client-go/clientset/versioned/typed/kueue/v1beta1/generated_expansion.go
@@ -26,3 +26,5 @@ type LocalQueueExpansion interface{}
type ResourceFlavorExpansion interface{}
type WorkloadExpansion interface{}
+
+type WorkloadPriorityClassExpansion interface{}
diff --git a/client-go/clientset/versioned/typed/kueue/v1beta1/kueue_client.go b/client-go/clientset/versioned/typed/kueue/v1beta1/kueue_client.go
index 46de80b5fe..5508acf275 100644
--- a/client-go/clientset/versioned/typed/kueue/v1beta1/kueue_client.go
+++ b/client-go/clientset/versioned/typed/kueue/v1beta1/kueue_client.go
@@ -32,6 +32,7 @@ type KueueV1beta1Interface interface {
LocalQueuesGetter
ResourceFlavorsGetter
WorkloadsGetter
+ WorkloadPriorityClassesGetter
}
// KueueV1beta1Client is used to interact with features provided by the kueue.x-k8s.io group.
@@ -59,6 +60,10 @@ func (c *KueueV1beta1Client) Workloads(namespace string) WorkloadInterface {
return newWorkloads(c, namespace)
}
+func (c *KueueV1beta1Client) WorkloadPriorityClasses(namespace string) WorkloadPriorityClassInterface {
+ return newWorkloadPriorityClasses(c, namespace)
+}
+
// NewForConfig creates a new KueueV1beta1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
diff --git a/client-go/clientset/versioned/typed/kueue/v1beta1/workloadpriorityclass.go b/client-go/clientset/versioned/typed/kueue/v1beta1/workloadpriorityclass.go
new file mode 100644
index 0000000000..3eff9f33e8
--- /dev/null
+++ b/client-go/clientset/versioned/typed/kueue/v1beta1/workloadpriorityclass.go
@@ -0,0 +1,207 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+// Code generated by client-gen. DO NOT EDIT.
+
+package v1beta1
+
+import (
+ "context"
+ json "encoding/json"
+ "fmt"
+ "time"
+
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ rest "k8s.io/client-go/rest"
+ v1beta1 "sigs.k8s.io/kueue/apis/kueue/v1beta1"
+ kueuev1beta1 "sigs.k8s.io/kueue/client-go/applyconfiguration/kueue/v1beta1"
+ scheme "sigs.k8s.io/kueue/client-go/clientset/versioned/scheme"
+)
+
+// WorkloadPriorityClassesGetter has a method to return a WorkloadPriorityClassInterface.
+// A group's client should implement this interface.
+type WorkloadPriorityClassesGetter interface {
+ WorkloadPriorityClasses(namespace string) WorkloadPriorityClassInterface
+}
+
+// WorkloadPriorityClassInterface has methods to work with WorkloadPriorityClass resources.
+type WorkloadPriorityClassInterface interface {
+ Create(ctx context.Context, workloadPriorityClass *v1beta1.WorkloadPriorityClass, opts v1.CreateOptions) (*v1beta1.WorkloadPriorityClass, error)
+ Update(ctx context.Context, workloadPriorityClass *v1beta1.WorkloadPriorityClass, opts v1.UpdateOptions) (*v1beta1.WorkloadPriorityClass, error)
+ Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
+ DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
+ Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.WorkloadPriorityClass, error)
+ List(ctx context.Context, opts v1.ListOptions) (*v1beta1.WorkloadPriorityClassList, error)
+ Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.WorkloadPriorityClass, err error)
+ Apply(ctx context.Context, workloadPriorityClass *kueuev1beta1.WorkloadPriorityClassApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.WorkloadPriorityClass, err error)
+ WorkloadPriorityClassExpansion
+}
+
+// workloadPriorityClasses implements WorkloadPriorityClassInterface
+type workloadPriorityClasses struct {
+ client rest.Interface
+ ns string
+}
+
+// newWorkloadPriorityClasses returns a WorkloadPriorityClasses
+func newWorkloadPriorityClasses(c *KueueV1beta1Client, namespace string) *workloadPriorityClasses {
+ return &workloadPriorityClasses{
+ client: c.RESTClient(),
+ ns: namespace,
+ }
+}
+
+// Get takes name of the workloadPriorityClass, and returns the corresponding workloadPriorityClass object, and an error if there is any.
+func (c *workloadPriorityClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ result = &v1beta1.WorkloadPriorityClass{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ Name(name).
+ VersionedParams(&options, scheme.ParameterCodec).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// List takes label and field selectors, and returns the list of WorkloadPriorityClasses that match those selectors.
+func (c *workloadPriorityClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.WorkloadPriorityClassList, err error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ result = &v1beta1.WorkloadPriorityClassList{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Watch returns a watch.Interface that watches the requested workloadPriorityClasses.
+func (c *workloadPriorityClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ opts.Watch = true
+ return c.client.Get().
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Watch(ctx)
+}
+
+// Create takes the representation of a workloadPriorityClass and creates it. Returns the server's representation of the workloadPriorityClass, and an error, if there is any.
+func (c *workloadPriorityClasses) Create(ctx context.Context, workloadPriorityClass *v1beta1.WorkloadPriorityClass, opts v1.CreateOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ result = &v1beta1.WorkloadPriorityClass{}
+ err = c.client.Post().
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(workloadPriorityClass).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Update takes the representation of a workloadPriorityClass and updates it. Returns the server's representation of the workloadPriorityClass, and an error, if there is any.
+func (c *workloadPriorityClasses) Update(ctx context.Context, workloadPriorityClass *v1beta1.WorkloadPriorityClass, opts v1.UpdateOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ result = &v1beta1.WorkloadPriorityClass{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ Name(workloadPriorityClass.Name).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(workloadPriorityClass).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Delete takes name of the workloadPriorityClass and deletes it. Returns an error if one occurs.
+func (c *workloadPriorityClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ Name(name).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *workloadPriorityClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ var timeout time.Duration
+ if listOpts.TimeoutSeconds != nil {
+ timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
+ }
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ VersionedParams(&listOpts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// Patch applies the patch and returns the patched workloadPriorityClass.
+func (c *workloadPriorityClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.WorkloadPriorityClass, err error) {
+ result = &v1beta1.WorkloadPriorityClass{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ Name(name).
+ SubResource(subresources...).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Apply takes the given apply declarative configuration, applies it and returns the applied workloadPriorityClass.
+func (c *workloadPriorityClasses) Apply(ctx context.Context, workloadPriorityClass *kueuev1beta1.WorkloadPriorityClassApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.WorkloadPriorityClass, err error) {
+ if workloadPriorityClass == nil {
+ return nil, fmt.Errorf("workloadPriorityClass provided to Apply must not be nil")
+ }
+ patchOpts := opts.ToPatchOptions()
+ data, err := json.Marshal(workloadPriorityClass)
+ if err != nil {
+ return nil, err
+ }
+ name := workloadPriorityClass.Name
+ if name == nil {
+ return nil, fmt.Errorf("workloadPriorityClass.Name must be provided to Apply")
+ }
+ result = &v1beta1.WorkloadPriorityClass{}
+ err = c.client.Patch(types.ApplyPatchType).
+ Namespace(c.ns).
+ Resource("workloadpriorityclasses").
+ Name(*name).
+ VersionedParams(&patchOpts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
diff --git a/client-go/informers/externalversions/generic.go b/client-go/informers/externalversions/generic.go
index bd5a885673..a95b2449e7 100644
--- a/client-go/informers/externalversions/generic.go
+++ b/client-go/informers/externalversions/generic.go
@@ -62,6 +62,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Kueue().V1beta1().ResourceFlavors().Informer()}, nil
case v1beta1.SchemeGroupVersion.WithResource("workloads"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kueue().V1beta1().Workloads().Informer()}, nil
+ case v1beta1.SchemeGroupVersion.WithResource("workloadpriorityclasses"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Kueue().V1beta1().WorkloadPriorityClasses().Informer()}, nil
}
diff --git a/client-go/informers/externalversions/kueue/v1beta1/interface.go b/client-go/informers/externalversions/kueue/v1beta1/interface.go
index 5660e648ff..3d9aab90a2 100644
--- a/client-go/informers/externalversions/kueue/v1beta1/interface.go
+++ b/client-go/informers/externalversions/kueue/v1beta1/interface.go
@@ -33,6 +33,8 @@ type Interface interface {
ResourceFlavors() ResourceFlavorInformer
// Workloads returns a WorkloadInformer.
Workloads() WorkloadInformer
+ // WorkloadPriorityClasses returns a WorkloadPriorityClassInformer.
+ WorkloadPriorityClasses() WorkloadPriorityClassInformer
}
type version struct {
@@ -70,3 +72,8 @@ func (v *version) ResourceFlavors() ResourceFlavorInformer {
func (v *version) Workloads() WorkloadInformer {
return &workloadInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
+
+// WorkloadPriorityClasses returns a WorkloadPriorityClassInformer.
+func (v *version) WorkloadPriorityClasses() WorkloadPriorityClassInformer {
+ return &workloadPriorityClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
diff --git a/client-go/informers/externalversions/kueue/v1beta1/workloadpriorityclass.go b/client-go/informers/externalversions/kueue/v1beta1/workloadpriorityclass.go
new file mode 100644
index 0000000000..791f1cf8a8
--- /dev/null
+++ b/client-go/informers/externalversions/kueue/v1beta1/workloadpriorityclass.go
@@ -0,0 +1,89 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+// Code generated by informer-gen. DO NOT EDIT.
+
+package v1beta1
+
+import (
+ "context"
+ time "time"
+
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ watch "k8s.io/apimachinery/pkg/watch"
+ cache "k8s.io/client-go/tools/cache"
+ kueuev1beta1 "sigs.k8s.io/kueue/apis/kueue/v1beta1"
+ versioned "sigs.k8s.io/kueue/client-go/clientset/versioned"
+ internalinterfaces "sigs.k8s.io/kueue/client-go/informers/externalversions/internalinterfaces"
+ v1beta1 "sigs.k8s.io/kueue/client-go/listers/kueue/v1beta1"
+)
+
+// WorkloadPriorityClassInformer provides access to a shared informer and lister for
+// WorkloadPriorityClasses.
+type WorkloadPriorityClassInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() v1beta1.WorkloadPriorityClassLister
+}
+
+type workloadPriorityClassInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewWorkloadPriorityClassInformer constructs a new informer for WorkloadPriorityClass type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewWorkloadPriorityClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredWorkloadPriorityClassInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredWorkloadPriorityClassInformer constructs a new informer for WorkloadPriorityClass type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredWorkloadPriorityClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
+ return cache.NewSharedIndexInformer(
+ &cache.ListWatch{
+ ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.KueueV1beta1().WorkloadPriorityClasses(namespace).List(context.TODO(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.KueueV1beta1().WorkloadPriorityClasses(namespace).Watch(context.TODO(), options)
+ },
+ },
+ &kueuev1beta1.WorkloadPriorityClass{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *workloadPriorityClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredWorkloadPriorityClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *workloadPriorityClassInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&kueuev1beta1.WorkloadPriorityClass{}, f.defaultInformer)
+}
+
+func (f *workloadPriorityClassInformer) Lister() v1beta1.WorkloadPriorityClassLister {
+ return v1beta1.NewWorkloadPriorityClassLister(f.Informer().GetIndexer())
+}
diff --git a/client-go/listers/kueue/v1beta1/expansion_generated.go b/client-go/listers/kueue/v1beta1/expansion_generated.go
index b509918b5c..d188f6970f 100644
--- a/client-go/listers/kueue/v1beta1/expansion_generated.go
+++ b/client-go/listers/kueue/v1beta1/expansion_generated.go
@@ -56,3 +56,11 @@ type WorkloadListerExpansion interface{}
// WorkloadNamespaceListerExpansion allows custom methods to be added to
// WorkloadNamespaceLister.
type WorkloadNamespaceListerExpansion interface{}
+
+// WorkloadPriorityClassListerExpansion allows custom methods to be added to
+// WorkloadPriorityClassLister.
+type WorkloadPriorityClassListerExpansion interface{}
+
+// WorkloadPriorityClassNamespaceListerExpansion allows custom methods to be added to
+// WorkloadPriorityClassNamespaceLister.
+type WorkloadPriorityClassNamespaceListerExpansion interface{}
diff --git a/client-go/listers/kueue/v1beta1/workloadpriorityclass.go b/client-go/listers/kueue/v1beta1/workloadpriorityclass.go
new file mode 100644
index 0000000000..44ad61389d
--- /dev/null
+++ b/client-go/listers/kueue/v1beta1/workloadpriorityclass.go
@@ -0,0 +1,98 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+// Code generated by lister-gen. DO NOT EDIT.
+
+package v1beta1
+
+import (
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/client-go/tools/cache"
+ v1beta1 "sigs.k8s.io/kueue/apis/kueue/v1beta1"
+)
+
+// WorkloadPriorityClassLister helps list WorkloadPriorityClasses.
+// All objects returned here must be treated as read-only.
+type WorkloadPriorityClassLister interface {
+ // List lists all WorkloadPriorityClasses in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1beta1.WorkloadPriorityClass, err error)
+ // WorkloadPriorityClasses returns an object that can list and get WorkloadPriorityClasses.
+ WorkloadPriorityClasses(namespace string) WorkloadPriorityClassNamespaceLister
+ WorkloadPriorityClassListerExpansion
+}
+
+// workloadPriorityClassLister implements the WorkloadPriorityClassLister interface.
+type workloadPriorityClassLister struct {
+ indexer cache.Indexer
+}
+
+// NewWorkloadPriorityClassLister returns a new WorkloadPriorityClassLister.
+func NewWorkloadPriorityClassLister(indexer cache.Indexer) WorkloadPriorityClassLister {
+ return &workloadPriorityClassLister{indexer: indexer}
+}
+
+// List lists all WorkloadPriorityClasses in the indexer.
+func (s *workloadPriorityClassLister) List(selector labels.Selector) (ret []*v1beta1.WorkloadPriorityClass, err error) {
+ err = cache.ListAll(s.indexer, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1beta1.WorkloadPriorityClass))
+ })
+ return ret, err
+}
+
+// WorkloadPriorityClasses returns an object that can list and get WorkloadPriorityClasses.
+func (s *workloadPriorityClassLister) WorkloadPriorityClasses(namespace string) WorkloadPriorityClassNamespaceLister {
+ return workloadPriorityClassNamespaceLister{indexer: s.indexer, namespace: namespace}
+}
+
+// WorkloadPriorityClassNamespaceLister helps list and get WorkloadPriorityClasses.
+// All objects returned here must be treated as read-only.
+type WorkloadPriorityClassNamespaceLister interface {
+ // List lists all WorkloadPriorityClasses in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1beta1.WorkloadPriorityClass, err error)
+ // Get retrieves the WorkloadPriorityClass from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*v1beta1.WorkloadPriorityClass, error)
+ WorkloadPriorityClassNamespaceListerExpansion
+}
+
+// workloadPriorityClassNamespaceLister implements the WorkloadPriorityClassNamespaceLister
+// interface.
+type workloadPriorityClassNamespaceLister struct {
+ indexer cache.Indexer
+ namespace string
+}
+
+// List lists all WorkloadPriorityClasses in the indexer for a given namespace.
+func (s workloadPriorityClassNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.WorkloadPriorityClass, err error) {
+ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1beta1.WorkloadPriorityClass))
+ })
+ return ret, err
+}
+
+// Get retrieves the WorkloadPriorityClass from the indexer for a given namespace and name.
+func (s workloadPriorityClassNamespaceLister) Get(name string) (*v1beta1.WorkloadPriorityClass, error) {
+ obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
+ if err != nil {
+ return nil, err
+ }
+ if !exists {
+ return nil, errors.NewNotFound(v1beta1.Resource("workloadpriorityclass"), name)
+ }
+ return obj.(*v1beta1.WorkloadPriorityClass), nil
+}
diff --git a/config/components/crd/bases/kueue.x-k8s.io_workloadpriorityclasses.yaml b/config/components/crd/bases/kueue.x-k8s.io_workloadpriorityclasses.yaml
new file mode 100644
index 0000000000..cc5eb21134
--- /dev/null
+++ b/config/components/crd/bases/kueue.x-k8s.io_workloadpriorityclasses.yaml
@@ -0,0 +1,57 @@
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ controller-gen.kubebuilder.io/version: v0.12.0
+ name: workloadpriorityclasses.kueue.x-k8s.io
+spec:
+ group: kueue.x-k8s.io
+ names:
+ kind: WorkloadPriorityClass
+ listKind: WorkloadPriorityClassList
+ plural: workloadpriorityclasses
+ singular: workloadpriorityclass
+ scope: Cluster
+ versions:
+ - additionalPrinterColumns:
+ - description: Value of workloadPriorityClass's Priority
+ jsonPath: .value
+ name: Value
+ type: integer
+ name: v1beta1
+ schema:
+ openAPIV3Schema:
+ description: WorkloadPriorityClass is the Schema for the workloadPriorityClass
+ API
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
+ type: string
+ description:
+ description: description is an arbitrary string that usually provides
+ guidelines on when this workloadPriorityClass should be used.
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ value:
+ description: value represents the integer value of this workloadPriorityClass.
+ This is the actual priority that workloads receive when jobs have the
+ name of this class in their workloadPriorityClass label. Changing the
+ value of workloadPriorityClass doesn't affect the priority of workloads
+ that were already created.
+ format: int32
+ type: integer
+ required:
+ - value
+ type: object
+ served: true
+ storage: true
+ subresources: {}
diff --git a/config/components/crd/bases/kueue.x-k8s.io_workloads.yaml b/config/components/crd/bases/kueue.x-k8s.io_workloads.yaml
index b58811a08f..ea74f65b4c 100644
--- a/config/components/crd/bases/kueue.x-k8s.io_workloads.yaml
+++ b/config/components/crd/bases/kueue.x-k8s.io_workloads.yaml
@@ -8206,6 +8206,18 @@ spec:
with that name. If not specified, the workload priority will be
default or zero if there is no default.
type: string
+ priorityClassSource:
+ default: ""
+ description: priorityClassSource determines whether the priorityClass
+ field refers to a pod PriorityClass or kueue.x-k8s.io/workloadpriorityclass.
+ Workload's PriorityClass can accept the name of a pod priorityClass
+ or a workloadPriorityClass. When using pod PriorityClass, a priorityClassSource
+ field has the scheduling.k8s.io/priorityclass value.
+ enum:
+ - kueue.x-k8s.io/workloadpriorityclass
+ - scheduling.k8s.io/priorityclass
+ - ""
+ type: string
queueName:
description: queueName is the name of the LocalQueue the Workload
is associated with. queueName cannot be changed while .status.admission
diff --git a/config/components/crd/kustomization.yaml b/config/components/crd/kustomization.yaml
index d6a5848986..e00ce224ba 100644
--- a/config/components/crd/kustomization.yaml
+++ b/config/components/crd/kustomization.yaml
@@ -7,6 +7,7 @@ resources:
- bases/kueue.x-k8s.io_workloads.yaml
- bases/kueue.x-k8s.io_resourceflavors.yaml
- bases/kueue.x-k8s.io_admissionchecks.yaml
+- bases/kueue.x-k8s.io_workloadpriorityclasses.yaml
#+kubebuilder:scaffold:crdkustomizeresource
patches:
diff --git a/config/components/rbac/role.yaml b/config/components/rbac/role.yaml
index 4307cfc4d8..9a6936ab66 100644
--- a/config/components/rbac/role.yaml
+++ b/config/components/rbac/role.yaml
@@ -277,6 +277,14 @@ rules:
- resourceflavors/finalizers
verbs:
- update
+- apiGroups:
+ - kueue.x-k8s.io
+ resources:
+ - workloadpriorityclasses
+ verbs:
+ - get
+ - list
+ - watch
- apiGroups:
- kueue.x-k8s.io
resources:
diff --git a/keps/973-workload-priority/README.md b/keps/973-workload-priority/README.md
index 2afac9d9d4..785f7ba8ee 100644
--- a/keps/973-workload-priority/README.md
+++ b/keps/973-workload-priority/README.md
@@ -21,10 +21,10 @@
- [4. A jobFramework specifies both workload's priority
and priorityClass
](#4-a-jobframework-specifies-both--and-)
- [5. A jobFramework specifies only workload's priority
](#5-a-jobframework-specifies-only-)
- [6. A jobFramework specifies only priorityClass
](#6-a-jobframework-specifies-only-)
- - [How to expand Priority utility](#how-to-expand-priority-utility)
- [Where workload's Priority is used](#where-workloads-priority-is-used)
- [Workload's priority values are always mutable](#workloads-priority-values-are-always-mutable)
- [What happens when a user changes the priority of workloadPriorityClass
?](#what-happens-when-a-user-changes-the-priority-of-)
+ - [Validation webhook](#validation-webhook)
- [Future works](#future-works)
- [Test Plan](#test-plan)
- [Unit Tests](#unit-tests)
@@ -40,7 +40,7 @@
In this proposal, a `WorkloadPriorityClass` is created.
The `Workload` is able to utilize `WorkloadPriorityClass`.
`WorkloadPriorityClass` is independent from pod's priority.
-The priority value is a part of the workload spec and is mutable.
+The priority value is a part of the workload spec. The priority field of workload is mutable.
In this document, the term `workload Priority` is used to refer
to the priority utilized by Kueue controller for managing the queueing
and preemption of workloads.
@@ -60,8 +60,8 @@ Users can modify the priority of a `Workload` by changing `Workload`'s priority
### Non-Goals
-Using existing k8s `PriorityClass` for Workload's priority is not recommended.
-`WorkloadPriorityClass` doesn't implement all the features of the k8s `PriorityClass`
+Using existing k8s Pod's `PriorityClass` for Workload's priority is not recommended.
+`WorkloadPriorityClass` doesn't implement all the features of the k8s Pod's `PriorityClass`
because some fields on the k8s `PriorityClass` are not relevant to Kueue.
When creating a new `WorkloadPriorityClass`, there is no need to create other CRDs owned by `WorkloadPriorityClass`. Therefore, the reconcile functionality is unnecessary. The `WorkloadPriorityClass` controller will not be implemented for now.
@@ -70,7 +70,9 @@ When creating a new `WorkloadPriorityClass`, there is no need to create other CR
In this proposal, `WorkloadPriorityClass` is defined.
The `Workload` is able to utilize this `WorkloadPriorityClass`.
`WorkloadPriorityClass` is independent from pod's priority.
-`Priority`, `PriorityClassName` and `PriorityClassSource` fields will be part of the workload spec and always be mutable.
+`Priority`, `PriorityClassName` and `PriorityClassSource` fields will be part of the workload spec.
+`Priority` field of `workload` is always mutable because it might be useful for the preemption.
+Workload's `PriorityClassSource` and `PriorityClassName` fields are immutable for simplicity.
JobFrameworks like Job, MPIJob etc specify the `WorkloadPriorityClass` through labels.