diff --git a/applyconfigurations/core/v1/podspec.go b/applyconfigurations/core/v1/podspec.go index 499848cef..1948c7131 100644 --- a/applyconfigurations/core/v1/podspec.go +++ b/applyconfigurations/core/v1/podspec.go @@ -273,6 +273,14 @@ type PodSpecApplyConfiguration struct { // This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. // Requires the HostnameOverride feature gate to be enabled. HostnameOverride *string `json:"hostnameOverride,omitempty"` + // WorkloadRef provides a reference to the Workload object that this Pod belongs to. + // This field is used by the scheduler to identify the PodGroup and apply the + // correct group scheduling policies. The Workload object referenced + // by this field may not exist at the time the Pod is created. + // This field is immutable, but a Workload object with the same name + // may be recreated with different policies. Doing this during pod scheduling + // may result in the placement not conforming to the expected policies. + WorkloadRef *WorkloadReferenceApplyConfiguration `json:"workloadRef,omitempty"` } // PodSpecApplyConfiguration constructs a declarative configuration of the PodSpec type for use with @@ -669,3 +677,11 @@ func (b *PodSpecApplyConfiguration) WithHostnameOverride(value string) *PodSpecA b.HostnameOverride = &value return b } + +// WithWorkloadRef sets the WorkloadRef 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 WorkloadRef field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithWorkloadRef(value *WorkloadReferenceApplyConfiguration) *PodSpecApplyConfiguration { + b.WorkloadRef = value + return b +} diff --git a/applyconfigurations/core/v1/workloadreference.go b/applyconfigurations/core/v1/workloadreference.go new file mode 100644 index 000000000..758c4517d --- /dev/null +++ b/applyconfigurations/core/v1/workloadreference.go @@ -0,0 +1,74 @@ +/* +Copyright 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 v1 + +// WorkloadReferenceApplyConfiguration represents a declarative configuration of the WorkloadReference type for use +// with apply. +// +// WorkloadReference identifies the Workload object and PodGroup membership +// that a Pod belongs to. The scheduler uses this information to apply +// workload-aware scheduling semantics. +type WorkloadReferenceApplyConfiguration struct { + // Name defines the name of the Workload object this Pod belongs to. + // Workload must be in the same namespace as the Pod. + // If it doesn't match any existing Workload, the Pod will remain unschedulable + // until a Workload object is created and observed by the kube-scheduler. + // It must be a DNS subdomain. + Name *string `json:"name,omitempty"` + // PodGroup is the name of the PodGroup within the Workload that this Pod + // belongs to. If it doesn't match any existing PodGroup within the Workload, + // the Pod will remain unschedulable until the Workload object is recreated + // and observed by the kube-scheduler. It must be a DNS label. + PodGroup *string `json:"podGroup,omitempty"` + // PodGroupReplicaKey specifies the replica key of the PodGroup to which this + // Pod belongs. It is used to distinguish pods belonging to different replicas + // of the same pod group. The pod group policy is applied separately to each replica. + // When set, it must be a DNS label. + PodGroupReplicaKey *string `json:"podGroupReplicaKey,omitempty"` +} + +// WorkloadReferenceApplyConfiguration constructs a declarative configuration of the WorkloadReference type for use with +// apply. +func WorkloadReference() *WorkloadReferenceApplyConfiguration { + return &WorkloadReferenceApplyConfiguration{} +} + +// 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 *WorkloadReferenceApplyConfiguration) WithName(value string) *WorkloadReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithPodGroup sets the PodGroup 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 PodGroup field is set to the value of the last call. +func (b *WorkloadReferenceApplyConfiguration) WithPodGroup(value string) *WorkloadReferenceApplyConfiguration { + b.PodGroup = &value + return b +} + +// WithPodGroupReplicaKey sets the PodGroupReplicaKey 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 PodGroupReplicaKey field is set to the value of the last call. +func (b *WorkloadReferenceApplyConfiguration) WithPodGroupReplicaKey(value string) *WorkloadReferenceApplyConfiguration { + b.PodGroupReplicaKey = &value + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index d70732e6d..aa780e7b3 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -7649,6 +7649,9 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name + - name: workloadRef + type: + namedType: io.k8s.api.core.v1.WorkloadReference - name: io.k8s.api.core.v1.PodStatus map: fields: @@ -9023,6 +9026,20 @@ var schemaYAML = typed.YAMLObject(`types: - name: runAsUserName type: scalar: string +- name: io.k8s.api.core.v1.WorkloadReference + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: podGroup + type: + scalar: string + default: "" + - name: podGroupReplicaKey + type: + scalar: string - name: io.k8s.api.discovery.v1.Endpoint map: fields: @@ -14943,6 +14960,45 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: numeric default: 0 +- name: io.k8s.api.scheduling.v1alpha1.BasicSchedulingPolicy + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha1.GangSchedulingPolicy + map: + fields: + - name: minCount + type: + scalar: numeric + default: 0 +- name: io.k8s.api.scheduling.v1alpha1.PodGroup + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: policy + type: + namedType: io.k8s.api.scheduling.v1alpha1.PodGroupPolicy + default: {} +- name: io.k8s.api.scheduling.v1alpha1.PodGroupPolicy + map: + fields: + - name: basic + type: + namedType: io.k8s.api.scheduling.v1alpha1.BasicSchedulingPolicy + - name: gang + type: + namedType: io.k8s.api.scheduling.v1alpha1.GangSchedulingPolicy - name: io.k8s.api.scheduling.v1alpha1.PriorityClass map: fields: @@ -14969,6 +15025,51 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: numeric default: 0 +- name: io.k8s.api.scheduling.v1alpha1.TypedLocalObjectReference + map: + fields: + - name: apiGroup + type: + scalar: string + - name: kind + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" +- name: io.k8s.api.scheduling.v1alpha1.Workload + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.scheduling.v1alpha1.WorkloadSpec + default: {} +- name: io.k8s.api.scheduling.v1alpha1.WorkloadSpec + map: + fields: + - name: controllerRef + type: + namedType: io.k8s.api.scheduling.v1alpha1.TypedLocalObjectReference + - name: podGroups + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha1.PodGroup + elementRelationship: associative + keys: + - name - name: io.k8s.api.scheduling.v1beta1.PriorityClass map: fields: diff --git a/applyconfigurations/scheduling/v1alpha1/gangschedulingpolicy.go b/applyconfigurations/scheduling/v1alpha1/gangschedulingpolicy.go new file mode 100644 index 000000000..6bf41585c --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha1/gangschedulingpolicy.go @@ -0,0 +1,44 @@ +/* +Copyright 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 v1alpha1 + +// GangSchedulingPolicyApplyConfiguration represents a declarative configuration of the GangSchedulingPolicy type for use +// with apply. +// +// GangSchedulingPolicy defines the parameters for gang scheduling. +type GangSchedulingPolicyApplyConfiguration struct { + // MinCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + MinCount *int32 `json:"minCount,omitempty"` +} + +// GangSchedulingPolicyApplyConfiguration constructs a declarative configuration of the GangSchedulingPolicy type for use with +// apply. +func GangSchedulingPolicy() *GangSchedulingPolicyApplyConfiguration { + return &GangSchedulingPolicyApplyConfiguration{} +} + +// WithMinCount sets the MinCount 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 MinCount field is set to the value of the last call. +func (b *GangSchedulingPolicyApplyConfiguration) WithMinCount(value int32) *GangSchedulingPolicyApplyConfiguration { + b.MinCount = &value + return b +} diff --git a/applyconfigurations/scheduling/v1alpha1/podgroup.go b/applyconfigurations/scheduling/v1alpha1/podgroup.go new file mode 100644 index 000000000..b1ce26179 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha1/podgroup.go @@ -0,0 +1,53 @@ +/* +Copyright 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 v1alpha1 + +// PodGroupApplyConfiguration represents a declarative configuration of the PodGroup type for use +// with apply. +// +// PodGroup represents a set of pods with a common scheduling policy. +type PodGroupApplyConfiguration struct { + // Name is a unique identifier for the PodGroup within the Workload. + // It must be a DNS label. This field is immutable. + Name *string `json:"name,omitempty"` + // Policy defines the scheduling policy for this PodGroup. + Policy *PodGroupPolicyApplyConfiguration `json:"policy,omitempty"` +} + +// PodGroupApplyConfiguration constructs a declarative configuration of the PodGroup type for use with +// apply. +func PodGroup() *PodGroupApplyConfiguration { + return &PodGroupApplyConfiguration{} +} + +// 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 *PodGroupApplyConfiguration) WithName(value string) *PodGroupApplyConfiguration { + b.Name = &value + return b +} + +// WithPolicy sets the Policy 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 Policy field is set to the value of the last call. +func (b *PodGroupApplyConfiguration) WithPolicy(value *PodGroupPolicyApplyConfiguration) *PodGroupApplyConfiguration { + b.Policy = value + return b +} diff --git a/applyconfigurations/scheduling/v1alpha1/podgrouppolicy.go b/applyconfigurations/scheduling/v1alpha1/podgrouppolicy.go new file mode 100644 index 000000000..d73c5e440 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha1/podgrouppolicy.go @@ -0,0 +1,58 @@ +/* +Copyright 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 v1alpha1 + +import ( + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" +) + +// PodGroupPolicyApplyConfiguration represents a declarative configuration of the PodGroupPolicy type for use +// with apply. +// +// PodGroupPolicy defines the scheduling configuration for a PodGroup. +type PodGroupPolicyApplyConfiguration struct { + // Basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. + Basic *schedulingv1alpha1.BasicSchedulingPolicy `json:"basic,omitempty"` + // Gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. + Gang *GangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` +} + +// PodGroupPolicyApplyConfiguration constructs a declarative configuration of the PodGroupPolicy type for use with +// apply. +func PodGroupPolicy() *PodGroupPolicyApplyConfiguration { + return &PodGroupPolicyApplyConfiguration{} +} + +// WithBasic sets the Basic 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 Basic field is set to the value of the last call. +func (b *PodGroupPolicyApplyConfiguration) WithBasic(value schedulingv1alpha1.BasicSchedulingPolicy) *PodGroupPolicyApplyConfiguration { + b.Basic = &value + return b +} + +// WithGang sets the Gang 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 Gang field is set to the value of the last call. +func (b *PodGroupPolicyApplyConfiguration) WithGang(value *GangSchedulingPolicyApplyConfiguration) *PodGroupPolicyApplyConfiguration { + b.Gang = value + return b +} diff --git a/applyconfigurations/scheduling/v1alpha1/typedlocalobjectreference.go b/applyconfigurations/scheduling/v1alpha1/typedlocalobjectreference.go new file mode 100644 index 000000000..73c11c884 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha1/typedlocalobjectreference.go @@ -0,0 +1,67 @@ +/* +Copyright 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 v1alpha1 + +// TypedLocalObjectReferenceApplyConfiguration represents a declarative configuration of the TypedLocalObjectReference type for use +// with apply. +// +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +type TypedLocalObjectReferenceApplyConfiguration struct { + // APIGroup is the group for the resource being referenced. + // If APIGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting APIGroup is required. + // It must be a DNS subdomain. + APIGroup *string `json:"apiGroup,omitempty"` + // Kind is the type of resource being referenced. + // It must be a path segment name. + Kind *string `json:"kind,omitempty"` + // Name is the name of resource being referenced. + // It must be a path segment name. + Name *string `json:"name,omitempty"` +} + +// TypedLocalObjectReferenceApplyConfiguration constructs a declarative configuration of the TypedLocalObjectReference type for use with +// apply. +func TypedLocalObjectReference() *TypedLocalObjectReferenceApplyConfiguration { + return &TypedLocalObjectReferenceApplyConfiguration{} +} + +// WithAPIGroup sets the APIGroup 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 APIGroup field is set to the value of the last call. +func (b *TypedLocalObjectReferenceApplyConfiguration) WithAPIGroup(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.APIGroup = &value + 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 *TypedLocalObjectReferenceApplyConfiguration) WithKind(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.Kind = &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 *TypedLocalObjectReferenceApplyConfiguration) WithName(value string) *TypedLocalObjectReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/applyconfigurations/scheduling/v1alpha1/workload.go b/applyconfigurations/scheduling/v1alpha1/workload.go new file mode 100644 index 000000000..6530899ae --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha1/workload.go @@ -0,0 +1,279 @@ +/* +Copyright 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 v1alpha1 + +import ( + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// WorkloadApplyConfiguration represents a declarative configuration of the Workload type for use +// with apply. +// +// Workload allows for expressing scheduling constraints that should be used +// when managing lifecycle of workloads from scheduling perspective, +// including scheduling, preemption, eviction and other phases. +type WorkloadApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // Standard object's metadata. + // Name must be a DNS subdomain. + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // Spec defines the desired behavior of a Workload. + Spec *WorkloadSpecApplyConfiguration `json:"spec,omitempty"` +} + +// Workload constructs a declarative configuration of the Workload type for use with +// apply. +func Workload(name, namespace string) *WorkloadApplyConfiguration { + b := &WorkloadApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Workload") + b.WithAPIVersion("scheduling.k8s.io/v1alpha1") + return b +} + +// ExtractWorkloadFrom extracts the applied configuration owned by fieldManager from +// workload for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// workload must be a unmodified Workload API object that was retrieved from the Kubernetes API. +// ExtractWorkloadFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractWorkloadFrom(workload *schedulingv1alpha1.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) { + b := &WorkloadApplyConfiguration{} + err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1alpha1.Workload"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(workload.Name) + b.WithNamespace(workload.Namespace) + + b.WithKind("Workload") + b.WithAPIVersion("scheduling.k8s.io/v1alpha1") + return b, nil +} + +// ExtractWorkload extracts the applied configuration owned by fieldManager from +// workload. If no managedFields are found in workload for fieldManager, a +// WorkloadApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// workload must be a unmodified Workload API object that was retrieved from the Kubernetes API. +// ExtractWorkload provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractWorkload(workload *schedulingv1alpha1.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) { + return ExtractWorkloadFrom(workload, fieldManager, "") +} + +func (b WorkloadApplyConfiguration) IsApplyConfiguration() {} + +// 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 *WorkloadApplyConfiguration) WithKind(value string) *WorkloadApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithAPIVersion(value string) *WorkloadApplyConfiguration { + b.TypeMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithName(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithGenerateName(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithNamespace(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithUID(value types.UID) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithResourceVersion(value string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithGeneration(value int64) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithCreationTimestamp(value metav1.Time) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithLabels(entries map[string]string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithAnnotations(entries map[string]string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.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 *WorkloadApplyConfiguration) WithFinalizers(values ...string) *WorkloadApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *WorkloadApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec 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 Spec field is set to the value of the last call. +func (b *WorkloadApplyConfiguration) WithSpec(value *WorkloadSpecApplyConfiguration) *WorkloadApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *WorkloadApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/applyconfigurations/scheduling/v1alpha1/workloadspec.go b/applyconfigurations/scheduling/v1alpha1/workloadspec.go new file mode 100644 index 000000000..1ceb9210d --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha1/workloadspec.go @@ -0,0 +1,61 @@ +/* +Copyright 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 v1alpha1 + +// WorkloadSpecApplyConfiguration represents a declarative configuration of the WorkloadSpec type for use +// with apply. +// +// WorkloadSpec defines the desired state of a Workload. +type WorkloadSpecApplyConfiguration struct { + // ControllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // When set, it cannot be changed. + ControllerRef *TypedLocalObjectReferenceApplyConfiguration `json:"controllerRef,omitempty"` + // PodGroups is the list of pod groups that make up the Workload. + // The maximum number of pod groups is 8. This field is immutable. + PodGroups []PodGroupApplyConfiguration `json:"podGroups,omitempty"` +} + +// WorkloadSpecApplyConfiguration constructs a declarative configuration of the WorkloadSpec type for use with +// apply. +func WorkloadSpec() *WorkloadSpecApplyConfiguration { + return &WorkloadSpecApplyConfiguration{} +} + +// WithControllerRef sets the ControllerRef 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 ControllerRef field is set to the value of the last call. +func (b *WorkloadSpecApplyConfiguration) WithControllerRef(value *TypedLocalObjectReferenceApplyConfiguration) *WorkloadSpecApplyConfiguration { + b.ControllerRef = value + return b +} + +// WithPodGroups adds the given value to the PodGroups 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 PodGroups field. +func (b *WorkloadSpecApplyConfiguration) WithPodGroups(values ...*PodGroupApplyConfiguration) *WorkloadSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodGroups") + } + b.PodGroups = append(b.PodGroups, *values[i]) + } + return b +} diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index f88a4a96a..ef6f16e83 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -1084,6 +1084,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.WeightedPodAffinityTermApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("WindowsSecurityContextOptions"): return &applyconfigurationscorev1.WindowsSecurityContextOptionsApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("WorkloadReference"): + return &applyconfigurationscorev1.WorkloadReferenceApplyConfiguration{} // Group=discovery.k8s.io, Version=v1 case discoveryv1.SchemeGroupVersion.WithKind("Endpoint"): @@ -1886,8 +1888,20 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsschedulingv1.PriorityClassApplyConfiguration{} // Group=scheduling.k8s.io, Version=v1alpha1 + case schedulingv1alpha1.SchemeGroupVersion.WithKind("GangSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha1.GangSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha1.SchemeGroupVersion.WithKind("PodGroup"): + return &applyconfigurationsschedulingv1alpha1.PodGroupApplyConfiguration{} + case schedulingv1alpha1.SchemeGroupVersion.WithKind("PodGroupPolicy"): + return &applyconfigurationsschedulingv1alpha1.PodGroupPolicyApplyConfiguration{} case schedulingv1alpha1.SchemeGroupVersion.WithKind("PriorityClass"): return &applyconfigurationsschedulingv1alpha1.PriorityClassApplyConfiguration{} + case schedulingv1alpha1.SchemeGroupVersion.WithKind("TypedLocalObjectReference"): + return &applyconfigurationsschedulingv1alpha1.TypedLocalObjectReferenceApplyConfiguration{} + case schedulingv1alpha1.SchemeGroupVersion.WithKind("Workload"): + return &applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration{} + case schedulingv1alpha1.SchemeGroupVersion.WithKind("WorkloadSpec"): + return &applyconfigurationsschedulingv1alpha1.WorkloadSpecApplyConfiguration{} // Group=scheduling.k8s.io, Version=v1beta1 case schedulingv1beta1.SchemeGroupVersion.WithKind("PriorityClass"): diff --git a/informers/generic.go b/informers/generic.go index 4e9966f97..2b7efe7f4 100644 --- a/informers/generic.go +++ b/informers/generic.go @@ -426,6 +426,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=scheduling.k8s.io, Version=v1alpha1 case schedulingv1alpha1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PriorityClasses().Informer()}, nil + case schedulingv1alpha1.SchemeGroupVersion.WithResource("workloads"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().Workloads().Informer()}, nil // Group=scheduling.k8s.io, Version=v1beta1 case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): diff --git a/informers/scheduling/v1alpha1/interface.go b/informers/scheduling/v1alpha1/interface.go index cd908d14e..fdfc4e6af 100644 --- a/informers/scheduling/v1alpha1/interface.go +++ b/informers/scheduling/v1alpha1/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // PriorityClasses returns a PriorityClassInformer. PriorityClasses() PriorityClassInformer + // Workloads returns a WorkloadInformer. + Workloads() WorkloadInformer } type version struct { @@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (v *version) PriorityClasses() PriorityClassInformer { return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } + +// Workloads returns a WorkloadInformer. +func (v *version) Workloads() WorkloadInformer { + return &workloadInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/informers/scheduling/v1alpha1/workload.go b/informers/scheduling/v1alpha1/workload.go new file mode 100644 index 000000000..c58e78894 --- /dev/null +++ b/informers/scheduling/v1alpha1/workload.go @@ -0,0 +1,102 @@ +/* +Copyright 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 v1alpha1 + +import ( + context "context" + time "time" + + apischedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha1 "k8s.io/client-go/listers/scheduling/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// WorkloadInformer provides access to a shared informer and lister for +// Workloads. +type WorkloadInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1alpha1.WorkloadLister +} + +type workloadInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewWorkloadInformer constructs a new informer for Workload 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 NewWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredWorkloadInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredWorkloadInformer constructs a new informer for Workload 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 NewFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().Workloads(namespace).List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().Workloads(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().Workloads(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().Workloads(namespace).Watch(ctx, options) + }, + }, client), + &apischedulingv1alpha1.Workload{}, + resyncPeriod, + indexers, + ) +} + +func (f *workloadInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredWorkloadInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *workloadInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apischedulingv1alpha1.Workload{}, f.defaultInformer) +} + +func (f *workloadInformer) Lister() schedulingv1alpha1.WorkloadLister { + return schedulingv1alpha1.NewWorkloadLister(f.Informer().GetIndexer()) +} diff --git a/kubernetes/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go b/kubernetes/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go index 34e8ad9bd..2be141266 100644 --- a/kubernetes/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go +++ b/kubernetes/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go @@ -32,6 +32,10 @@ func (c *FakeSchedulingV1alpha1) PriorityClasses() v1alpha1.PriorityClassInterfa return newFakePriorityClasses(c) } +func (c *FakeSchedulingV1alpha1) Workloads(namespace string) v1alpha1.WorkloadInterface { + return newFakeWorkloads(c, namespace) +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeSchedulingV1alpha1) RESTClient() rest.Interface { diff --git a/kubernetes/typed/scheduling/v1alpha1/fake/fake_workload.go b/kubernetes/typed/scheduling/v1alpha1/fake/fake_workload.go new file mode 100644 index 000000000..06a48d24e --- /dev/null +++ b/kubernetes/typed/scheduling/v1alpha1/fake/fake_workload.go @@ -0,0 +1,51 @@ +/* +Copyright 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 ( + v1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" + gentype "k8s.io/client-go/gentype" + typedschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" +) + +// fakeWorkloads implements WorkloadInterface +type fakeWorkloads struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.Workload, *v1alpha1.WorkloadList, *schedulingv1alpha1.WorkloadApplyConfiguration] + Fake *FakeSchedulingV1alpha1 +} + +func newFakeWorkloads(fake *FakeSchedulingV1alpha1, namespace string) typedschedulingv1alpha1.WorkloadInterface { + return &fakeWorkloads{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.Workload, *v1alpha1.WorkloadList, *schedulingv1alpha1.WorkloadApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("workloads"), + v1alpha1.SchemeGroupVersion.WithKind("Workload"), + func() *v1alpha1.Workload { return &v1alpha1.Workload{} }, + func() *v1alpha1.WorkloadList { return &v1alpha1.WorkloadList{} }, + func(dst, src *v1alpha1.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.WorkloadList) []*v1alpha1.Workload { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.WorkloadList, items []*v1alpha1.Workload) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go b/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go index 52f81d881..24946041a 100644 --- a/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go +++ b/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go @@ -19,3 +19,5 @@ limitations under the License. package v1alpha1 type PriorityClassExpansion interface{} + +type WorkloadExpansion interface{} diff --git a/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go b/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go index b17b182f1..0c53bc368 100644 --- a/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go +++ b/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go @@ -29,6 +29,7 @@ import ( type SchedulingV1alpha1Interface interface { RESTClient() rest.Interface PriorityClassesGetter + WorkloadsGetter } // SchedulingV1alpha1Client is used to interact with features provided by the scheduling.k8s.io group. @@ -40,6 +41,10 @@ func (c *SchedulingV1alpha1Client) PriorityClasses() PriorityClassInterface { return newPriorityClasses(c) } +func (c *SchedulingV1alpha1Client) Workloads(namespace string) WorkloadInterface { + return newWorkloads(c, namespace) +} + // NewForConfig creates a new SchedulingV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/kubernetes/typed/scheduling/v1alpha1/workload.go b/kubernetes/typed/scheduling/v1alpha1/workload.go new file mode 100644 index 000000000..9c906b5e8 --- /dev/null +++ b/kubernetes/typed/scheduling/v1alpha1/workload.go @@ -0,0 +1,71 @@ +/* +Copyright 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 v1alpha1 + +import ( + context "context" + + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsschedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// WorkloadsGetter has a method to return a WorkloadInterface. +// A group's client should implement this interface. +type WorkloadsGetter interface { + Workloads(namespace string) WorkloadInterface +} + +// WorkloadInterface has methods to work with Workload resources. +type WorkloadInterface interface { + Create(ctx context.Context, workload *schedulingv1alpha1.Workload, opts v1.CreateOptions) (*schedulingv1alpha1.Workload, error) + Update(ctx context.Context, workload *schedulingv1alpha1.Workload, opts v1.UpdateOptions) (*schedulingv1alpha1.Workload, 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) (*schedulingv1alpha1.Workload, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha1.WorkloadList, 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 *schedulingv1alpha1.Workload, err error) + Apply(ctx context.Context, workload *applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha1.Workload, err error) + WorkloadExpansion +} + +// workloads implements WorkloadInterface +type workloads struct { + *gentype.ClientWithListAndApply[*schedulingv1alpha1.Workload, *schedulingv1alpha1.WorkloadList, *applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration] +} + +// newWorkloads returns a Workloads +func newWorkloads(c *SchedulingV1alpha1Client, namespace string) *workloads { + return &workloads{ + gentype.NewClientWithListAndApply[*schedulingv1alpha1.Workload, *schedulingv1alpha1.WorkloadList, *applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration]( + "workloads", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *schedulingv1alpha1.Workload { return &schedulingv1alpha1.Workload{} }, + func() *schedulingv1alpha1.WorkloadList { return &schedulingv1alpha1.WorkloadList{} }, + gentype.PrefersProtobuf[*schedulingv1alpha1.Workload](), + ), + } +} diff --git a/listers/scheduling/v1alpha1/expansion_generated.go b/listers/scheduling/v1alpha1/expansion_generated.go index bde8b6206..8617325d8 100644 --- a/listers/scheduling/v1alpha1/expansion_generated.go +++ b/listers/scheduling/v1alpha1/expansion_generated.go @@ -21,3 +21,11 @@ package v1alpha1 // PriorityClassListerExpansion allows custom methods to be added to // PriorityClassLister. type PriorityClassListerExpansion interface{} + +// WorkloadListerExpansion allows custom methods to be added to +// WorkloadLister. +type WorkloadListerExpansion interface{} + +// WorkloadNamespaceListerExpansion allows custom methods to be added to +// WorkloadNamespaceLister. +type WorkloadNamespaceListerExpansion interface{} diff --git a/listers/scheduling/v1alpha1/workload.go b/listers/scheduling/v1alpha1/workload.go new file mode 100644 index 000000000..24f51a5ef --- /dev/null +++ b/listers/scheduling/v1alpha1/workload.go @@ -0,0 +1,70 @@ +/* +Copyright 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 v1alpha1 + +import ( + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// WorkloadLister helps list Workloads. +// All objects returned here must be treated as read-only. +type WorkloadLister interface { + // List lists all Workloads in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha1.Workload, err error) + // Workloads returns an object that can list and get Workloads. + Workloads(namespace string) WorkloadNamespaceLister + WorkloadListerExpansion +} + +// workloadLister implements the WorkloadLister interface. +type workloadLister struct { + listers.ResourceIndexer[*schedulingv1alpha1.Workload] +} + +// NewWorkloadLister returns a new WorkloadLister. +func NewWorkloadLister(indexer cache.Indexer) WorkloadLister { + return &workloadLister{listers.New[*schedulingv1alpha1.Workload](indexer, schedulingv1alpha1.Resource("workload"))} +} + +// Workloads returns an object that can list and get Workloads. +func (s *workloadLister) Workloads(namespace string) WorkloadNamespaceLister { + return workloadNamespaceLister{listers.NewNamespaced[*schedulingv1alpha1.Workload](s.ResourceIndexer, namespace)} +} + +// WorkloadNamespaceLister helps list and get Workloads. +// All objects returned here must be treated as read-only. +type WorkloadNamespaceLister interface { + // List lists all Workloads in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha1.Workload, err error) + // Get retrieves the Workload from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*schedulingv1alpha1.Workload, error) + WorkloadNamespaceListerExpansion +} + +// workloadNamespaceLister implements the WorkloadNamespaceLister +// interface. +type workloadNamespaceLister struct { + listers.ResourceIndexer[*schedulingv1alpha1.Workload] +}