diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index ea95dcf82dc5..c45da385d357 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -20417,7 +20417,11 @@ "items": { "default": {}, "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition" - } + }, + "x-kubernetes-list-map-keys": [ + "type" + ], + "x-kubernetes-list-type": "map" }, "lastScheduledTime": { "description": "LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling. It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.", diff --git a/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml b/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml index 7bfb5ed72887..dc61c168235f 100644 --- a/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml +++ b/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml @@ -1384,6 +1384,9 @@ spec: - type type: object type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map lastScheduledTime: description: |- LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling. diff --git a/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml b/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml index f2ad93b827ae..2ead97c1446b 100644 --- a/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml +++ b/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml @@ -1384,6 +1384,9 @@ spec: - type type: object type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map lastScheduledTime: description: |- LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling. diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 7874cb2b8a94..c4cb0c116a1f 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -162,6 +162,13 @@ conversion-gen \ --output-file=zz_generated.conversion.go \ github.com/karmada-io/karmada/pkg/apis/search/v1alpha1 +echo "Generating with applyconfiguration-gen" +applyconfiguration-gen \ + --go-header-file hack/boilerplate/boilerplate.go.txt \ + --output-pkg=github.com/karmada-io/karmada/pkg/generated/applyconfiguration \ + --output-dir=pkg/generated/applyconfiguration \ + github.com/karmada-io/karmada/pkg/apis/work/v1alpha1 github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 + echo "Generating with client-gen" client-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ @@ -178,6 +185,20 @@ client-gen \ --output-dir=operator/pkg/generated/clientset \ --clientset-name=versioned +# it's a workaround here. +echo "Generating with client-gen and applyconfiguration-gen " +client-gen \ + --go-header-file hack/boilerplate/boilerplate.go.txt \ + --input-base="" \ + --input=github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 \ + --output-pkg=github.com/karmada-io/karmada/pkg/generated/clientset \ + --output-dir=pkg/generated/work \ + --clientset-name=versioned \ + --apply-configuration-package=github.com/karmada-io/karmada/pkg/generated/applyconfiguration + +# move generated work client to correct path. +cp -r pkg/generated/work/versioned/typed/work pkg/generated/clientset/versioned/typed && rm -rf pkg/generated/work + echo "Generating with lister-gen" lister-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ diff --git a/pkg/apis/work/v1alpha2/binding_types.go b/pkg/apis/work/v1alpha2/binding_types.go index b8cc06191f91..2439d2c74a35 100644 --- a/pkg/apis/work/v1alpha2/binding_types.go +++ b/pkg/apis/work/v1alpha2/binding_types.go @@ -347,6 +347,8 @@ type ResourceBindingStatus struct { // Conditions contain the different condition statuses. // +optional + // +listType=map + // +listMapKey=type Conditions []metav1.Condition `json:"conditions,omitempty"` // AggregatedStatus represents status list of the resource running in each member cluster. diff --git a/pkg/generated/applyconfiguration/internal/internal.go b/pkg/generated/applyconfiguration/internal/internal.go new file mode 100644 index 000000000000..d7c6dbe10755 --- /dev/null +++ b/pkg/generated/applyconfiguration/internal/internal.go @@ -0,0 +1,62 @@ +/* +Copyright The Karmada 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 internal + +import ( + "fmt" + "sync" + + typed "sigs.k8s.io/structured-merge-diff/v4/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/pkg/generated/applyconfiguration/utils.go b/pkg/generated/applyconfiguration/utils.go new file mode 100644 index 000000000000..206a9dbd2f55 --- /dev/null +++ b/pkg/generated/applyconfiguration/utils.go @@ -0,0 +1,98 @@ +/* +Copyright The Karmada 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 applyconfiguration + +import ( + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" + internal "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/internal" + workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha1" + workv1alpha2 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha2" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=work.karmada.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithKind("AggregatedStatusItem"): + return &workv1alpha1.AggregatedStatusItemApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ClusterResourceBinding"): + return &workv1alpha1.ClusterResourceBindingApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Manifest"): + return &workv1alpha1.ManifestApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ManifestStatus"): + return &workv1alpha1.ManifestStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ObjectReference"): + return &workv1alpha1.ObjectReferenceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ResourceBinding"): + return &workv1alpha1.ResourceBindingApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ResourceBindingSpec"): + return &workv1alpha1.ResourceBindingSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ResourceBindingStatus"): + return &workv1alpha1.ResourceBindingStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ResourceIdentifier"): + return &workv1alpha1.ResourceIdentifierApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TargetCluster"): + return &workv1alpha1.TargetClusterApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Work"): + return &workv1alpha1.WorkApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("WorkloadTemplate"): + return &workv1alpha1.WorkloadTemplateApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("WorkSpec"): + return &workv1alpha1.WorkSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("WorkStatus"): + return &workv1alpha1.WorkStatusApplyConfiguration{} + + // Group=work.karmada.io, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithKind("AggregatedStatusItem"): + return &workv1alpha2.AggregatedStatusItemApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("BindingSnapshot"): + return &workv1alpha2.BindingSnapshotApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("ClusterResourceBinding"): + return &workv1alpha2.ClusterResourceBindingApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("GracefulEvictionTask"): + return &workv1alpha2.GracefulEvictionTaskApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("NodeClaim"): + return &workv1alpha2.NodeClaimApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("ObjectReference"): + return &workv1alpha2.ObjectReferenceApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("ReplicaRequirements"): + return &workv1alpha2.ReplicaRequirementsApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("ResourceBinding"): + return &workv1alpha2.ResourceBindingApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("ResourceBindingSpec"): + return &workv1alpha2.ResourceBindingSpecApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("ResourceBindingStatus"): + return &workv1alpha2.ResourceBindingStatusApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("Suspension"): + return &workv1alpha2.SuspensionApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TargetCluster"): + return &workv1alpha2.TargetClusterApplyConfiguration{} + + } + return nil +} + +func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter { + return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()} +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/aggregatedstatusitem.go b/pkg/generated/applyconfiguration/work/v1alpha1/aggregatedstatusitem.go new file mode 100644 index 000000000000..97f3d8397e5e --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/aggregatedstatusitem.go @@ -0,0 +1,70 @@ +/* +Copyright The Karmada 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 ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// AggregatedStatusItemApplyConfiguration represents a declarative configuration of the AggregatedStatusItem type for use +// with apply. +type AggregatedStatusItemApplyConfiguration struct { + ClusterName *string `json:"clusterName,omitempty"` + Status *runtime.RawExtension `json:"status,omitempty"` + Applied *bool `json:"applied,omitempty"` + AppliedMessage *string `json:"appliedMessage,omitempty"` +} + +// AggregatedStatusItemApplyConfiguration constructs a declarative configuration of the AggregatedStatusItem type for use with +// apply. +func AggregatedStatusItem() *AggregatedStatusItemApplyConfiguration { + return &AggregatedStatusItemApplyConfiguration{} +} + +// WithClusterName sets the ClusterName 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 ClusterName field is set to the value of the last call. +func (b *AggregatedStatusItemApplyConfiguration) WithClusterName(value string) *AggregatedStatusItemApplyConfiguration { + b.ClusterName = &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 *AggregatedStatusItemApplyConfiguration) WithStatus(value runtime.RawExtension) *AggregatedStatusItemApplyConfiguration { + b.Status = &value + return b +} + +// WithApplied sets the Applied 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 Applied field is set to the value of the last call. +func (b *AggregatedStatusItemApplyConfiguration) WithApplied(value bool) *AggregatedStatusItemApplyConfiguration { + b.Applied = &value + return b +} + +// WithAppliedMessage sets the AppliedMessage 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 AppliedMessage field is set to the value of the last call. +func (b *AggregatedStatusItemApplyConfiguration) WithAppliedMessage(value string) *AggregatedStatusItemApplyConfiguration { + b.AppliedMessage = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/clusterresourcebinding.go b/pkg/generated/applyconfiguration/work/v1alpha1/clusterresourcebinding.go new file mode 100644 index 000000000000..ba52f9e799cf --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/clusterresourcebinding.go @@ -0,0 +1,224 @@ +/* +Copyright The Karmada 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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterResourceBindingApplyConfiguration represents a declarative configuration of the ClusterResourceBinding type for use +// with apply. +type ClusterResourceBindingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ResourceBindingSpecApplyConfiguration `json:"spec,omitempty"` + Status *ResourceBindingStatusApplyConfiguration `json:"status,omitempty"` +} + +// ClusterResourceBinding constructs a declarative configuration of the ClusterResourceBinding type for use with +// apply. +func ClusterResourceBinding(name string) *ClusterResourceBindingApplyConfiguration { + b := &ClusterResourceBindingApplyConfiguration{} + b.WithName(name) + b.WithKind("ClusterResourceBinding") + b.WithAPIVersion("work.karmada.io/v1alpha1") + 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 *ClusterResourceBindingApplyConfiguration) WithKind(value string) *ClusterResourceBindingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithAPIVersion(value string) *ClusterResourceBindingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithName(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithGenerateName(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithNamespace(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithUID(value types.UID) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithResourceVersion(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithGeneration(value int64) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterResourceBindingApplyConfiguration) WithLabels(entries map[string]string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterResourceBindingApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterResourceBindingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterResourceBindingApplyConfiguration) WithFinalizers(values ...string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ClusterResourceBindingApplyConfiguration) 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 *ClusterResourceBindingApplyConfiguration) WithSpec(value *ResourceBindingSpecApplyConfiguration) *ClusterResourceBindingApplyConfiguration { + 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 *ClusterResourceBindingApplyConfiguration) WithStatus(value *ResourceBindingStatusApplyConfiguration) *ClusterResourceBindingApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterResourceBindingApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/manifest.go b/pkg/generated/applyconfiguration/work/v1alpha1/manifest.go new file mode 100644 index 000000000000..fa601b8ef850 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/manifest.go @@ -0,0 +1,35 @@ +/* +Copyright The Karmada 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 ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// ManifestApplyConfiguration represents a declarative configuration of the Manifest type for use +// with apply. +type ManifestApplyConfiguration struct { + runtime.RawExtension `json:",inline"` +} + +// ManifestApplyConfiguration constructs a declarative configuration of the Manifest type for use with +// apply. +func Manifest() *ManifestApplyConfiguration { + return &ManifestApplyConfiguration{} +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/manifeststatus.go b/pkg/generated/applyconfiguration/work/v1alpha1/manifeststatus.go new file mode 100644 index 000000000000..443dc597bda4 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/manifeststatus.go @@ -0,0 +1,62 @@ +/* +Copyright The Karmada 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 ( + workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// ManifestStatusApplyConfiguration represents a declarative configuration of the ManifestStatus type for use +// with apply. +type ManifestStatusApplyConfiguration struct { + Identifier *ResourceIdentifierApplyConfiguration `json:"identifier,omitempty"` + Status *runtime.RawExtension `json:"status,omitempty"` + Health *workv1alpha1.ResourceHealth `json:"health,omitempty"` +} + +// ManifestStatusApplyConfiguration constructs a declarative configuration of the ManifestStatus type for use with +// apply. +func ManifestStatus() *ManifestStatusApplyConfiguration { + return &ManifestStatusApplyConfiguration{} +} + +// WithIdentifier sets the Identifier 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 Identifier field is set to the value of the last call. +func (b *ManifestStatusApplyConfiguration) WithIdentifier(value *ResourceIdentifierApplyConfiguration) *ManifestStatusApplyConfiguration { + b.Identifier = 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 *ManifestStatusApplyConfiguration) WithStatus(value runtime.RawExtension) *ManifestStatusApplyConfiguration { + b.Status = &value + return b +} + +// WithHealth sets the Health 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 Health field is set to the value of the last call. +func (b *ManifestStatusApplyConfiguration) WithHealth(value workv1alpha1.ResourceHealth) *ManifestStatusApplyConfiguration { + b.Health = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/objectreference.go b/pkg/generated/applyconfiguration/work/v1alpha1/objectreference.go new file mode 100644 index 000000000000..988d185f4261 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/objectreference.go @@ -0,0 +1,97 @@ +/* +Copyright The Karmada 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 ( + v1 "k8s.io/api/core/v1" +) + +// ObjectReferenceApplyConfiguration represents a declarative configuration of the ObjectReference type for use +// with apply. +type ObjectReferenceApplyConfiguration struct { + APIVersion *string `json:"apiVersion,omitempty"` + Kind *string `json:"kind,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + ResourceVersion *string `json:"resourceVersion,omitempty"` + ReplicaResourceRequirements *v1.ResourceList `json:"resourcePerReplicas,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` +} + +// ObjectReferenceApplyConfiguration constructs a declarative configuration of the ObjectReference type for use with +// apply. +func ObjectReference() *ObjectReferenceApplyConfiguration { + return &ObjectReferenceApplyConfiguration{} +} + +// 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 *ObjectReferenceApplyConfiguration) WithAPIVersion(value string) *ObjectReferenceApplyConfiguration { + b.APIVersion = &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 *ObjectReferenceApplyConfiguration) WithKind(value string) *ObjectReferenceApplyConfiguration { + b.Kind = &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 *ObjectReferenceApplyConfiguration) WithNamespace(value string) *ObjectReferenceApplyConfiguration { + b.Namespace = &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 *ObjectReferenceApplyConfiguration) WithName(value string) *ObjectReferenceApplyConfiguration { + b.Name = &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 *ObjectReferenceApplyConfiguration) WithResourceVersion(value string) *ObjectReferenceApplyConfiguration { + b.ResourceVersion = &value + return b +} + +// WithReplicaResourceRequirements sets the ReplicaResourceRequirements 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 ReplicaResourceRequirements field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithReplicaResourceRequirements(value v1.ResourceList) *ObjectReferenceApplyConfiguration { + b.ReplicaResourceRequirements = &value + return b +} + +// WithReplicas sets the Replicas 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 Replicas field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithReplicas(value int32) *ObjectReferenceApplyConfiguration { + b.Replicas = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/resourcebinding.go b/pkg/generated/applyconfiguration/work/v1alpha1/resourcebinding.go new file mode 100644 index 000000000000..e969289390ca --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/resourcebinding.go @@ -0,0 +1,225 @@ +/* +Copyright The Karmada 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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceBindingApplyConfiguration represents a declarative configuration of the ResourceBinding type for use +// with apply. +type ResourceBindingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ResourceBindingSpecApplyConfiguration `json:"spec,omitempty"` + Status *ResourceBindingStatusApplyConfiguration `json:"status,omitempty"` +} + +// ResourceBinding constructs a declarative configuration of the ResourceBinding type for use with +// apply. +func ResourceBinding(name, namespace string) *ResourceBindingApplyConfiguration { + b := &ResourceBindingApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ResourceBinding") + b.WithAPIVersion("work.karmada.io/v1alpha1") + 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 *ResourceBindingApplyConfiguration) WithKind(value string) *ResourceBindingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithAPIVersion(value string) *ResourceBindingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithName(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithGenerateName(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithNamespace(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithUID(value types.UID) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithResourceVersion(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithGeneration(value int64) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceBindingApplyConfiguration) WithLabels(entries map[string]string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceBindingApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceBindingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceBindingApplyConfiguration) WithFinalizers(values ...string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceBindingApplyConfiguration) 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 *ResourceBindingApplyConfiguration) WithSpec(value *ResourceBindingSpecApplyConfiguration) *ResourceBindingApplyConfiguration { + 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 *ResourceBindingApplyConfiguration) WithStatus(value *ResourceBindingStatusApplyConfiguration) *ResourceBindingApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ResourceBindingApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/resourcebindingspec.go b/pkg/generated/applyconfiguration/work/v1alpha1/resourcebindingspec.go new file mode 100644 index 000000000000..1b8b17e440fe --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/resourcebindingspec.go @@ -0,0 +1,53 @@ +/* +Copyright The Karmada 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 + +// ResourceBindingSpecApplyConfiguration represents a declarative configuration of the ResourceBindingSpec type for use +// with apply. +type ResourceBindingSpecApplyConfiguration struct { + Resource *ObjectReferenceApplyConfiguration `json:"resource,omitempty"` + Clusters []TargetClusterApplyConfiguration `json:"clusters,omitempty"` +} + +// ResourceBindingSpecApplyConfiguration constructs a declarative configuration of the ResourceBindingSpec type for use with +// apply. +func ResourceBindingSpec() *ResourceBindingSpecApplyConfiguration { + return &ResourceBindingSpecApplyConfiguration{} +} + +// WithResource sets the Resource 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 Resource field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithResource(value *ObjectReferenceApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + b.Resource = value + return b +} + +// WithClusters adds the given value to the Clusters 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 Clusters field. +func (b *ResourceBindingSpecApplyConfiguration) WithClusters(values ...*TargetClusterApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithClusters") + } + b.Clusters = append(b.Clusters, *values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/resourcebindingstatus.go b/pkg/generated/applyconfiguration/work/v1alpha1/resourcebindingstatus.go new file mode 100644 index 000000000000..fd39098b57ca --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/resourcebindingstatus.go @@ -0,0 +1,62 @@ +/* +Copyright The Karmada 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 ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceBindingStatusApplyConfiguration represents a declarative configuration of the ResourceBindingStatus type for use +// with apply. +type ResourceBindingStatusApplyConfiguration struct { + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + AggregatedStatus []AggregatedStatusItemApplyConfiguration `json:"aggregatedStatus,omitempty"` +} + +// ResourceBindingStatusApplyConfiguration constructs a declarative configuration of the ResourceBindingStatus type for use with +// apply. +func ResourceBindingStatus() *ResourceBindingStatusApplyConfiguration { + return &ResourceBindingStatusApplyConfiguration{} +} + +// 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 *ResourceBindingStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ResourceBindingStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAggregatedStatus adds the given value to the AggregatedStatus 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 AggregatedStatus field. +func (b *ResourceBindingStatusApplyConfiguration) WithAggregatedStatus(values ...*AggregatedStatusItemApplyConfiguration) *ResourceBindingStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAggregatedStatus") + } + b.AggregatedStatus = append(b.AggregatedStatus, *values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/resourceidentifier.go b/pkg/generated/applyconfiguration/work/v1alpha1/resourceidentifier.go new file mode 100644 index 000000000000..2a6aa93bf498 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/resourceidentifier.go @@ -0,0 +1,93 @@ +/* +Copyright The Karmada 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 + +// ResourceIdentifierApplyConfiguration represents a declarative configuration of the ResourceIdentifier type for use +// with apply. +type ResourceIdentifierApplyConfiguration struct { + Ordinal *int `json:"ordinal,omitempty"` + Group *string `json:"group,omitempty"` + Version *string `json:"version,omitempty"` + Kind *string `json:"kind,omitempty"` + Resource *string `json:"resource,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` +} + +// ResourceIdentifierApplyConfiguration constructs a declarative configuration of the ResourceIdentifier type for use with +// apply. +func ResourceIdentifier() *ResourceIdentifierApplyConfiguration { + return &ResourceIdentifierApplyConfiguration{} +} + +// WithOrdinal sets the Ordinal 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 Ordinal field is set to the value of the last call. +func (b *ResourceIdentifierApplyConfiguration) WithOrdinal(value int) *ResourceIdentifierApplyConfiguration { + b.Ordinal = &value + return b +} + +// WithGroup sets the Group 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 Group field is set to the value of the last call. +func (b *ResourceIdentifierApplyConfiguration) WithGroup(value string) *ResourceIdentifierApplyConfiguration { + b.Group = &value + return b +} + +// WithVersion sets the Version 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 Version field is set to the value of the last call. +func (b *ResourceIdentifierApplyConfiguration) WithVersion(value string) *ResourceIdentifierApplyConfiguration { + b.Version = &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 *ResourceIdentifierApplyConfiguration) WithKind(value string) *ResourceIdentifierApplyConfiguration { + b.Kind = &value + return b +} + +// WithResource sets the Resource 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 Resource field is set to the value of the last call. +func (b *ResourceIdentifierApplyConfiguration) WithResource(value string) *ResourceIdentifierApplyConfiguration { + b.Resource = &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 *ResourceIdentifierApplyConfiguration) WithNamespace(value string) *ResourceIdentifierApplyConfiguration { + b.Namespace = &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 *ResourceIdentifierApplyConfiguration) WithName(value string) *ResourceIdentifierApplyConfiguration { + b.Name = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/targetcluster.go b/pkg/generated/applyconfiguration/work/v1alpha1/targetcluster.go new file mode 100644 index 000000000000..a8c0ed12fa01 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/targetcluster.go @@ -0,0 +1,48 @@ +/* +Copyright The Karmada 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 + +// TargetClusterApplyConfiguration represents a declarative configuration of the TargetCluster type for use +// with apply. +type TargetClusterApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` +} + +// TargetClusterApplyConfiguration constructs a declarative configuration of the TargetCluster type for use with +// apply. +func TargetCluster() *TargetClusterApplyConfiguration { + return &TargetClusterApplyConfiguration{} +} + +// 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 *TargetClusterApplyConfiguration) WithName(value string) *TargetClusterApplyConfiguration { + b.Name = &value + return b +} + +// WithReplicas sets the Replicas 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 Replicas field is set to the value of the last call. +func (b *TargetClusterApplyConfiguration) WithReplicas(value int32) *TargetClusterApplyConfiguration { + b.Replicas = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/work.go b/pkg/generated/applyconfiguration/work/v1alpha1/work.go new file mode 100644 index 000000000000..6f5bd433f759 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/work.go @@ -0,0 +1,225 @@ +/* +Copyright The Karmada 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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// WorkApplyConfiguration represents a declarative configuration of the Work type for use +// with apply. +type WorkApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *WorkSpecApplyConfiguration `json:"spec,omitempty"` + Status *WorkStatusApplyConfiguration `json:"status,omitempty"` +} + +// Work constructs a declarative configuration of the Work type for use with +// apply. +func Work(name, namespace string) *WorkApplyConfiguration { + b := &WorkApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Work") + b.WithAPIVersion("work.karmada.io/v1alpha1") + 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 *WorkApplyConfiguration) WithKind(value string) *WorkApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithAPIVersion(value string) *WorkApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithName(value string) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithGenerateName(value string) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithNamespace(value string) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithUID(value types.UID) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithResourceVersion(value string) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithGeneration(value int64) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithCreationTimestamp(value metav1.Time) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *WorkApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *WorkApplyConfiguration) WithLabels(entries map[string]string) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *WorkApplyConfiguration) WithAnnotations(entries map[string]string) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *WorkApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *WorkApplyConfiguration) WithFinalizers(values ...string) *WorkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *WorkApplyConfiguration) 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 *WorkApplyConfiguration) WithSpec(value *WorkSpecApplyConfiguration) *WorkApplyConfiguration { + 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 *WorkApplyConfiguration) WithStatus(value *WorkStatusApplyConfiguration) *WorkApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *WorkApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/workloadtemplate.go b/pkg/generated/applyconfiguration/work/v1alpha1/workloadtemplate.go new file mode 100644 index 000000000000..7f4bd7db5a64 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/workloadtemplate.go @@ -0,0 +1,44 @@ +/* +Copyright The Karmada 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 + +// WorkloadTemplateApplyConfiguration represents a declarative configuration of the WorkloadTemplate type for use +// with apply. +type WorkloadTemplateApplyConfiguration struct { + Manifests []ManifestApplyConfiguration `json:"manifests,omitempty"` +} + +// WorkloadTemplateApplyConfiguration constructs a declarative configuration of the WorkloadTemplate type for use with +// apply. +func WorkloadTemplate() *WorkloadTemplateApplyConfiguration { + return &WorkloadTemplateApplyConfiguration{} +} + +// WithManifests adds the given value to the Manifests 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 Manifests field. +func (b *WorkloadTemplateApplyConfiguration) WithManifests(values ...*ManifestApplyConfiguration) *WorkloadTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithManifests") + } + b.Manifests = append(b.Manifests, *values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/workspec.go b/pkg/generated/applyconfiguration/work/v1alpha1/workspec.go new file mode 100644 index 000000000000..a18ab5b828ae --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/workspec.go @@ -0,0 +1,57 @@ +/* +Copyright The Karmada 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 + +// WorkSpecApplyConfiguration represents a declarative configuration of the WorkSpec type for use +// with apply. +type WorkSpecApplyConfiguration struct { + Workload *WorkloadTemplateApplyConfiguration `json:"workload,omitempty"` + SuspendDispatching *bool `json:"suspendDispatching,omitempty"` + PreserveResourcesOnDeletion *bool `json:"preserveResourcesOnDeletion,omitempty"` +} + +// WorkSpecApplyConfiguration constructs a declarative configuration of the WorkSpec type for use with +// apply. +func WorkSpec() *WorkSpecApplyConfiguration { + return &WorkSpecApplyConfiguration{} +} + +// WithWorkload sets the Workload 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 Workload field is set to the value of the last call. +func (b *WorkSpecApplyConfiguration) WithWorkload(value *WorkloadTemplateApplyConfiguration) *WorkSpecApplyConfiguration { + b.Workload = value + return b +} + +// WithSuspendDispatching sets the SuspendDispatching 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 SuspendDispatching field is set to the value of the last call. +func (b *WorkSpecApplyConfiguration) WithSuspendDispatching(value bool) *WorkSpecApplyConfiguration { + b.SuspendDispatching = &value + return b +} + +// WithPreserveResourcesOnDeletion sets the PreserveResourcesOnDeletion 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 PreserveResourcesOnDeletion field is set to the value of the last call. +func (b *WorkSpecApplyConfiguration) WithPreserveResourcesOnDeletion(value bool) *WorkSpecApplyConfiguration { + b.PreserveResourcesOnDeletion = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha1/workstatus.go b/pkg/generated/applyconfiguration/work/v1alpha1/workstatus.go new file mode 100644 index 000000000000..8533545ef61b --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha1/workstatus.go @@ -0,0 +1,62 @@ +/* +Copyright The Karmada 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 ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// WorkStatusApplyConfiguration represents a declarative configuration of the WorkStatus type for use +// with apply. +type WorkStatusApplyConfiguration struct { + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + ManifestStatuses []ManifestStatusApplyConfiguration `json:"manifestStatuses,omitempty"` +} + +// WorkStatusApplyConfiguration constructs a declarative configuration of the WorkStatus type for use with +// apply. +func WorkStatus() *WorkStatusApplyConfiguration { + return &WorkStatusApplyConfiguration{} +} + +// 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 *WorkStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *WorkStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithManifestStatuses adds the given value to the ManifestStatuses 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 ManifestStatuses field. +func (b *WorkStatusApplyConfiguration) WithManifestStatuses(values ...*ManifestStatusApplyConfiguration) *WorkStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithManifestStatuses") + } + b.ManifestStatuses = append(b.ManifestStatuses, *values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/aggregatedstatusitem.go b/pkg/generated/applyconfiguration/work/v1alpha2/aggregatedstatusitem.go new file mode 100644 index 000000000000..3180533aacb6 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/aggregatedstatusitem.go @@ -0,0 +1,80 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// AggregatedStatusItemApplyConfiguration represents a declarative configuration of the AggregatedStatusItem type for use +// with apply. +type AggregatedStatusItemApplyConfiguration struct { + ClusterName *string `json:"clusterName,omitempty"` + Status *runtime.RawExtension `json:"status,omitempty"` + Applied *bool `json:"applied,omitempty"` + AppliedMessage *string `json:"appliedMessage,omitempty"` + Health *v1alpha2.ResourceHealth `json:"health,omitempty"` +} + +// AggregatedStatusItemApplyConfiguration constructs a declarative configuration of the AggregatedStatusItem type for use with +// apply. +func AggregatedStatusItem() *AggregatedStatusItemApplyConfiguration { + return &AggregatedStatusItemApplyConfiguration{} +} + +// WithClusterName sets the ClusterName 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 ClusterName field is set to the value of the last call. +func (b *AggregatedStatusItemApplyConfiguration) WithClusterName(value string) *AggregatedStatusItemApplyConfiguration { + b.ClusterName = &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 *AggregatedStatusItemApplyConfiguration) WithStatus(value runtime.RawExtension) *AggregatedStatusItemApplyConfiguration { + b.Status = &value + return b +} + +// WithApplied sets the Applied 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 Applied field is set to the value of the last call. +func (b *AggregatedStatusItemApplyConfiguration) WithApplied(value bool) *AggregatedStatusItemApplyConfiguration { + b.Applied = &value + return b +} + +// WithAppliedMessage sets the AppliedMessage 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 AppliedMessage field is set to the value of the last call. +func (b *AggregatedStatusItemApplyConfiguration) WithAppliedMessage(value string) *AggregatedStatusItemApplyConfiguration { + b.AppliedMessage = &value + return b +} + +// WithHealth sets the Health 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 Health field is set to the value of the last call. +func (b *AggregatedStatusItemApplyConfiguration) WithHealth(value v1alpha2.ResourceHealth) *AggregatedStatusItemApplyConfiguration { + b.Health = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/bindingsnapshot.go b/pkg/generated/applyconfiguration/work/v1alpha2/bindingsnapshot.go new file mode 100644 index 000000000000..5ccf69579830 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/bindingsnapshot.go @@ -0,0 +1,62 @@ +/* +Copyright The Karmada 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 v1alpha2 + +// BindingSnapshotApplyConfiguration represents a declarative configuration of the BindingSnapshot type for use +// with apply. +type BindingSnapshotApplyConfiguration struct { + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + Clusters []TargetClusterApplyConfiguration `json:"clusters,omitempty"` +} + +// BindingSnapshotApplyConfiguration constructs a declarative configuration of the BindingSnapshot type for use with +// apply. +func BindingSnapshot() *BindingSnapshotApplyConfiguration { + return &BindingSnapshotApplyConfiguration{} +} + +// 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 *BindingSnapshotApplyConfiguration) WithNamespace(value string) *BindingSnapshotApplyConfiguration { + b.Namespace = &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 *BindingSnapshotApplyConfiguration) WithName(value string) *BindingSnapshotApplyConfiguration { + b.Name = &value + return b +} + +// WithClusters adds the given value to the Clusters 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 Clusters field. +func (b *BindingSnapshotApplyConfiguration) WithClusters(values ...*TargetClusterApplyConfiguration) *BindingSnapshotApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithClusters") + } + b.Clusters = append(b.Clusters, *values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/clusterresourcebinding.go b/pkg/generated/applyconfiguration/work/v1alpha2/clusterresourcebinding.go new file mode 100644 index 000000000000..393e070a5afb --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/clusterresourcebinding.go @@ -0,0 +1,224 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ClusterResourceBindingApplyConfiguration represents a declarative configuration of the ClusterResourceBinding type for use +// with apply. +type ClusterResourceBindingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ResourceBindingSpecApplyConfiguration `json:"spec,omitempty"` + Status *ResourceBindingStatusApplyConfiguration `json:"status,omitempty"` +} + +// ClusterResourceBinding constructs a declarative configuration of the ClusterResourceBinding type for use with +// apply. +func ClusterResourceBinding(name string) *ClusterResourceBindingApplyConfiguration { + b := &ClusterResourceBindingApplyConfiguration{} + b.WithName(name) + b.WithKind("ClusterResourceBinding") + b.WithAPIVersion("work.karmada.io/v1alpha2") + 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 *ClusterResourceBindingApplyConfiguration) WithKind(value string) *ClusterResourceBindingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithAPIVersion(value string) *ClusterResourceBindingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithName(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithGenerateName(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithNamespace(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithUID(value types.UID) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithResourceVersion(value string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithGeneration(value int64) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ClusterResourceBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ClusterResourceBindingApplyConfiguration) WithLabels(entries map[string]string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ClusterResourceBindingApplyConfiguration) WithAnnotations(entries map[string]string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ClusterResourceBindingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ClusterResourceBindingApplyConfiguration) WithFinalizers(values ...string) *ClusterResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ClusterResourceBindingApplyConfiguration) 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 *ClusterResourceBindingApplyConfiguration) WithSpec(value *ResourceBindingSpecApplyConfiguration) *ClusterResourceBindingApplyConfiguration { + 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 *ClusterResourceBindingApplyConfiguration) WithStatus(value *ResourceBindingStatusApplyConfiguration) *ClusterResourceBindingApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ClusterResourceBindingApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/gracefulevictiontask.go b/pkg/generated/applyconfiguration/work/v1alpha2/gracefulevictiontask.go new file mode 100644 index 000000000000..d5d5782d3bc8 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/gracefulevictiontask.go @@ -0,0 +1,142 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GracefulEvictionTaskApplyConfiguration represents a declarative configuration of the GracefulEvictionTask type for use +// with apply. +type GracefulEvictionTaskApplyConfiguration struct { + FromCluster *string `json:"fromCluster,omitempty"` + PurgeMode *v1alpha1.PurgeMode `json:"purgeMode,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + Producer *string `json:"producer,omitempty"` + GracePeriodSeconds *int32 `json:"gracePeriodSeconds,omitempty"` + SuppressDeletion *bool `json:"suppressDeletion,omitempty"` + PreservedLabelState map[string]string `json:"preservedLabelState,omitempty"` + CreationTimestamp *v1.Time `json:"creationTimestamp,omitempty"` + ClustersBeforeFailover []string `json:"clustersBeforeFailover,omitempty"` +} + +// GracefulEvictionTaskApplyConfiguration constructs a declarative configuration of the GracefulEvictionTask type for use with +// apply. +func GracefulEvictionTask() *GracefulEvictionTaskApplyConfiguration { + return &GracefulEvictionTaskApplyConfiguration{} +} + +// WithFromCluster sets the FromCluster 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 FromCluster field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithFromCluster(value string) *GracefulEvictionTaskApplyConfiguration { + b.FromCluster = &value + return b +} + +// WithPurgeMode sets the PurgeMode 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 PurgeMode field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithPurgeMode(value v1alpha1.PurgeMode) *GracefulEvictionTaskApplyConfiguration { + b.PurgeMode = &value + return b +} + +// WithReplicas sets the Replicas 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 Replicas field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithReplicas(value int32) *GracefulEvictionTaskApplyConfiguration { + b.Replicas = &value + return b +} + +// WithReason sets the Reason 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 Reason field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithReason(value string) *GracefulEvictionTaskApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message 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 Message field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithMessage(value string) *GracefulEvictionTaskApplyConfiguration { + b.Message = &value + return b +} + +// WithProducer sets the Producer 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 Producer field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithProducer(value string) *GracefulEvictionTaskApplyConfiguration { + b.Producer = &value + return b +} + +// WithGracePeriodSeconds sets the GracePeriodSeconds 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 GracePeriodSeconds field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithGracePeriodSeconds(value int32) *GracefulEvictionTaskApplyConfiguration { + b.GracePeriodSeconds = &value + return b +} + +// WithSuppressDeletion sets the SuppressDeletion 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 SuppressDeletion field is set to the value of the last call. +func (b *GracefulEvictionTaskApplyConfiguration) WithSuppressDeletion(value bool) *GracefulEvictionTaskApplyConfiguration { + b.SuppressDeletion = &value + return b +} + +// WithPreservedLabelState puts the entries into the PreservedLabelState 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 PreservedLabelState field, +// overwriting an existing map entries in PreservedLabelState field with the same key. +func (b *GracefulEvictionTaskApplyConfiguration) WithPreservedLabelState(entries map[string]string) *GracefulEvictionTaskApplyConfiguration { + if b.PreservedLabelState == nil && len(entries) > 0 { + b.PreservedLabelState = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.PreservedLabelState[k] = v + } + 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 *GracefulEvictionTaskApplyConfiguration) WithCreationTimestamp(value v1.Time) *GracefulEvictionTaskApplyConfiguration { + b.CreationTimestamp = &value + return b +} + +// WithClustersBeforeFailover adds the given value to the ClustersBeforeFailover 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 ClustersBeforeFailover field. +func (b *GracefulEvictionTaskApplyConfiguration) WithClustersBeforeFailover(values ...string) *GracefulEvictionTaskApplyConfiguration { + for i := range values { + b.ClustersBeforeFailover = append(b.ClustersBeforeFailover, values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/nodeclaim.go b/pkg/generated/applyconfiguration/work/v1alpha2/nodeclaim.go new file mode 100644 index 000000000000..3cd90f656175 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/nodeclaim.go @@ -0,0 +1,69 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NodeClaimApplyConfiguration represents a declarative configuration of the NodeClaim type for use +// with apply. +type NodeClaimApplyConfiguration struct { + HardNodeAffinity *v1.NodeSelector `json:"hardNodeAffinity,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + Tolerations []v1.Toleration `json:"tolerations,omitempty"` +} + +// NodeClaimApplyConfiguration constructs a declarative configuration of the NodeClaim type for use with +// apply. +func NodeClaim() *NodeClaimApplyConfiguration { + return &NodeClaimApplyConfiguration{} +} + +// WithHardNodeAffinity sets the HardNodeAffinity 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 HardNodeAffinity field is set to the value of the last call. +func (b *NodeClaimApplyConfiguration) WithHardNodeAffinity(value v1.NodeSelector) *NodeClaimApplyConfiguration { + b.HardNodeAffinity = &value + return b +} + +// WithNodeSelector puts the entries into the NodeSelector 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 NodeSelector field, +// overwriting an existing map entries in NodeSelector field with the same key. +func (b *NodeClaimApplyConfiguration) WithNodeSelector(entries map[string]string) *NodeClaimApplyConfiguration { + if b.NodeSelector == nil && len(entries) > 0 { + b.NodeSelector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.NodeSelector[k] = v + } + return b +} + +// WithTolerations adds the given value to the Tolerations 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 Tolerations field. +func (b *NodeClaimApplyConfiguration) WithTolerations(values ...v1.Toleration) *NodeClaimApplyConfiguration { + for i := range values { + b.Tolerations = append(b.Tolerations, values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/objectreference.go b/pkg/generated/applyconfiguration/work/v1alpha2/objectreference.go new file mode 100644 index 000000000000..a4e90700eabf --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/objectreference.go @@ -0,0 +1,88 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// ObjectReferenceApplyConfiguration represents a declarative configuration of the ObjectReference type for use +// with apply. +type ObjectReferenceApplyConfiguration struct { + APIVersion *string `json:"apiVersion,omitempty"` + Kind *string `json:"kind,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Name *string `json:"name,omitempty"` + UID *types.UID `json:"uid,omitempty"` + ResourceVersion *string `json:"resourceVersion,omitempty"` +} + +// ObjectReferenceApplyConfiguration constructs a declarative configuration of the ObjectReference type for use with +// apply. +func ObjectReference() *ObjectReferenceApplyConfiguration { + return &ObjectReferenceApplyConfiguration{} +} + +// 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 *ObjectReferenceApplyConfiguration) WithAPIVersion(value string) *ObjectReferenceApplyConfiguration { + b.APIVersion = &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 *ObjectReferenceApplyConfiguration) WithKind(value string) *ObjectReferenceApplyConfiguration { + b.Kind = &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 *ObjectReferenceApplyConfiguration) WithNamespace(value string) *ObjectReferenceApplyConfiguration { + b.Namespace = &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 *ObjectReferenceApplyConfiguration) WithName(value string) *ObjectReferenceApplyConfiguration { + b.Name = &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 *ObjectReferenceApplyConfiguration) WithUID(value types.UID) *ObjectReferenceApplyConfiguration { + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithResourceVersion(value string) *ObjectReferenceApplyConfiguration { + b.ResourceVersion = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/replicarequirements.go b/pkg/generated/applyconfiguration/work/v1alpha2/replicarequirements.go new file mode 100644 index 000000000000..9c405eac2293 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/replicarequirements.go @@ -0,0 +1,70 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ReplicaRequirementsApplyConfiguration represents a declarative configuration of the ReplicaRequirements type for use +// with apply. +type ReplicaRequirementsApplyConfiguration struct { + NodeClaim *NodeClaimApplyConfiguration `json:"nodeClaim,omitempty"` + ResourceRequest *v1.ResourceList `json:"resourceRequest,omitempty"` + Namespace *string `json:"namespace,omitempty"` + PriorityClassName *string `json:"priorityClassName,omitempty"` +} + +// ReplicaRequirementsApplyConfiguration constructs a declarative configuration of the ReplicaRequirements type for use with +// apply. +func ReplicaRequirements() *ReplicaRequirementsApplyConfiguration { + return &ReplicaRequirementsApplyConfiguration{} +} + +// WithNodeClaim sets the NodeClaim 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 NodeClaim field is set to the value of the last call. +func (b *ReplicaRequirementsApplyConfiguration) WithNodeClaim(value *NodeClaimApplyConfiguration) *ReplicaRequirementsApplyConfiguration { + b.NodeClaim = value + return b +} + +// WithResourceRequest sets the ResourceRequest 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 ResourceRequest field is set to the value of the last call. +func (b *ReplicaRequirementsApplyConfiguration) WithResourceRequest(value v1.ResourceList) *ReplicaRequirementsApplyConfiguration { + b.ResourceRequest = &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 *ReplicaRequirementsApplyConfiguration) WithNamespace(value string) *ReplicaRequirementsApplyConfiguration { + b.Namespace = &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 *ReplicaRequirementsApplyConfiguration) WithPriorityClassName(value string) *ReplicaRequirementsApplyConfiguration { + b.PriorityClassName = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/resourcebinding.go b/pkg/generated/applyconfiguration/work/v1alpha2/resourcebinding.go new file mode 100644 index 000000000000..2dcdbbc8014f --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/resourcebinding.go @@ -0,0 +1,225 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceBindingApplyConfiguration represents a declarative configuration of the ResourceBinding type for use +// with apply. +type ResourceBindingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ResourceBindingSpecApplyConfiguration `json:"spec,omitempty"` + Status *ResourceBindingStatusApplyConfiguration `json:"status,omitempty"` +} + +// ResourceBinding constructs a declarative configuration of the ResourceBinding type for use with +// apply. +func ResourceBinding(name, namespace string) *ResourceBindingApplyConfiguration { + b := &ResourceBindingApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ResourceBinding") + b.WithAPIVersion("work.karmada.io/v1alpha2") + 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 *ResourceBindingApplyConfiguration) WithKind(value string) *ResourceBindingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithAPIVersion(value string) *ResourceBindingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithName(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithGenerateName(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithNamespace(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithUID(value types.UID) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithResourceVersion(value string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithGeneration(value int64) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ResourceBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ResourceBindingApplyConfiguration) WithLabels(entries map[string]string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ResourceBindingApplyConfiguration) WithAnnotations(entries map[string]string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ResourceBindingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ResourceBindingApplyConfiguration) WithFinalizers(values ...string) *ResourceBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *ResourceBindingApplyConfiguration) 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 *ResourceBindingApplyConfiguration) WithSpec(value *ResourceBindingSpecApplyConfiguration) *ResourceBindingApplyConfiguration { + 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 *ResourceBindingApplyConfiguration) WithStatus(value *ResourceBindingStatusApplyConfiguration) *ResourceBindingApplyConfiguration { + b.Status = value + return b +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ResourceBindingApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/resourcebindingspec.go b/pkg/generated/applyconfiguration/work/v1alpha2/resourcebindingspec.go new file mode 100644 index 000000000000..da0aea16b19a --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/resourcebindingspec.go @@ -0,0 +1,176 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ResourceBindingSpecApplyConfiguration represents a declarative configuration of the ResourceBindingSpec type for use +// with apply. +type ResourceBindingSpecApplyConfiguration struct { + Resource *ObjectReferenceApplyConfiguration `json:"resource,omitempty"` + PropagateDeps *bool `json:"propagateDeps,omitempty"` + ReplicaRequirements *ReplicaRequirementsApplyConfiguration `json:"replicaRequirements,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` + Clusters []TargetClusterApplyConfiguration `json:"clusters,omitempty"` + Placement *v1alpha1.Placement `json:"placement,omitempty"` + GracefulEvictionTasks []GracefulEvictionTaskApplyConfiguration `json:"gracefulEvictionTasks,omitempty"` + RequiredBy []BindingSnapshotApplyConfiguration `json:"requiredBy,omitempty"` + SchedulerName *string `json:"schedulerName,omitempty"` + Failover *v1alpha1.FailoverBehavior `json:"failover,omitempty"` + ConflictResolution *v1alpha1.ConflictResolution `json:"conflictResolution,omitempty"` + RescheduleTriggeredAt *v1.Time `json:"rescheduleTriggeredAt,omitempty"` + Suspension *SuspensionApplyConfiguration `json:"suspension,omitempty"` + PreserveResourcesOnDeletion *bool `json:"preserveResourcesOnDeletion,omitempty"` +} + +// ResourceBindingSpecApplyConfiguration constructs a declarative configuration of the ResourceBindingSpec type for use with +// apply. +func ResourceBindingSpec() *ResourceBindingSpecApplyConfiguration { + return &ResourceBindingSpecApplyConfiguration{} +} + +// WithResource sets the Resource 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 Resource field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithResource(value *ObjectReferenceApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + b.Resource = value + return b +} + +// WithPropagateDeps sets the PropagateDeps 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 PropagateDeps field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithPropagateDeps(value bool) *ResourceBindingSpecApplyConfiguration { + b.PropagateDeps = &value + return b +} + +// WithReplicaRequirements sets the ReplicaRequirements 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 ReplicaRequirements field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithReplicaRequirements(value *ReplicaRequirementsApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + b.ReplicaRequirements = value + return b +} + +// WithReplicas sets the Replicas 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 Replicas field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithReplicas(value int32) *ResourceBindingSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithClusters adds the given value to the Clusters 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 Clusters field. +func (b *ResourceBindingSpecApplyConfiguration) WithClusters(values ...*TargetClusterApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithClusters") + } + b.Clusters = append(b.Clusters, *values[i]) + } + return b +} + +// WithPlacement sets the Placement 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 Placement field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithPlacement(value v1alpha1.Placement) *ResourceBindingSpecApplyConfiguration { + b.Placement = &value + return b +} + +// WithGracefulEvictionTasks adds the given value to the GracefulEvictionTasks 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 GracefulEvictionTasks field. +func (b *ResourceBindingSpecApplyConfiguration) WithGracefulEvictionTasks(values ...*GracefulEvictionTaskApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithGracefulEvictionTasks") + } + b.GracefulEvictionTasks = append(b.GracefulEvictionTasks, *values[i]) + } + return b +} + +// WithRequiredBy adds the given value to the RequiredBy 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 RequiredBy field. +func (b *ResourceBindingSpecApplyConfiguration) WithRequiredBy(values ...*BindingSnapshotApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRequiredBy") + } + b.RequiredBy = append(b.RequiredBy, *values[i]) + } + return b +} + +// WithSchedulerName sets the SchedulerName 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 SchedulerName field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithSchedulerName(value string) *ResourceBindingSpecApplyConfiguration { + b.SchedulerName = &value + return b +} + +// WithFailover sets the Failover 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 Failover field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithFailover(value v1alpha1.FailoverBehavior) *ResourceBindingSpecApplyConfiguration { + b.Failover = &value + return b +} + +// WithConflictResolution sets the ConflictResolution 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 ConflictResolution field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithConflictResolution(value v1alpha1.ConflictResolution) *ResourceBindingSpecApplyConfiguration { + b.ConflictResolution = &value + return b +} + +// WithRescheduleTriggeredAt sets the RescheduleTriggeredAt 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 RescheduleTriggeredAt field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithRescheduleTriggeredAt(value v1.Time) *ResourceBindingSpecApplyConfiguration { + b.RescheduleTriggeredAt = &value + return b +} + +// WithSuspension sets the Suspension 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 Suspension field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithSuspension(value *SuspensionApplyConfiguration) *ResourceBindingSpecApplyConfiguration { + b.Suspension = value + return b +} + +// WithPreserveResourcesOnDeletion sets the PreserveResourcesOnDeletion 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 PreserveResourcesOnDeletion field is set to the value of the last call. +func (b *ResourceBindingSpecApplyConfiguration) WithPreserveResourcesOnDeletion(value bool) *ResourceBindingSpecApplyConfiguration { + b.PreserveResourcesOnDeletion = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/resourcebindingstatus.go b/pkg/generated/applyconfiguration/work/v1alpha2/resourcebindingstatus.go new file mode 100644 index 000000000000..5930c7e9bd77 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/resourcebindingstatus.go @@ -0,0 +1,90 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourceBindingStatusApplyConfiguration represents a declarative configuration of the ResourceBindingStatus type for use +// with apply. +type ResourceBindingStatusApplyConfiguration struct { + SchedulerObservedGeneration *int64 `json:"schedulerObservedGeneration,omitempty"` + SchedulerObservedAffinityName *string `json:"schedulerObservingAffinityName,omitempty"` + LastScheduledTime *v1.Time `json:"lastScheduledTime,omitempty"` + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` + AggregatedStatus []AggregatedStatusItemApplyConfiguration `json:"aggregatedStatus,omitempty"` +} + +// ResourceBindingStatusApplyConfiguration constructs a declarative configuration of the ResourceBindingStatus type for use with +// apply. +func ResourceBindingStatus() *ResourceBindingStatusApplyConfiguration { + return &ResourceBindingStatusApplyConfiguration{} +} + +// WithSchedulerObservedGeneration sets the SchedulerObservedGeneration 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 SchedulerObservedGeneration field is set to the value of the last call. +func (b *ResourceBindingStatusApplyConfiguration) WithSchedulerObservedGeneration(value int64) *ResourceBindingStatusApplyConfiguration { + b.SchedulerObservedGeneration = &value + return b +} + +// WithSchedulerObservedAffinityName sets the SchedulerObservedAffinityName 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 SchedulerObservedAffinityName field is set to the value of the last call. +func (b *ResourceBindingStatusApplyConfiguration) WithSchedulerObservedAffinityName(value string) *ResourceBindingStatusApplyConfiguration { + b.SchedulerObservedAffinityName = &value + return b +} + +// WithLastScheduledTime sets the LastScheduledTime 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 LastScheduledTime field is set to the value of the last call. +func (b *ResourceBindingStatusApplyConfiguration) WithLastScheduledTime(value v1.Time) *ResourceBindingStatusApplyConfiguration { + b.LastScheduledTime = &value + return b +} + +// 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 *ResourceBindingStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *ResourceBindingStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAggregatedStatus adds the given value to the AggregatedStatus 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 AggregatedStatus field. +func (b *ResourceBindingStatusApplyConfiguration) WithAggregatedStatus(values ...*AggregatedStatusItemApplyConfiguration) *ResourceBindingStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAggregatedStatus") + } + b.AggregatedStatus = append(b.AggregatedStatus, *values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/suspension.go b/pkg/generated/applyconfiguration/work/v1alpha2/suspension.go new file mode 100644 index 000000000000..3ee8a54944b6 --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/suspension.go @@ -0,0 +1,60 @@ +/* +Copyright The Karmada 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 v1alpha2 + +import ( + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" +) + +// SuspensionApplyConfiguration represents a declarative configuration of the Suspension type for use +// with apply. +type SuspensionApplyConfiguration struct { + v1alpha1.Suspension `json:",inline"` + Scheduling *bool `json:"scheduling,omitempty"` +} + +// SuspensionApplyConfiguration constructs a declarative configuration of the Suspension type for use with +// apply. +func Suspension() *SuspensionApplyConfiguration { + return &SuspensionApplyConfiguration{} +} + +// WithDispatching sets the Dispatching 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 Dispatching field is set to the value of the last call. +func (b *SuspensionApplyConfiguration) WithDispatching(value bool) *SuspensionApplyConfiguration { + b.Dispatching = &value + return b +} + +// WithDispatchingOnClusters sets the DispatchingOnClusters 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 DispatchingOnClusters field is set to the value of the last call. +func (b *SuspensionApplyConfiguration) WithDispatchingOnClusters(value v1alpha1.SuspendClusters) *SuspensionApplyConfiguration { + b.DispatchingOnClusters = &value + return b +} + +// WithScheduling sets the Scheduling 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 Scheduling field is set to the value of the last call. +func (b *SuspensionApplyConfiguration) WithScheduling(value bool) *SuspensionApplyConfiguration { + b.Scheduling = &value + return b +} diff --git a/pkg/generated/applyconfiguration/work/v1alpha2/targetcluster.go b/pkg/generated/applyconfiguration/work/v1alpha2/targetcluster.go new file mode 100644 index 000000000000..827609c77eac --- /dev/null +++ b/pkg/generated/applyconfiguration/work/v1alpha2/targetcluster.go @@ -0,0 +1,48 @@ +/* +Copyright The Karmada 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 v1alpha2 + +// TargetClusterApplyConfiguration represents a declarative configuration of the TargetCluster type for use +// with apply. +type TargetClusterApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Replicas *int32 `json:"replicas,omitempty"` +} + +// TargetClusterApplyConfiguration constructs a declarative configuration of the TargetCluster type for use with +// apply. +func TargetCluster() *TargetClusterApplyConfiguration { + return &TargetClusterApplyConfiguration{} +} + +// 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 *TargetClusterApplyConfiguration) WithName(value string) *TargetClusterApplyConfiguration { + b.Name = &value + return b +} + +// WithReplicas sets the Replicas 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 Replicas field is set to the value of the last call. +func (b *TargetClusterApplyConfiguration) WithReplicas(value int32) *TargetClusterApplyConfiguration { + b.Replicas = &value + return b +} diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha1/clusterresourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha1/clusterresourcebinding.go index cebf583fccf0..0a42346c28ca 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha1/clusterresourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha1/clusterresourcebinding.go @@ -22,6 +22,7 @@ import ( "context" v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha1" scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -47,18 +48,21 @@ type ClusterResourceBindingInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterResourceBindingList, 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 *v1alpha1.ClusterResourceBinding, err error) + Apply(ctx context.Context, clusterResourceBinding *workv1alpha1.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterResourceBinding, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, clusterResourceBinding *workv1alpha1.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterResourceBinding, err error) ClusterResourceBindingExpansion } // clusterResourceBindings implements ClusterResourceBindingInterface type clusterResourceBindings struct { - *gentype.ClientWithList[*v1alpha1.ClusterResourceBinding, *v1alpha1.ClusterResourceBindingList] + *gentype.ClientWithListAndApply[*v1alpha1.ClusterResourceBinding, *v1alpha1.ClusterResourceBindingList, *workv1alpha1.ClusterResourceBindingApplyConfiguration] } // newClusterResourceBindings returns a ClusterResourceBindings func newClusterResourceBindings(c *WorkV1alpha1Client) *clusterResourceBindings { return &clusterResourceBindings{ - gentype.NewClientWithList[*v1alpha1.ClusterResourceBinding, *v1alpha1.ClusterResourceBindingList]( + gentype.NewClientWithListAndApply[*v1alpha1.ClusterResourceBinding, *v1alpha1.ClusterResourceBindingList, *workv1alpha1.ClusterResourceBindingApplyConfiguration]( "clusterresourcebindings", c.RESTClient(), scheme.ParameterCodec, diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_clusterresourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_clusterresourcebinding.go index dc83e2016246..2c4bac6e02ed 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_clusterresourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_clusterresourcebinding.go @@ -20,8 +20,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -136,3 +139,48 @@ func (c *FakeClusterResourceBindings) Patch(ctx context.Context, name string, pt } return obj.(*v1alpha1.ClusterResourceBinding), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterResourceBinding. +func (c *FakeClusterResourceBindings) Apply(ctx context.Context, clusterResourceBinding *workv1alpha1.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterResourceBinding, err error) { + if clusterResourceBinding == nil { + return nil, fmt.Errorf("clusterResourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(clusterResourceBinding) + if err != nil { + return nil, err + } + name := clusterResourceBinding.Name + if name == nil { + return nil, fmt.Errorf("clusterResourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha1.ClusterResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterresourcebindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ClusterResourceBinding), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeClusterResourceBindings) ApplyStatus(ctx context.Context, clusterResourceBinding *workv1alpha1.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ClusterResourceBinding, err error) { + if clusterResourceBinding == nil { + return nil, fmt.Errorf("clusterResourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(clusterResourceBinding) + if err != nil { + return nil, err + } + name := clusterResourceBinding.Name + if name == nil { + return nil, fmt.Errorf("clusterResourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha1.ClusterResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterresourcebindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ClusterResourceBinding), err +} diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_resourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_resourcebinding.go index 8d2f061d6ff1..960a6a5423b9 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_resourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_resourcebinding.go @@ -20,8 +20,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -145,3 +148,50 @@ func (c *FakeResourceBindings) Patch(ctx context.Context, name string, pt types. } return obj.(*v1alpha1.ResourceBinding), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceBinding. +func (c *FakeResourceBindings) Apply(ctx context.Context, resourceBinding *workv1alpha1.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ResourceBinding, err error) { + if resourceBinding == nil { + return nil, fmt.Errorf("resourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(resourceBinding) + if err != nil { + return nil, err + } + name := resourceBinding.Name + if name == nil { + return nil, fmt.Errorf("resourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha1.ResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(resourcebindingsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ResourceBinding), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResourceBindings) ApplyStatus(ctx context.Context, resourceBinding *workv1alpha1.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ResourceBinding, err error) { + if resourceBinding == nil { + return nil, fmt.Errorf("resourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(resourceBinding) + if err != nil { + return nil, err + } + name := resourceBinding.Name + if name == nil { + return nil, fmt.Errorf("resourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha1.ResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(resourcebindingsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.ResourceBinding), err +} diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_work.go b/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_work.go index 7123c9c793bc..f4bf8b726676 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_work.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha1/fake/fake_work.go @@ -20,8 +20,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -145,3 +148,50 @@ func (c *FakeWorks) Patch(ctx context.Context, name string, pt types.PatchType, } return obj.(*v1alpha1.Work), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied work. +func (c *FakeWorks) Apply(ctx context.Context, work *workv1alpha1.WorkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Work, err error) { + if work == nil { + return nil, fmt.Errorf("work provided to Apply must not be nil") + } + data, err := json.Marshal(work) + if err != nil { + return nil, err + } + name := work.Name + if name == nil { + return nil, fmt.Errorf("work.Name must be provided to Apply") + } + emptyResult := &v1alpha1.Work{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(worksResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Work), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeWorks) ApplyStatus(ctx context.Context, work *workv1alpha1.WorkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Work, err error) { + if work == nil { + return nil, fmt.Errorf("work provided to Apply must not be nil") + } + data, err := json.Marshal(work) + if err != nil { + return nil, err + } + name := work.Name + if name == nil { + return nil, fmt.Errorf("work.Name must be provided to Apply") + } + emptyResult := &v1alpha1.Work{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(worksResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.Work), err +} diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha1/resourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha1/resourcebinding.go index 3747ad9b69b9..cf4c3736f59c 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha1/resourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha1/resourcebinding.go @@ -22,6 +22,7 @@ import ( "context" v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha1" scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -47,18 +48,21 @@ type ResourceBindingInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ResourceBindingList, 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 *v1alpha1.ResourceBinding, err error) + Apply(ctx context.Context, resourceBinding *workv1alpha1.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ResourceBinding, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, resourceBinding *workv1alpha1.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.ResourceBinding, err error) ResourceBindingExpansion } // resourceBindings implements ResourceBindingInterface type resourceBindings struct { - *gentype.ClientWithList[*v1alpha1.ResourceBinding, *v1alpha1.ResourceBindingList] + *gentype.ClientWithListAndApply[*v1alpha1.ResourceBinding, *v1alpha1.ResourceBindingList, *workv1alpha1.ResourceBindingApplyConfiguration] } // newResourceBindings returns a ResourceBindings func newResourceBindings(c *WorkV1alpha1Client, namespace string) *resourceBindings { return &resourceBindings{ - gentype.NewClientWithList[*v1alpha1.ResourceBinding, *v1alpha1.ResourceBindingList]( + gentype.NewClientWithListAndApply[*v1alpha1.ResourceBinding, *v1alpha1.ResourceBindingList, *workv1alpha1.ResourceBindingApplyConfiguration]( "resourcebindings", c.RESTClient(), scheme.ParameterCodec, diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha1/work.go b/pkg/generated/clientset/versioned/typed/work/v1alpha1/work.go index 642f6b2088a9..d1930b7cf20a 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha1/work.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha1/work.go @@ -22,6 +22,7 @@ import ( "context" v1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" + workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha1" scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -47,18 +48,21 @@ type WorkInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.WorkList, 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 *v1alpha1.Work, err error) + Apply(ctx context.Context, work *workv1alpha1.WorkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Work, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, work *workv1alpha1.WorkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Work, err error) WorkExpansion } // works implements WorkInterface type works struct { - *gentype.ClientWithList[*v1alpha1.Work, *v1alpha1.WorkList] + *gentype.ClientWithListAndApply[*v1alpha1.Work, *v1alpha1.WorkList, *workv1alpha1.WorkApplyConfiguration] } // newWorks returns a Works func newWorks(c *WorkV1alpha1Client, namespace string) *works { return &works{ - gentype.NewClientWithList[*v1alpha1.Work, *v1alpha1.WorkList]( + gentype.NewClientWithListAndApply[*v1alpha1.Work, *v1alpha1.WorkList, *workv1alpha1.WorkApplyConfiguration]( "works", c.RESTClient(), scheme.ParameterCodec, diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha2/clusterresourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha2/clusterresourcebinding.go index c5f042cbf571..5bf2ea573d59 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha2/clusterresourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha2/clusterresourcebinding.go @@ -22,6 +22,7 @@ import ( "context" v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" + workv1alpha2 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha2" scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -47,18 +48,21 @@ type ClusterResourceBindingInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.ClusterResourceBindingList, 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 *v1alpha2.ClusterResourceBinding, err error) + Apply(ctx context.Context, clusterResourceBinding *workv1alpha2.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ClusterResourceBinding, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, clusterResourceBinding *workv1alpha2.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ClusterResourceBinding, err error) ClusterResourceBindingExpansion } // clusterResourceBindings implements ClusterResourceBindingInterface type clusterResourceBindings struct { - *gentype.ClientWithList[*v1alpha2.ClusterResourceBinding, *v1alpha2.ClusterResourceBindingList] + *gentype.ClientWithListAndApply[*v1alpha2.ClusterResourceBinding, *v1alpha2.ClusterResourceBindingList, *workv1alpha2.ClusterResourceBindingApplyConfiguration] } // newClusterResourceBindings returns a ClusterResourceBindings func newClusterResourceBindings(c *WorkV1alpha2Client) *clusterResourceBindings { return &clusterResourceBindings{ - gentype.NewClientWithList[*v1alpha2.ClusterResourceBinding, *v1alpha2.ClusterResourceBindingList]( + gentype.NewClientWithListAndApply[*v1alpha2.ClusterResourceBinding, *v1alpha2.ClusterResourceBindingList, *workv1alpha2.ClusterResourceBindingApplyConfiguration]( "clusterresourcebindings", c.RESTClient(), scheme.ParameterCodec, diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_clusterresourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_clusterresourcebinding.go index e510914b9ae7..96c3cf46dfcf 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_clusterresourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_clusterresourcebinding.go @@ -20,8 +20,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" + workv1alpha2 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -136,3 +139,48 @@ func (c *FakeClusterResourceBindings) Patch(ctx context.Context, name string, pt } return obj.(*v1alpha2.ClusterResourceBinding), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied clusterResourceBinding. +func (c *FakeClusterResourceBindings) Apply(ctx context.Context, clusterResourceBinding *workv1alpha2.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ClusterResourceBinding, err error) { + if clusterResourceBinding == nil { + return nil, fmt.Errorf("clusterResourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(clusterResourceBinding) + if err != nil { + return nil, err + } + name := clusterResourceBinding.Name + if name == nil { + return nil, fmt.Errorf("clusterResourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha2.ClusterResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterresourcebindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.ClusterResourceBinding), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeClusterResourceBindings) ApplyStatus(ctx context.Context, clusterResourceBinding *workv1alpha2.ClusterResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ClusterResourceBinding, err error) { + if clusterResourceBinding == nil { + return nil, fmt.Errorf("clusterResourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(clusterResourceBinding) + if err != nil { + return nil, err + } + name := clusterResourceBinding.Name + if name == nil { + return nil, fmt.Errorf("clusterResourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha2.ClusterResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceActionWithOptions(clusterresourcebindingsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.ClusterResourceBinding), err +} diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_resourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_resourcebinding.go index b5f861801aa9..b767f9de6c86 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_resourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha2/fake/fake_resourcebinding.go @@ -20,8 +20,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" + workv1alpha2 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -145,3 +148,50 @@ func (c *FakeResourceBindings) Patch(ctx context.Context, name string, pt types. } return obj.(*v1alpha2.ResourceBinding), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied resourceBinding. +func (c *FakeResourceBindings) Apply(ctx context.Context, resourceBinding *workv1alpha2.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ResourceBinding, err error) { + if resourceBinding == nil { + return nil, fmt.Errorf("resourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(resourceBinding) + if err != nil { + return nil, err + } + name := resourceBinding.Name + if name == nil { + return nil, fmt.Errorf("resourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha2.ResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(resourcebindingsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.ResourceBinding), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeResourceBindings) ApplyStatus(ctx context.Context, resourceBinding *workv1alpha2.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ResourceBinding, err error) { + if resourceBinding == nil { + return nil, fmt.Errorf("resourceBinding provided to Apply must not be nil") + } + data, err := json.Marshal(resourceBinding) + if err != nil { + return nil, err + } + name := resourceBinding.Name + if name == nil { + return nil, fmt.Errorf("resourceBinding.Name must be provided to Apply") + } + emptyResult := &v1alpha2.ResourceBinding{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(resourcebindingsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha2.ResourceBinding), err +} diff --git a/pkg/generated/clientset/versioned/typed/work/v1alpha2/resourcebinding.go b/pkg/generated/clientset/versioned/typed/work/v1alpha2/resourcebinding.go index 19d1fc9ddef3..2a469911cac6 100644 --- a/pkg/generated/clientset/versioned/typed/work/v1alpha2/resourcebinding.go +++ b/pkg/generated/clientset/versioned/typed/work/v1alpha2/resourcebinding.go @@ -22,6 +22,7 @@ import ( "context" v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" + workv1alpha2 "github.com/karmada-io/karmada/pkg/generated/applyconfiguration/work/v1alpha2" scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -47,18 +48,21 @@ type ResourceBindingInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.ResourceBindingList, 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 *v1alpha2.ResourceBinding, err error) + Apply(ctx context.Context, resourceBinding *workv1alpha2.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ResourceBinding, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, resourceBinding *workv1alpha2.ResourceBindingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ResourceBinding, err error) ResourceBindingExpansion } // resourceBindings implements ResourceBindingInterface type resourceBindings struct { - *gentype.ClientWithList[*v1alpha2.ResourceBinding, *v1alpha2.ResourceBindingList] + *gentype.ClientWithListAndApply[*v1alpha2.ResourceBinding, *v1alpha2.ResourceBindingList, *workv1alpha2.ResourceBindingApplyConfiguration] } // newResourceBindings returns a ResourceBindings func newResourceBindings(c *WorkV1alpha2Client, namespace string) *resourceBindings { return &resourceBindings{ - gentype.NewClientWithList[*v1alpha2.ResourceBinding, *v1alpha2.ResourceBindingList]( + gentype.NewClientWithListAndApply[*v1alpha2.ResourceBinding, *v1alpha2.ResourceBindingList, *workv1alpha2.ResourceBindingApplyConfiguration]( "resourcebindings", c.RESTClient(), scheme.ParameterCodec, diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index ce9fadceac0e..86102c4bb884 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -7422,6 +7422,14 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingStatus(ref common.ReferenceCal }, }, "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Conditions contain the different condition statuses.", Type: []string{"array"},