From 23bc0a25fbdcc21bd2ca1f6bfa6907498824b4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Dzikowski?= Date: Tue, 9 Jun 2026 13:47:59 +0000 Subject: [PATCH] feat: Implement CompositePodGroup API Co-authored-by: Antoni Zawodny Kubernetes-commit: cea3df3e5624e40ceb4aa0b4e309eaf0596675dd --- applyconfigurations/internal/internal.go | 129 ++++++++ .../v1alpha3/compositegangschedulingpolicy.go | 45 +++ .../scheduling/v1alpha3/compositepodgroup.go | 296 ++++++++++++++++++ .../compositepodgroupschedulingpolicy.go | 59 ++++ .../v1alpha3/compositepodgroupspec.go | 100 ++++++ .../v1alpha3/compositepodgroupstatus.go | 72 +++++ .../v1alpha3/compositepodgrouptemplate.go | 117 +++++++ .../scheduling/v1alpha3/podgroupspec.go | 14 + .../scheduling/v1alpha3/workloadspec.go | 20 ++ applyconfigurations/utils.go | 12 + informers/generic.go | 2 + .../scheduling/v1alpha3/compositepodgroup.go | 116 +++++++ informers/scheduling/v1alpha3/interface.go | 7 + .../scheduling/v1alpha3/compositepodgroup.go | 75 +++++ .../v1alpha3/fake/fake_compositepodgroup.go | 53 ++++ .../v1alpha3/fake/fake_scheduling_client.go | 4 + .../v1alpha3/generated_expansion.go | 2 + .../scheduling/v1alpha3/scheduling_client.go | 5 + .../scheduling/v1alpha3/compositepodgroup.go | 70 +++++ .../v1alpha3/expansion_generated.go | 8 + 20 files changed, 1206 insertions(+) create mode 100644 applyconfigurations/scheduling/v1alpha3/compositegangschedulingpolicy.go create mode 100644 applyconfigurations/scheduling/v1alpha3/compositepodgroup.go create mode 100644 applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingpolicy.go create mode 100644 applyconfigurations/scheduling/v1alpha3/compositepodgroupspec.go create mode 100644 applyconfigurations/scheduling/v1alpha3/compositepodgroupstatus.go create mode 100644 applyconfigurations/scheduling/v1alpha3/compositepodgrouptemplate.go create mode 100644 informers/scheduling/v1alpha3/compositepodgroup.go create mode 100644 kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go create mode 100644 kubernetes/typed/scheduling/v1alpha3/fake/fake_compositepodgroup.go create mode 100644 listers/scheduling/v1alpha3/compositepodgroup.go diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index e44150ec5..1c3f7e811 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -14792,6 +14792,124 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: __untyped_deduced_ elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.CompositeBasicSchedulingPolicy + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.api.scheduling.v1alpha3.CompositeGangSchedulingPolicy + map: + fields: + - name: minGroupCount + type: + scalar: numeric + default: 0 +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroup + 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.v1alpha3.CompositePodGroupSpec + default: {} + - name: status + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupStatus + default: {} +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingPolicy + map: + fields: + - name: basic + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositeBasicSchedulingPolicy + - name: gang + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositeGangSchedulingPolicy + unions: + - fields: + - fieldName: basic + discriminatorValue: Basic + - fieldName: gang + discriminatorValue: Gang +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSpec + map: + fields: + - name: parentCompositePodGroupName + type: + scalar: string + - name: priority + type: + scalar: numeric + - name: priorityClassName + type: + scalar: string + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingPolicy + default: {} + - name: workloadRef + type: + namedType: io.k8s.api.scheduling.v1alpha3.WorkloadReference +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type +- name: io.k8s.api.scheduling.v1alpha3.CompositePodGroupTemplate + map: + fields: + - name: compositePodGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupTemplate + elementRelationship: associative + keys: + - name + - name: name + type: + scalar: string + default: "" + - name: podGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.PodGroupTemplate + elementRelationship: associative + keys: + - name + - name: priority + type: + scalar: numeric + - name: priorityClassName + type: + scalar: string + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupSchedulingPolicy + default: {} - name: io.k8s.api.scheduling.v1alpha3.DisruptionMode map: fields: @@ -14890,6 +15008,9 @@ var schemaYAML = typed.YAMLObject(`types: namedType: io.k8s.api.scheduling.v1alpha3.DisruptionMode default: single: {} + - name: parentCompositePodGroupName + type: + scalar: string - name: preemptionPolicy type: scalar: string @@ -15034,6 +15155,14 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.scheduling.v1alpha3.WorkloadSpec map: fields: + - name: compositePodGroupTemplates + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha3.CompositePodGroupTemplate + elementRelationship: associative + keys: + - name - name: controllerRef type: namedType: io.k8s.api.scheduling.v1alpha3.TypedLocalObjectReference diff --git a/applyconfigurations/scheduling/v1alpha3/compositegangschedulingpolicy.go b/applyconfigurations/scheduling/v1alpha3/compositegangschedulingpolicy.go new file mode 100644 index 000000000..8a6ca89f2 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha3/compositegangschedulingpolicy.go @@ -0,0 +1,45 @@ +/* +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 v1alpha3 + +// CompositeGangSchedulingPolicyApplyConfiguration represents a declarative configuration of the CompositeGangSchedulingPolicy type for use +// with apply. +// +// CompositeGangSchedulingPolicy indicates that the groups belonging to the composite group +// should be scheduled using all-or-nothing semantics. +type CompositeGangSchedulingPolicyApplyConfiguration struct { + // MinGroupCount is the minimum number of child groups that must be schedulable + // or scheduled at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + MinGroupCount *int32 `json:"minGroupCount,omitempty"` +} + +// CompositeGangSchedulingPolicyApplyConfiguration constructs a declarative configuration of the CompositeGangSchedulingPolicy type for use with +// apply. +func CompositeGangSchedulingPolicy() *CompositeGangSchedulingPolicyApplyConfiguration { + return &CompositeGangSchedulingPolicyApplyConfiguration{} +} + +// WithMinGroupCount sets the MinGroupCount 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 MinGroupCount field is set to the value of the last call. +func (b *CompositeGangSchedulingPolicyApplyConfiguration) WithMinGroupCount(value int32) *CompositeGangSchedulingPolicyApplyConfiguration { + b.MinGroupCount = &value + return b +} diff --git a/applyconfigurations/scheduling/v1alpha3/compositepodgroup.go b/applyconfigurations/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 000000000..cdf5466b5 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,296 @@ +/* +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 v1alpha3 + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + 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" +) + +// CompositePodGroupApplyConfiguration represents a declarative configuration of the CompositePodGroup type for use +// with apply. +// +// CompositePodGroup represents a runtime instance of pod groups grouped together. +// CompositePodGroups are created by workload controllers (LWS, JobSet, etc...) from +// Workload.compositePodGroupTemplates. +// CompositePodGroup API enablement is toggled by the CompositePodGroup feature gate. +type CompositePodGroupApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:""` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // Spec defines the desired state of the CompositePodGroup. + Spec *CompositePodGroupSpecApplyConfiguration `json:"spec,omitempty"` + // Status represents the current observed state of the CompositePodGroup. + Status *CompositePodGroupStatusApplyConfiguration `json:"status,omitempty"` +} + +// CompositePodGroup constructs a declarative configuration of the CompositePodGroup type for use with +// apply. +func CompositePodGroup(name, namespace string) *CompositePodGroupApplyConfiguration { + b := &CompositePodGroupApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("CompositePodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") + return b +} + +// ExtractCompositePodGroupFrom extracts the applied configuration owned by fieldManager from +// compositePodGroup for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// compositePodGroup must be a unmodified CompositePodGroup API object that was retrieved from the Kubernetes API. +// ExtractCompositePodGroupFrom 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 ExtractCompositePodGroupFrom(compositePodGroup *schedulingv1alpha3.CompositePodGroup, fieldManager string, subresource string) (*CompositePodGroupApplyConfiguration, error) { + b := &CompositePodGroupApplyConfiguration{} + err := managedfields.ExtractInto(compositePodGroup, internal.Parser().Type("io.k8s.api.scheduling.v1alpha3.CompositePodGroup"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(compositePodGroup.Name) + b.WithNamespace(compositePodGroup.Namespace) + + b.WithKind("CompositePodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1alpha3") + return b, nil +} + +// ExtractCompositePodGroup extracts the applied configuration owned by fieldManager from +// compositePodGroup. If no managedFields are found in compositePodGroup for fieldManager, a +// CompositePodGroupApplyConfiguration 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. +// compositePodGroup must be a unmodified CompositePodGroup API object that was retrieved from the Kubernetes API. +// ExtractCompositePodGroup 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 ExtractCompositePodGroup(compositePodGroup *schedulingv1alpha3.CompositePodGroup, fieldManager string) (*CompositePodGroupApplyConfiguration, error) { + return ExtractCompositePodGroupFrom(compositePodGroup, fieldManager, "") +} + +// ExtractCompositePodGroupStatus extracts the applied configuration owned by fieldManager from +// compositePodGroup for the status subresource. +func ExtractCompositePodGroupStatus(compositePodGroup *schedulingv1alpha3.CompositePodGroup, fieldManager string) (*CompositePodGroupApplyConfiguration, error) { + return ExtractCompositePodGroupFrom(compositePodGroup, fieldManager, "status") +} + +func (b CompositePodGroupApplyConfiguration) 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 *CompositePodGroupApplyConfiguration) WithKind(value string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithAPIVersion(value string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithName(value string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithGenerateName(value string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithNamespace(value string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithUID(value types.UID) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithResourceVersion(value string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithGeneration(value int64) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithLabels(entries map[string]string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithAnnotations(entries map[string]string) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CompositePodGroupApplyConfiguration { + 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 *CompositePodGroupApplyConfiguration) WithFinalizers(values ...string) *CompositePodGroupApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *CompositePodGroupApplyConfiguration) 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 *CompositePodGroupApplyConfiguration) WithSpec(value *CompositePodGroupSpecApplyConfiguration) *CompositePodGroupApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status 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 Status field is set to the value of the last call. +func (b *CompositePodGroupApplyConfiguration) WithStatus(value *CompositePodGroupStatusApplyConfiguration) *CompositePodGroupApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *CompositePodGroupApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingpolicy.go b/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingpolicy.go new file mode 100644 index 000000000..c3b1ff468 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha3/compositepodgroupschedulingpolicy.go @@ -0,0 +1,59 @@ +/* +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 v1alpha3 + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" +) + +// CompositePodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the CompositePodGroupSchedulingPolicy type for use +// with apply. +// +// CompositePodGroupSchedulingPolicy defines the scheduling configuration for a CompositePodGroup. +// Exactly one policy must be set. +type CompositePodGroupSchedulingPolicyApplyConfiguration struct { + // Basic specifies that the groups of this composite group should be scheduled independently. + // This field is immutable. + Basic *schedulingv1alpha3.CompositeBasicSchedulingPolicy `json:"basic,omitempty"` + // Gang specifies that the groups of this composite group should be scheduled using + // all-or-nothing semantics. + Gang *CompositeGangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` +} + +// CompositePodGroupSchedulingPolicyApplyConfiguration constructs a declarative configuration of the CompositePodGroupSchedulingPolicy type for use with +// apply. +func CompositePodGroupSchedulingPolicy() *CompositePodGroupSchedulingPolicyApplyConfiguration { + return &CompositePodGroupSchedulingPolicyApplyConfiguration{} +} + +// 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 *CompositePodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1alpha3.CompositeBasicSchedulingPolicy) *CompositePodGroupSchedulingPolicyApplyConfiguration { + 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 *CompositePodGroupSchedulingPolicyApplyConfiguration) WithGang(value *CompositeGangSchedulingPolicyApplyConfiguration) *CompositePodGroupSchedulingPolicyApplyConfiguration { + b.Gang = value + return b +} diff --git a/applyconfigurations/scheduling/v1alpha3/compositepodgroupspec.go b/applyconfigurations/scheduling/v1alpha3/compositepodgroupspec.go new file mode 100644 index 000000000..5de7561f0 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha3/compositepodgroupspec.go @@ -0,0 +1,100 @@ +/* +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 v1alpha3 + +// CompositePodGroupSpecApplyConfiguration represents a declarative configuration of the CompositePodGroupSpec type for use +// with apply. +// +// CompositePodGroupSpec defines the desired state of CompositePodGroup. +type CompositePodGroupSpecApplyConfiguration struct { + // ParentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this composite pod group. It must be a DNS name. + // If it's nil, then this composite pod group is a root of a workload's hierarchy. + // This field is immutable. + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty"` + // WorkloadRef references an optional CompositePodGroup template within the + // Workload object that was used to create the CompositePodGroup. + // This field is required. + // This field is immutable. + WorkloadRef *WorkloadReferenceApplyConfiguration `json:"workloadRef,omitempty"` + // SchedulingPolicy defines the scheduling policy for this instance of the CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // This field is immutable. + SchedulingPolicy *CompositePodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // PriorityClassName defines the priority that should be considered when scheduling this CompositePodGroup. + // Controllers are expected to fill this field by copying it from a CompositePodGroupTemplate. + // If left unspecified, it is validated and resolved similarly to the PriorityClassName field in Pods + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the composite pod group's priority will be zero). + // This field is immutable. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // Priority is the value of priority of this composite pod group. Various system components + // use this field to find the priority of the composite pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + Priority *int32 `json:"priority,omitempty"` +} + +// CompositePodGroupSpecApplyConfiguration constructs a declarative configuration of the CompositePodGroupSpec type for use with +// apply. +func CompositePodGroupSpec() *CompositePodGroupSpecApplyConfiguration { + return &CompositePodGroupSpecApplyConfiguration{} +} + +// WithParentCompositePodGroupName sets the ParentCompositePodGroupName 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 ParentCompositePodGroupName field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithParentCompositePodGroupName(value string) *CompositePodGroupSpecApplyConfiguration { + b.ParentCompositePodGroupName = &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 *CompositePodGroupSpecApplyConfiguration) WithWorkloadRef(value *WorkloadReferenceApplyConfiguration) *CompositePodGroupSpecApplyConfiguration { + b.WorkloadRef = value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithSchedulingPolicy(value *CompositePodGroupSchedulingPolicyApplyConfiguration) *CompositePodGroupSpecApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PriorityClassName field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithPriorityClassName(value string) *CompositePodGroupSpecApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *CompositePodGroupSpecApplyConfiguration) WithPriority(value int32) *CompositePodGroupSpecApplyConfiguration { + b.Priority = &value + return b +} diff --git a/applyconfigurations/scheduling/v1alpha3/compositepodgroupstatus.go b/applyconfigurations/scheduling/v1alpha3/compositepodgroupstatus.go new file mode 100644 index 000000000..a4e8a51e1 --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha3/compositepodgroupstatus.go @@ -0,0 +1,72 @@ +/* +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 v1alpha3 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CompositePodGroupStatusApplyConfiguration represents a declarative configuration of the CompositePodGroupStatus type for use +// with apply. +// +// CompositePodGroupStatus represents information about the status of a composite pod group. +type CompositePodGroupStatusApplyConfiguration struct { + // Conditions represent the latest observations of the CompositePodGroup's state. + // + // Known condition types: + // - "CompositePodGroupInitiallyScheduled": Indicates whether the overall scheduling requirement + // for the subtree under this CompositePodGroup has been satisfied. Once this condition + // transitions to True, it serves as a terminal state and will never revert to False, + // even if pods are subsequently deleted and group constraints are no longer met. + // - "DisruptionTarget": Indicates whether the CompositePodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the CompositePodGroupInitiallyScheduled condition: + // - "Unschedulable": The CompositePodGroup's subtree could not be placed due to resource constraints, + // affinity/anti-affinity, or topological constraints. + // - "SchedulerError": The CompositePodGroup cannot be scheduled due to some internal error + // that occurred during scheduling. + // - "Invalid": Set to True when kube-scheduler detects an invalid group layout during + // runtime validation. The `message` field details the specific layout violation (such as + // a detected cycle, exceeding the maximum depth of 4, or referencing multiple distinct Workloads). + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The CompositePodGroup was targeted by the scheduler's preemption loop + // to free up capacity for higher-priority preemptors. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// CompositePodGroupStatusApplyConfiguration constructs a declarative configuration of the CompositePodGroupStatus type for use with +// apply. +func CompositePodGroupStatus() *CompositePodGroupStatusApplyConfiguration { + return &CompositePodGroupStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions 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 Conditions field. +func (b *CompositePodGroupStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *CompositePodGroupStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/applyconfigurations/scheduling/v1alpha3/compositepodgrouptemplate.go b/applyconfigurations/scheduling/v1alpha3/compositepodgrouptemplate.go new file mode 100644 index 000000000..b606e757b --- /dev/null +++ b/applyconfigurations/scheduling/v1alpha3/compositepodgrouptemplate.go @@ -0,0 +1,117 @@ +/* +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 v1alpha3 + +// CompositePodGroupTemplateApplyConfiguration represents a declarative configuration of the CompositePodGroupTemplate type for use +// with apply. +// +// CompositePodGroupTemplate represents a template for a CompositePodGroup with a scheduling policy. +type CompositePodGroupTemplateApplyConfiguration struct { + // Name is a unique identifier for the CompositePodGroupTemplate within the Workload. + // It must be a DNS label. This field is required. + Name *string `json:"name,omitempty"` + // SchedulingPolicy defines the scheduling policy for this template. + SchedulingPolicy *CompositePodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // PriorityClassName indicates the priority that should be considered when scheduling + // a composite pod group created from this template. If no priority class is specified, + // admission control can set this to the global default priority class if it exists. + // Otherwise, composite pod groups created from this template will have the priority set + // to zero. + // This field is immutable. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // Priority is the value of priority of composite pod groups created from this template. + // Various system components use this field to find the priority of the composite pod group. + // When Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + Priority *int32 `json:"priority,omitempty"` + // PodGroupTemplates is the list of templates for children PodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"` + // CompositePodGroupTemplates is the list of templates for children CompositePodGroups. + // The maximum number of templates is 8. At least one entry in CompositePodGroupTemplates + // or PodGroupTemplates must be set. + CompositePodGroupTemplates []CompositePodGroupTemplateApplyConfiguration `json:"compositePodGroupTemplates,omitempty"` +} + +// CompositePodGroupTemplateApplyConfiguration constructs a declarative configuration of the CompositePodGroupTemplate type for use with +// apply. +func CompositePodGroupTemplate() *CompositePodGroupTemplateApplyConfiguration { + return &CompositePodGroupTemplateApplyConfiguration{} +} + +// 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 *CompositePodGroupTemplateApplyConfiguration) WithName(value string) *CompositePodGroupTemplateApplyConfiguration { + b.Name = &value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy 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 SchedulingPolicy field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithSchedulingPolicy(value *CompositePodGroupSchedulingPolicyApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PriorityClassName field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPriorityClassName(value string) *CompositePodGroupTemplateApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPriority(value int32) *CompositePodGroupTemplateApplyConfiguration { + b.Priority = &value + return b +} + +// WithPodGroupTemplates adds the given value to the PodGroupTemplates 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 PodGroupTemplates field. +func (b *CompositePodGroupTemplateApplyConfiguration) WithPodGroupTemplates(values ...*PodGroupTemplateApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPodGroupTemplates") + } + b.PodGroupTemplates = append(b.PodGroupTemplates, *values[i]) + } + return b +} + +// WithCompositePodGroupTemplates adds the given value to the CompositePodGroupTemplates 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 CompositePodGroupTemplates field. +func (b *CompositePodGroupTemplateApplyConfiguration) WithCompositePodGroupTemplates(values ...*CompositePodGroupTemplateApplyConfiguration) *CompositePodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCompositePodGroupTemplates") + } + b.CompositePodGroupTemplates = append(b.CompositePodGroupTemplates, *values[i]) + } + return b +} diff --git a/applyconfigurations/scheduling/v1alpha3/podgroupspec.go b/applyconfigurations/scheduling/v1alpha3/podgroupspec.go index e2ed27345..ccfb5e462 100644 --- a/applyconfigurations/scheduling/v1alpha3/podgroupspec.go +++ b/applyconfigurations/scheduling/v1alpha3/podgroupspec.go @@ -27,6 +27,12 @@ import ( // // PodGroupSpec defines the desired state of a PodGroup. type PodGroupSpecApplyConfiguration struct { + // ParentCompositePodGroupName contains the name of the parent composite pod group + // within the same namespace as this pod group. + // If it's nil, then this pod group is a root of a workload's hierarchy. + // This field is used only when the CompositePodGroup feature gate is enabled. + // This field is immutable. + ParentCompositePodGroupName *string `json:"parentCompositePodGroupName,omitempty"` // WorkloadRef references an optional PodGroup template within the Workload // object that was used to create the PodGroup. // This field is immutable. @@ -84,6 +90,14 @@ func PodGroupSpec() *PodGroupSpecApplyConfiguration { return &PodGroupSpecApplyConfiguration{} } +// WithParentCompositePodGroupName sets the ParentCompositePodGroupName 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 ParentCompositePodGroupName field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithParentCompositePodGroupName(value string) *PodGroupSpecApplyConfiguration { + b.ParentCompositePodGroupName = &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. diff --git a/applyconfigurations/scheduling/v1alpha3/workloadspec.go b/applyconfigurations/scheduling/v1alpha3/workloadspec.go index 2c203a9c9..1271231e3 100644 --- a/applyconfigurations/scheduling/v1alpha3/workloadspec.go +++ b/applyconfigurations/scheduling/v1alpha3/workloadspec.go @@ -31,7 +31,14 @@ type WorkloadSpecApplyConfiguration struct { // PodGroupTemplates is the list of templates that make up the Workload. // The maximum number of templates is 8. Templates cannot be added or removed after the workload is created. // Existing templates may still be updated where their individual fields allow it. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"` + // CompositePodGroupTemplates is the list of CompositePodGroup templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // Exactly one of CompositePodGroupTemplates and PodGroupTemplates must be set. + // + // This field is used only when the CompositePodGroup feature gate is enabled. + CompositePodGroupTemplates []CompositePodGroupTemplateApplyConfiguration `json:"compositePodGroupTemplates,omitempty"` } // WorkloadSpecApplyConfiguration constructs a declarative configuration of the WorkloadSpec type for use with @@ -60,3 +67,16 @@ func (b *WorkloadSpecApplyConfiguration) WithPodGroupTemplates(values ...*PodGro } return b } + +// WithCompositePodGroupTemplates adds the given value to the CompositePodGroupTemplates 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 CompositePodGroupTemplates field. +func (b *WorkloadSpecApplyConfiguration) WithCompositePodGroupTemplates(values ...*CompositePodGroupTemplateApplyConfiguration) *WorkloadSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCompositePodGroupTemplates") + } + b.CompositePodGroupTemplates = append(b.CompositePodGroupTemplates, *values[i]) + } + return b +} diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index af2e62dfa..62d20d8a1 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -1852,6 +1852,18 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsschedulingv1.PriorityClassApplyConfiguration{} // Group=scheduling.k8s.io, Version=v1alpha3 + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositeGangSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.CompositeGangSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroup"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupSpec"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupSpecApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupStatus"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupStatusApplyConfiguration{} + case schedulingv1alpha3.SchemeGroupVersion.WithKind("CompositePodGroupTemplate"): + return &applyconfigurationsschedulingv1alpha3.CompositePodGroupTemplateApplyConfiguration{} case schedulingv1alpha3.SchemeGroupVersion.WithKind("DisruptionMode"): return &applyconfigurationsschedulingv1alpha3.DisruptionModeApplyConfiguration{} case schedulingv1alpha3.SchemeGroupVersion.WithKind("GangSchedulingPolicy"): diff --git a/informers/generic.go b/informers/generic.go index 860c2aea1..e0bd83763 100644 --- a/informers/generic.go +++ b/informers/generic.go @@ -425,6 +425,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil // Group=scheduling.k8s.io, Version=v1alpha3 + case schedulingv1alpha3.SchemeGroupVersion.WithResource("compositepodgroups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().CompositePodGroups().Informer()}, nil case schedulingv1alpha3.SchemeGroupVersion.WithResource("podgroups"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha3().PodGroups().Informer()}, nil case schedulingv1alpha3.SchemeGroupVersion.WithResource("workloads"): diff --git a/informers/scheduling/v1alpha3/compositepodgroup.go b/informers/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 000000000..95a73974f --- /dev/null +++ b/informers/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,116 @@ +/* +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 v1alpha3 + +import ( + context "context" + time "time" + + apischedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha3 "k8s.io/client-go/listers/scheduling/v1alpha3" + cache "k8s.io/client-go/tools/cache" +) + +// CompositePodGroupInformer provides access to a shared informer and lister for +// CompositePodGroups. +type CompositePodGroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1alpha3.CompositePodGroupLister +} + +type compositePodGroupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCompositePodGroupInformer constructs a new informer for CompositePodGroup 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 NewCompositePodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewCompositePodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredCompositePodGroupInformer constructs a new informer for CompositePodGroup 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 NewFilteredCompositePodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewCompositePodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCompositePodGroupInformerWithOptions constructs a new informer for CompositePodGroup type with additional options. +// 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 NewCompositePodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha3", Resource: "compositepodgroups"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha3().CompositePodGroups(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1alpha3.CompositePodGroup{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *compositePodGroupInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewCompositePodGroupInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *compositePodGroupInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apischedulingv1alpha3.CompositePodGroup{}, f.defaultInformer) +} + +func (f *compositePodGroupInformer) Lister() schedulingv1alpha3.CompositePodGroupLister { + return schedulingv1alpha3.NewCompositePodGroupLister(f.Informer().GetIndexer()) +} diff --git a/informers/scheduling/v1alpha3/interface.go b/informers/scheduling/v1alpha3/interface.go index cea41e973..41f68d891 100644 --- a/informers/scheduling/v1alpha3/interface.go +++ b/informers/scheduling/v1alpha3/interface.go @@ -24,6 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // CompositePodGroups returns a CompositePodGroupInformer. + CompositePodGroups() CompositePodGroupInformer // PodGroups returns a PodGroupInformer. PodGroups() PodGroupInformer // Workloads returns a WorkloadInformer. @@ -41,6 +43,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// CompositePodGroups returns a CompositePodGroupInformer. +func (v *version) CompositePodGroups() CompositePodGroupInformer { + return &compositePodGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // PodGroups returns a PodGroupInformer. func (v *version) PodGroups() PodGroupInformer { return &podGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go b/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 000000000..a301cbd35 --- /dev/null +++ b/kubernetes/typed/scheduling/v1alpha3/compositepodgroup.go @@ -0,0 +1,75 @@ +/* +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 v1alpha3 + +import ( + context "context" + + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsschedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// CompositePodGroupsGetter has a method to return a CompositePodGroupInterface. +// A group's client should implement this interface. +type CompositePodGroupsGetter interface { + CompositePodGroups(namespace string) CompositePodGroupInterface +} + +// CompositePodGroupInterface has methods to work with CompositePodGroup resources. +type CompositePodGroupInterface interface { + Create(ctx context.Context, compositePodGroup *schedulingv1alpha3.CompositePodGroup, opts v1.CreateOptions) (*schedulingv1alpha3.CompositePodGroup, error) + Update(ctx context.Context, compositePodGroup *schedulingv1alpha3.CompositePodGroup, opts v1.UpdateOptions) (*schedulingv1alpha3.CompositePodGroup, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, compositePodGroup *schedulingv1alpha3.CompositePodGroup, opts v1.UpdateOptions) (*schedulingv1alpha3.CompositePodGroup, 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) (*schedulingv1alpha3.CompositePodGroup, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha3.CompositePodGroupList, 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 *schedulingv1alpha3.CompositePodGroup, err error) + Apply(ctx context.Context, compositePodGroup *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha3.CompositePodGroup, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, compositePodGroup *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha3.CompositePodGroup, err error) + CompositePodGroupExpansion +} + +// compositePodGroups implements CompositePodGroupInterface +type compositePodGroups struct { + *gentype.ClientWithListAndApply[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList, *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration] +} + +// newCompositePodGroups returns a CompositePodGroups +func newCompositePodGroups(c *SchedulingV1alpha3Client, namespace string) *compositePodGroups { + return &compositePodGroups{ + gentype.NewClientWithListAndApply[*schedulingv1alpha3.CompositePodGroup, *schedulingv1alpha3.CompositePodGroupList, *applyconfigurationsschedulingv1alpha3.CompositePodGroupApplyConfiguration]( + "compositepodgroups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *schedulingv1alpha3.CompositePodGroup { return &schedulingv1alpha3.CompositePodGroup{} }, + func() *schedulingv1alpha3.CompositePodGroupList { return &schedulingv1alpha3.CompositePodGroupList{} }, + gentype.PrefersProtobuf[*schedulingv1alpha3.CompositePodGroup](), + ), + } +} diff --git a/kubernetes/typed/scheduling/v1alpha3/fake/fake_compositepodgroup.go b/kubernetes/typed/scheduling/v1alpha3/fake/fake_compositepodgroup.go new file mode 100644 index 000000000..658c5fe53 --- /dev/null +++ b/kubernetes/typed/scheduling/v1alpha3/fake/fake_compositepodgroup.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 client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "k8s.io/api/scheduling/v1alpha3" + schedulingv1alpha3 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha3" + gentype "k8s.io/client-go/gentype" + typedschedulingv1alpha3 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha3" +) + +// fakeCompositePodGroups implements CompositePodGroupInterface +type fakeCompositePodGroups struct { + *gentype.FakeClientWithListAndApply[*v1alpha3.CompositePodGroup, *v1alpha3.CompositePodGroupList, *schedulingv1alpha3.CompositePodGroupApplyConfiguration] + Fake *FakeSchedulingV1alpha3 +} + +func newFakeCompositePodGroups(fake *FakeSchedulingV1alpha3, namespace string) typedschedulingv1alpha3.CompositePodGroupInterface { + return &fakeCompositePodGroups{ + gentype.NewFakeClientWithListAndApply[*v1alpha3.CompositePodGroup, *v1alpha3.CompositePodGroupList, *schedulingv1alpha3.CompositePodGroupApplyConfiguration]( + fake.Fake, + namespace, + v1alpha3.SchemeGroupVersion.WithResource("compositepodgroups"), + v1alpha3.SchemeGroupVersion.WithKind("CompositePodGroup"), + func() *v1alpha3.CompositePodGroup { return &v1alpha3.CompositePodGroup{} }, + func() *v1alpha3.CompositePodGroupList { return &v1alpha3.CompositePodGroupList{} }, + func(dst, src *v1alpha3.CompositePodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha3.CompositePodGroupList) []*v1alpha3.CompositePodGroup { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha3.CompositePodGroupList, items []*v1alpha3.CompositePodGroup) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/kubernetes/typed/scheduling/v1alpha3/fake/fake_scheduling_client.go b/kubernetes/typed/scheduling/v1alpha3/fake/fake_scheduling_client.go index fe17b1d10..920c242af 100644 --- a/kubernetes/typed/scheduling/v1alpha3/fake/fake_scheduling_client.go +++ b/kubernetes/typed/scheduling/v1alpha3/fake/fake_scheduling_client.go @@ -28,6 +28,10 @@ type FakeSchedulingV1alpha3 struct { *testing.Fake } +func (c *FakeSchedulingV1alpha3) CompositePodGroups(namespace string) v1alpha3.CompositePodGroupInterface { + return newFakeCompositePodGroups(c, namespace) +} + func (c *FakeSchedulingV1alpha3) PodGroups(namespace string) v1alpha3.PodGroupInterface { return newFakePodGroups(c, namespace) } diff --git a/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go b/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go index 956fae26d..a222ec460 100644 --- a/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go +++ b/kubernetes/typed/scheduling/v1alpha3/generated_expansion.go @@ -18,6 +18,8 @@ limitations under the License. package v1alpha3 +type CompositePodGroupExpansion interface{} + type PodGroupExpansion interface{} type WorkloadExpansion interface{} diff --git a/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go b/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go index 79b022963..8c99d51ca 100644 --- a/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go +++ b/kubernetes/typed/scheduling/v1alpha3/scheduling_client.go @@ -28,6 +28,7 @@ import ( type SchedulingV1alpha3Interface interface { RESTClient() rest.Interface + CompositePodGroupsGetter PodGroupsGetter WorkloadsGetter } @@ -37,6 +38,10 @@ type SchedulingV1alpha3Client struct { restClient rest.Interface } +func (c *SchedulingV1alpha3Client) CompositePodGroups(namespace string) CompositePodGroupInterface { + return newCompositePodGroups(c, namespace) +} + func (c *SchedulingV1alpha3Client) PodGroups(namespace string) PodGroupInterface { return newPodGroups(c, namespace) } diff --git a/listers/scheduling/v1alpha3/compositepodgroup.go b/listers/scheduling/v1alpha3/compositepodgroup.go new file mode 100644 index 000000000..b5cfe9752 --- /dev/null +++ b/listers/scheduling/v1alpha3/compositepodgroup.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 v1alpha3 + +import ( + schedulingv1alpha3 "k8s.io/api/scheduling/v1alpha3" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// CompositePodGroupLister helps list CompositePodGroups. +// All objects returned here must be treated as read-only. +type CompositePodGroupLister interface { + // List lists all CompositePodGroups in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha3.CompositePodGroup, err error) + // CompositePodGroups returns an object that can list and get CompositePodGroups. + CompositePodGroups(namespace string) CompositePodGroupNamespaceLister + CompositePodGroupListerExpansion +} + +// compositePodGroupLister implements the CompositePodGroupLister interface. +type compositePodGroupLister struct { + listers.ResourceIndexer[*schedulingv1alpha3.CompositePodGroup] +} + +// NewCompositePodGroupLister returns a new CompositePodGroupLister. +func NewCompositePodGroupLister(indexer cache.Indexer) CompositePodGroupLister { + return &compositePodGroupLister{listers.New[*schedulingv1alpha3.CompositePodGroup](indexer, schedulingv1alpha3.Resource("compositepodgroup"))} +} + +// CompositePodGroups returns an object that can list and get CompositePodGroups. +func (s *compositePodGroupLister) CompositePodGroups(namespace string) CompositePodGroupNamespaceLister { + return compositePodGroupNamespaceLister{listers.NewNamespaced[*schedulingv1alpha3.CompositePodGroup](s.ResourceIndexer, namespace)} +} + +// CompositePodGroupNamespaceLister helps list and get CompositePodGroups. +// All objects returned here must be treated as read-only. +type CompositePodGroupNamespaceLister interface { + // List lists all CompositePodGroups in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha3.CompositePodGroup, err error) + // Get retrieves the CompositePodGroup from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*schedulingv1alpha3.CompositePodGroup, error) + CompositePodGroupNamespaceListerExpansion +} + +// compositePodGroupNamespaceLister implements the CompositePodGroupNamespaceLister +// interface. +type compositePodGroupNamespaceLister struct { + listers.ResourceIndexer[*schedulingv1alpha3.CompositePodGroup] +} diff --git a/listers/scheduling/v1alpha3/expansion_generated.go b/listers/scheduling/v1alpha3/expansion_generated.go index 0b0a79eb4..cd99f2d08 100644 --- a/listers/scheduling/v1alpha3/expansion_generated.go +++ b/listers/scheduling/v1alpha3/expansion_generated.go @@ -18,6 +18,14 @@ limitations under the License. package v1alpha3 +// CompositePodGroupListerExpansion allows custom methods to be added to +// CompositePodGroupLister. +type CompositePodGroupListerExpansion interface{} + +// CompositePodGroupNamespaceListerExpansion allows custom methods to be added to +// CompositePodGroupNamespaceLister. +type CompositePodGroupNamespaceListerExpansion interface{} + // PodGroupListerExpansion allows custom methods to be added to // PodGroupLister. type PodGroupListerExpansion interface{}