From d7949bf20d7769e1d8eeb9ce1ba69c54e05dc548 Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Wed, 26 Jun 2024 17:03:38 +0800 Subject: [PATCH] Sync APIs from karmada repo based on v1.10.0 Signed-off-by: RainbowMango --- apps/v1alpha1/doc.go | 21 +++ apps/v1alpha1/workloadrebalancer_types.go | 151 ++++++++++++++++ apps/v1alpha1/zz_generated.deepcopy.go | 171 ++++++++++++++++++ apps/v1alpha1/zz_generated.register.go | 67 +++++++ .../v1alpha1/cronfederatedhpa_types.go | 2 +- autoscaling/v1alpha1/federatedhpa_types.go | 2 +- cluster/mutation/mutation_test.go | 2 +- .../resourceinterpretercustomization_types.go | 2 +- .../resourceinterpreterwebhook_types.go | 2 +- go.mod | 24 +-- go.sum | 59 +++--- networking/v1alpha1/ingress_types.go | 2 +- networking/v1alpha1/service_types.go | 2 +- .../v1alpha1/federatedresourcequota_types.go | 2 +- policy/v1alpha1/override_types.go | 4 +- policy/v1alpha1/propagation_helper_test.go | 6 +- policy/v1alpha1/propagation_types.go | 4 +- policy/v1alpha1/well_known_constants.go | 34 ++-- remedy/v1alpha1/remedy_types.go | 2 +- remedy/v1alpha1/well_known_constants.go | 28 +++ work/v1alpha1/binding_types.go | 5 +- work/v1alpha1/well_known_constants.go | 34 ---- work/v1alpha1/work_types.go | 2 +- work/v1alpha2/binding_types.go | 20 +- work/v1alpha2/binding_types_helper_test.go | 16 +- work/v1alpha2/well_known_constants.go | 25 --- work/v1alpha2/zz_generated.deepcopy.go | 8 + 27 files changed, 555 insertions(+), 142 deletions(-) create mode 100644 apps/v1alpha1/doc.go create mode 100644 apps/v1alpha1/workloadrebalancer_types.go create mode 100644 apps/v1alpha1/zz_generated.deepcopy.go create mode 100644 apps/v1alpha1/zz_generated.register.go create mode 100644 remedy/v1alpha1/well_known_constants.go delete mode 100644 work/v1alpha1/well_known_constants.go diff --git a/apps/v1alpha1/doc.go b/apps/v1alpha1/doc.go new file mode 100644 index 0000000..0232db6 --- /dev/null +++ b/apps/v1alpha1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2024 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. +*/ + +// Package v1alpha1 is the v1alpha1 version of the API. +// +k8s:deepcopy-gen=package,register +// +k8s:openapi-gen=true +// +groupName=apps.karmada.io +package v1alpha1 diff --git a/apps/v1alpha1/workloadrebalancer_types.go b/apps/v1alpha1/workloadrebalancer_types.go new file mode 100644 index 0000000..29c00b7 --- /dev/null +++ b/apps/v1alpha1/workloadrebalancer_types.go @@ -0,0 +1,151 @@ +/* +Copyright 2024 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. +*/ + +package v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + // ResourceKindWorkloadRebalancer is kind name of WorkloadRebalancer. + ResourceKindWorkloadRebalancer = "WorkloadRebalancer" + // ResourceSingularWorkloadRebalancer is singular name of WorkloadRebalancer. + ResourceSingularWorkloadRebalancer = "workloadrebalancer" + // ResourcePluralWorkloadRebalancer is kind plural name of WorkloadRebalancer. + ResourcePluralWorkloadRebalancer = "workloadrebalancers" + // ResourceNamespaceScopedWorkloadRebalancer indicates if WorkloadRebalancer is NamespaceScoped. + ResourceNamespaceScopedWorkloadRebalancer = false +) + +// +genclient +// +genclient:nonNamespaced +// +kubebuilder:resource:path=workloadrebalancers,scope="Cluster" +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// WorkloadRebalancer represents the desired behavior and status of a job which can enforces a resource rebalance. +type WorkloadRebalancer struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec represents the specification of the desired behavior of WorkloadRebalancer. + // +required + Spec WorkloadRebalancerSpec `json:"spec"` + + // Status represents the status of WorkloadRebalancer. + // +optional + Status WorkloadRebalancerStatus `json:"status,omitempty"` +} + +// WorkloadRebalancerSpec represents the specification of the desired behavior of Reschedule. +type WorkloadRebalancerSpec struct { + // Workloads used to specify the list of expected resource. + // Nil or empty list is not allowed. + // +kubebuilder:validation:MinItems=1 + // +required + Workloads []ObjectReference `json:"workloads"` + + // TTLSecondsAfterFinished limits the lifetime of a WorkloadRebalancer that has finished execution (means each + // target workload is finished with result of Successful or Failed). + // If this field is set, ttlSecondsAfterFinished after the WorkloadRebalancer finishes, it is eligible to be automatically deleted. + // If this field is unset, the WorkloadRebalancer won't be automatically deleted. + // If this field is set to zero, the WorkloadRebalancer becomes eligible to be deleted immediately after it finishes. + // +optional + TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"` +} + +// ObjectReference the expected resource. +type ObjectReference struct { + // APIVersion represents the API version of the target resource. + // +required + APIVersion string `json:"apiVersion"` + + // Kind represents the Kind of the target resource. + // +required + Kind string `json:"kind"` + + // Name of the target resource. + // +required + Name string `json:"name"` + + // Namespace of the target resource. + // Default is empty, which means it is a non-namespacescoped resource. + // +optional + Namespace string `json:"namespace,omitempty"` +} + +// WorkloadRebalancerStatus contains information about the current status of a WorkloadRebalancer +// updated periodically by schedule trigger controller. +type WorkloadRebalancerStatus struct { + // ObservedWorkloads contains information about the execution states and messages of target resources. + // +optional + ObservedWorkloads []ObservedWorkload `json:"observedWorkloads,omitempty"` + + // ObservedGeneration is the generation(.metadata.generation) observed by the controller. + // If ObservedGeneration is less than the generation in metadata means the controller hasn't confirmed + // the rebalance result or hasn't done the rebalance yet. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // FinishTime represents the finish time of rebalancer. + // +optional + FinishTime *metav1.Time `json:"finishTime,omitempty"` +} + +// ObservedWorkload the observed resource. +type ObservedWorkload struct { + // Workload the observed resource. + // +required + Workload ObjectReference `json:"workload"` + + // Result the observed rebalance result of resource. + // +optional + Result RebalanceResult `json:"result,omitempty"` + + // Reason represents a machine-readable description of why this resource rebalanced failed. + // +optional + Reason RebalanceFailedReason `json:"reason,omitempty"` +} + +// RebalanceResult the specific extent to which the resource has been rebalanced +type RebalanceResult string + +const ( + // RebalanceFailed the resource has been rebalance failed. + RebalanceFailed RebalanceResult = "Failed" + // RebalanceSuccessful the resource has been successfully rebalanced. + RebalanceSuccessful RebalanceResult = "Successful" +) + +// RebalanceFailedReason represents a machine-readable description of why this resource rebalanced failed. +type RebalanceFailedReason string + +const ( + // RebalanceObjectNotFound the resource referenced binding not found. + RebalanceObjectNotFound RebalanceFailedReason = "ReferencedBindingNotFound" +) + +// +kubebuilder:resource:scope="Cluster" +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// WorkloadRebalancerList contains a list of WorkloadRebalancer +type WorkloadRebalancerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // Items holds a list of WorkloadRebalancer. + Items []WorkloadRebalancer `json:"items"` +} diff --git a/apps/v1alpha1/zz_generated.deepcopy.go b/apps/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..8db9f10 --- /dev/null +++ b/apps/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,171 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +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 deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectReference) DeepCopyInto(out *ObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference. +func (in *ObjectReference) DeepCopy() *ObjectReference { + if in == nil { + return nil + } + out := new(ObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObservedWorkload) DeepCopyInto(out *ObservedWorkload) { + *out = *in + out.Workload = in.Workload + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObservedWorkload. +func (in *ObservedWorkload) DeepCopy() *ObservedWorkload { + if in == nil { + return nil + } + out := new(ObservedWorkload) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadRebalancer) DeepCopyInto(out *WorkloadRebalancer) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadRebalancer. +func (in *WorkloadRebalancer) DeepCopy() *WorkloadRebalancer { + if in == nil { + return nil + } + out := new(WorkloadRebalancer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WorkloadRebalancer) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadRebalancerList) DeepCopyInto(out *WorkloadRebalancerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WorkloadRebalancer, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadRebalancerList. +func (in *WorkloadRebalancerList) DeepCopy() *WorkloadRebalancerList { + if in == nil { + return nil + } + out := new(WorkloadRebalancerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WorkloadRebalancerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadRebalancerSpec) DeepCopyInto(out *WorkloadRebalancerSpec) { + *out = *in + if in.Workloads != nil { + in, out := &in.Workloads, &out.Workloads + *out = make([]ObjectReference, len(*in)) + copy(*out, *in) + } + if in.TTLSecondsAfterFinished != nil { + in, out := &in.TTLSecondsAfterFinished, &out.TTLSecondsAfterFinished + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadRebalancerSpec. +func (in *WorkloadRebalancerSpec) DeepCopy() *WorkloadRebalancerSpec { + if in == nil { + return nil + } + out := new(WorkloadRebalancerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadRebalancerStatus) DeepCopyInto(out *WorkloadRebalancerStatus) { + *out = *in + if in.ObservedWorkloads != nil { + in, out := &in.ObservedWorkloads, &out.ObservedWorkloads + *out = make([]ObservedWorkload, len(*in)) + copy(*out, *in) + } + if in.FinishTime != nil { + in, out := &in.FinishTime, &out.FinishTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadRebalancerStatus. +func (in *WorkloadRebalancerStatus) DeepCopy() *WorkloadRebalancerStatus { + if in == nil { + return nil + } + out := new(WorkloadRebalancerStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apps/v1alpha1/zz_generated.register.go b/apps/v1alpha1/zz_generated.register.go new file mode 100644 index 0000000..a97f753 --- /dev/null +++ b/apps/v1alpha1/zz_generated.register.go @@ -0,0 +1,67 @@ +/* +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 register-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "apps.karmada.io" + +// GroupVersion specifies the group and the version used to register the objects. +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// SchemeGroupVersion is group version used to register these objects +// Deprecated: use GroupVersion instead. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &WorkloadRebalancer{}, + &WorkloadRebalancerList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/autoscaling/v1alpha1/cronfederatedhpa_types.go b/autoscaling/v1alpha1/cronfederatedhpa_types.go index 36dc08a..0ae1e15 100644 --- a/autoscaling/v1alpha1/cronfederatedhpa_types.go +++ b/autoscaling/v1alpha1/cronfederatedhpa_types.go @@ -21,7 +21,7 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=cronfhpa,categories={karmada-io} +// +kubebuilder:resource:path=cronfederatedhpas,scope=Namespaced,shortName=cronfhpa,categories={karmada-io} // +kubebuilder:printcolumn:JSONPath=`.spec.scaleTargetRef.kind`,name=`REFERENCE-KIND`,type=string // +kubebuilder:printcolumn:JSONPath=`.spec.scaleTargetRef.name`,name=`REFERENCE-NAME`,type=string // +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name=`AGE`,type=date diff --git a/autoscaling/v1alpha1/federatedhpa_types.go b/autoscaling/v1alpha1/federatedhpa_types.go index 569760d..5410273 100644 --- a/autoscaling/v1alpha1/federatedhpa_types.go +++ b/autoscaling/v1alpha1/federatedhpa_types.go @@ -24,7 +24,7 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=fhpa,categories={karmada-io} +// +kubebuilder:resource:path=federatedhpas,scope=Namespaced,shortName=fhpa,categories={karmada-io} // +kubebuilder:printcolumn:JSONPath=`.spec.scaleTargetRef.kind`,name=`REFERENCE-KIND`,type=string // +kubebuilder:printcolumn:JSONPath=`.spec.scaleTargetRef.name`,name=`REFERENCE-NAME`,type=string // +kubebuilder:printcolumn:JSONPath=`.spec.minReplicas`,name=`MINPODS`,type=integer diff --git a/cluster/mutation/mutation_test.go b/cluster/mutation/mutation_test.go index 22222ac..313ab71 100644 --- a/cluster/mutation/mutation_test.go +++ b/cluster/mutation/mutation_test.go @@ -357,7 +357,7 @@ func TestSetDefaultClusterResourceModels(t *testing.T) { }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + t.Run(tt.name, func(*testing.T) { SetDefaultClusterResourceModels(tt.args.cluster) }) if !reflect.DeepEqual(tt.args.cluster.Spec.ResourceModels, tt.wantModels) { diff --git a/config/v1alpha1/resourceinterpretercustomization_types.go b/config/v1alpha1/resourceinterpretercustomization_types.go index e89f18e..f8e7b9a 100644 --- a/config/v1alpha1/resourceinterpretercustomization_types.go +++ b/config/v1alpha1/resourceinterpretercustomization_types.go @@ -34,7 +34,7 @@ const ( // +genclient // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope="Cluster" +// +kubebuilder:resource:path=resourceinterpretercustomizations,scope="Cluster",shortName=ric,categories={karmada-io} // +kubebuilder:storageversion // ResourceInterpreterCustomization describes the configuration of a specific diff --git a/config/v1alpha1/resourceinterpreterwebhook_types.go b/config/v1alpha1/resourceinterpreterwebhook_types.go index 4f03bf7..eb3e067 100644 --- a/config/v1alpha1/resourceinterpreterwebhook_types.go +++ b/config/v1alpha1/resourceinterpreterwebhook_types.go @@ -35,7 +35,7 @@ const ( // +genclient // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope="Cluster" +// +kubebuilder:resource:path=resourceinterpreterwebhookconfigurations,scope="Cluster",categories={karmada-io} // +kubebuilder:storageversion // ResourceInterpreterWebhookConfiguration describes the configuration of webhooks which take the responsibility to diff --git a/go.mod b/go.mod index 57135e7..80e392d 100644 --- a/go.mod +++ b/go.mod @@ -1,28 +1,28 @@ module github.com/karmada-io/api -go 1.20 +go 1.21.10 require ( - k8s.io/api v0.28.5 - k8s.io/apiextensions-apiserver v0.28.5 - k8s.io/apimachinery v0.28.5 - k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 - sigs.k8s.io/controller-runtime v0.16.3 + k8s.io/api v0.29.4 + k8s.io/apiextensions-apiserver v0.29.4 + k8s.io/apimachinery v0.29.4 + k8s.io/utils v0.0.0-20230726121419-3b25d923346b + sigs.k8s.io/controller-runtime v0.17.5 ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/text v0.14.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/klog/v2 v2.100.1 // indirect + k8s.io/klog/v2 v2.110.1 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 0064cb2..d2b2dbd 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,14 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -15,7 +17,9 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -24,10 +28,13 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -39,8 +46,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -49,8 +56,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -61,27 +68,29 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -k8s.io/api v0.28.5 h1:XIPNr3nBgTEaCdEiwZ+dXaO9SB4NeTOZ2pNDRrFgfb4= -k8s.io/api v0.28.5/go.mod h1:98zkTCc60iSnqqCIyCB1GI7PYDiRDYTSfL0PRIxpM4c= -k8s.io/apiextensions-apiserver v0.28.5 h1:YKW9O9T/0Gkyl6LTFDLIhCbouSRh+pHt2vMLB38Snfc= -k8s.io/apiextensions-apiserver v0.28.5/go.mod h1:7p7TQ0X9zCJLNFlOTi5dncAi2dkPsdsrcvu5ILa7PEk= -k8s.io/apimachinery v0.28.5 h1:EEj2q1qdTcv2p5wl88KavAn3VlFRjREgRu8Sm/EuMPY= -k8s.io/apimachinery v0.28.5/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg= -k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= -k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= -k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigwG62c4= -sigs.k8s.io/controller-runtime v0.16.3/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.29.4 h1:WEnF/XdxuCxdG3ayHNRR8yH3cI1B/llkWBma6bq4R3w= +k8s.io/api v0.29.4/go.mod h1:DetSv0t4FBTcEpfA84NJV3g9a7+rSzlUHk5ADAYHUv0= +k8s.io/apiextensions-apiserver v0.29.4 h1:M7hbuHU/ckbibR7yPbe6DyNWgTFKNmZDbdZKD8q1Smk= +k8s.io/apiextensions-apiserver v0.29.4/go.mod h1:TTDC9fB+0kHY2rogf5hgBR03KBKCwED+GHUsXGpR7SM= +k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q= +k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.17.5 h1:1FI9Lm7NiOOmBsgTV36/s2XrEFXnO2C4sbg/Zme72Rw= +sigs.k8s.io/controller-runtime v0.17.5/go.mod h1:N0jpP5Lo7lMTF9aL56Z/B2oWBJjey6StQM0jRbKQXtY= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/networking/v1alpha1/ingress_types.go b/networking/v1alpha1/ingress_types.go index 56ac40f..4962acd 100644 --- a/networking/v1alpha1/ingress_types.go +++ b/networking/v1alpha1/ingress_types.go @@ -35,7 +35,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=mci,categories={karmada-io} +// +kubebuilder:resource:path=multiclusteringresses,scope=Namespaced,shortName=mci,categories={karmada-io} // MultiClusterIngress is a collection of rules that allow inbound connections to reach the // endpoints defined by a backend. The structure of MultiClusterIngress is same as Ingress, diff --git a/networking/v1alpha1/service_types.go b/networking/v1alpha1/service_types.go index 852a0ad..15fc084 100644 --- a/networking/v1alpha1/service_types.go +++ b/networking/v1alpha1/service_types.go @@ -39,7 +39,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=mcs,categories={karmada-io} +// +kubebuilder:resource:path=multiclusterservices,scope=Namespaced,shortName=mcs,categories={karmada-io} // MultiClusterService is a named abstraction of multi-cluster software service. // The name field of MultiClusterService is the same as that of Service name. diff --git a/policy/v1alpha1/federatedresourcequota_types.go b/policy/v1alpha1/federatedresourcequota_types.go index 0b0466b..21690cf 100644 --- a/policy/v1alpha1/federatedresourcequota_types.go +++ b/policy/v1alpha1/federatedresourcequota_types.go @@ -34,7 +34,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories={karmada-io} +// +kubebuilder:resource:path=federatedresourcequotas,scope=Namespaced,categories={karmada-io} // +kubebuilder:subresource:status // +kubebuilder:storageversion diff --git a/policy/v1alpha1/override_types.go b/policy/v1alpha1/override_types.go index 2cdc557..c57e203 100644 --- a/policy/v1alpha1/override_types.go +++ b/policy/v1alpha1/override_types.go @@ -43,7 +43,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:shortName=op,categories={karmada-io} +// +kubebuilder:resource:path=overridepolicies,scope=Namespaced,shortName=op,categories={karmada-io} // OverridePolicy represents the policy that overrides a group of resources to one or more clusters. type OverridePolicy struct { @@ -268,7 +268,7 @@ type OverridePolicyList struct { // +genclient // +genclient:nonNamespaced -// +kubebuilder:resource:scope="Cluster",shortName=cop,categories={karmada-io} +// +kubebuilder:resource:path=clusteroverridepolicies,scope="Cluster",shortName=cop,categories={karmada-io} // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterOverridePolicy represents the cluster-wide policy that overrides a group of resources to one or more clusters. diff --git a/policy/v1alpha1/propagation_helper_test.go b/policy/v1alpha1/propagation_helper_test.go index de8e952..2609ddd 100644 --- a/policy/v1alpha1/propagation_helper_test.go +++ b/policy/v1alpha1/propagation_helper_test.go @@ -19,7 +19,7 @@ package v1alpha1 import ( "testing" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) func TestPropagationPolicy_ExplicitPriority(t *testing.T) { @@ -34,7 +34,7 @@ func TestPropagationPolicy_ExplicitPriority(t *testing.T) { }, { name: "expected to be declared priority in pp", - declaredPriority: pointer.Int32(20), + declaredPriority: ptr.To[int32](20), expectedPriority: 20, }, } @@ -62,7 +62,7 @@ func TestClusterPropagationPolicy_ExplicitPriority(t *testing.T) { }, { name: "expected to be declared priority in cpp", - declaredPriority: pointer.Int32(20), + declaredPriority: ptr.To[int32](20), expectedPriority: 20, }, } diff --git a/policy/v1alpha1/propagation_types.go b/policy/v1alpha1/propagation_types.go index b178110..89f1968 100644 --- a/policy/v1alpha1/propagation_types.go +++ b/policy/v1alpha1/propagation_types.go @@ -43,7 +43,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:shortName=pp,categories={karmada-io} +// +kubebuilder:resource:path=propagationpolicies,scope=Namespaced,shortName=pp,categories={karmada-io} // PropagationPolicy represents the policy that propagates a group of resources to one or more clusters. type PropagationPolicy struct { @@ -560,7 +560,7 @@ type PropagationPolicyList struct { // +genclient // +genclient:nonNamespaced -// +kubebuilder:resource:scope="Cluster",shortName=cpp,categories={karmada-io} +// +kubebuilder:resource:path=clusterpropagationpolicies,scope="Cluster",shortName=cpp,categories={karmada-io} // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterPropagationPolicy represents the cluster-wide policy that propagates a group of resources to one or more clusters. diff --git a/policy/v1alpha1/well_known_constants.go b/policy/v1alpha1/well_known_constants.go index 940e693..7e5c912 100644 --- a/policy/v1alpha1/well_known_constants.go +++ b/policy/v1alpha1/well_known_constants.go @@ -16,6 +16,7 @@ limitations under the License. package v1alpha1 +// The well-known label key constant. const ( // PropagationPolicyPermanentIDLabel is the identifier of a PropagationPolicy object. // Karmada generates a unique identifier, such as metadata.UUID, for each PropagationPolicy object. @@ -31,37 +32,40 @@ const ( // In backup scenarios, when applying the backup resource manifest in a new cluster, the UUID may change. ClusterPropagationPolicyPermanentIDLabel = "clusterpropagationpolicy.karmada.io/permanent-id" - // PropagationPolicyUIDLabel is the uid of PropagationPolicy object. - PropagationPolicyUIDLabel = "propagationpolicy.karmada.io/uid" + // NamespaceSkipAutoPropagationLabel is added to namespace objects to indicate if + // the namespace should be skipped from propagating by the namespace controller. + // For example, a namespace with the following label will be skipped: + // labels: + // namespace.karmada.io/skip-auto-propagation: "true" + // + // NOTE: If create a ns without this label, then patch it with this label, the ns will not be + // synced to new member clusters, but old member clusters still have it. + NamespaceSkipAutoPropagationLabel = "namespace.karmada.io/skip-auto-propagation" +) +// The well-known annotation key constant. +const ( // PropagationPolicyNamespaceAnnotation is added to objects to specify associated PropagationPolicy namespace. PropagationPolicyNamespaceAnnotation = "propagationpolicy.karmada.io/namespace" // PropagationPolicyNameAnnotation is added to objects to specify associated PropagationPolicy name. PropagationPolicyNameAnnotation = "propagationpolicy.karmada.io/name" - // ClusterPropagationPolicyUIDLabel is the uid of ClusterPropagationPolicy object. - ClusterPropagationPolicyUIDLabel = "clusterpropagationpolicy.karmada.io/uid" - // ClusterPropagationPolicyAnnotation is added to objects to specify associated ClusterPropagationPolicy name. ClusterPropagationPolicyAnnotation = "clusterpropagationpolicy.karmada.io/name" +) +// TODO(whitewindmills): These deprecated labels will be removed in a future version. +const ( // PropagationPolicyNamespaceLabel is added to objects to specify associated PropagationPolicy namespace. + // Deprecated PropagationPolicyNamespaceLabel = "propagationpolicy.karmada.io/namespace" // PropagationPolicyNameLabel is added to objects to specify associated PropagationPolicy's name. + // Deprecated PropagationPolicyNameLabel = "propagationpolicy.karmada.io/name" // ClusterPropagationPolicyLabel is added to objects to specify associated ClusterPropagationPolicy. + // Deprecated ClusterPropagationPolicyLabel = "clusterpropagationpolicy.karmada.io/name" - - // NamespaceSkipAutoPropagationLabel is added to namespace objects to indicate if - // the namespace should be skipped from propagating by the namespace controller. - // For example, a namespace with the following label will be skipped: - // labels: - // namespace.karmada.io/skip-auto-propagation: "true" - // - // NOTE: If create a ns without this label, then patch it with this label, the ns will not be - // synced to new member clusters, but old member clusters still have it. - NamespaceSkipAutoPropagationLabel = "namespace.karmada.io/skip-auto-propagation" ) diff --git a/remedy/v1alpha1/remedy_types.go b/remedy/v1alpha1/remedy_types.go index 1700744..ec9cacb 100644 --- a/remedy/v1alpha1/remedy_types.go +++ b/remedy/v1alpha1/remedy_types.go @@ -23,7 +23,7 @@ import ( // +genclient // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope="Cluster" +// +kubebuilder:resource:path=remedies,scope="Cluster",categories={karmada-io} // Remedy represents the cluster-level management strategies based on cluster conditions. type Remedy struct { diff --git a/remedy/v1alpha1/well_known_constants.go b/remedy/v1alpha1/well_known_constants.go new file mode 100644 index 0000000..8c23848 --- /dev/null +++ b/remedy/v1alpha1/well_known_constants.go @@ -0,0 +1,28 @@ +/* +Copyright 2024 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. +*/ + +package v1alpha1 + +const ( + // ResourceKindRemedy is kind name of Remedy. + ResourceKindRemedy = "Remedy" + // ResourceSingularRemedy is singular name of Remedy. + ResourceSingularRemedy = "remedy" + // ResourcePluralRemedy is plural name of Remedy. + ResourcePluralRemedy = "remedies" + // ResourceNamespaceScopedRemedy indicates if Remedy is NamespaceScoped. + ResourceNamespaceScopedRemedy = false +) diff --git a/work/v1alpha1/binding_types.go b/work/v1alpha1/binding_types.go index a69baf2..3f2ea2e 100644 --- a/work/v1alpha1/binding_types.go +++ b/work/v1alpha1/binding_types.go @@ -25,7 +25,7 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=rb,categories={karmada-io} +// +kubebuilder:resource:path=resourcebindings,scope=Namespaced,shortName=rb,categories={karmada-io} // ResourceBinding represents a binding of a kubernetes resource with a propagation policy. type ResourceBinding struct { @@ -135,7 +135,7 @@ type ResourceBindingList struct { // +genclient // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope="Cluster",shortName=crb,categories={karmada-io} +// +kubebuilder:resource:path=clusterresourcebindings,scope="Cluster",shortName=crb,categories={karmada-io} // +kubebuilder:subresource:status // ClusterResourceBinding represents a binding of a kubernetes resource with a ClusterPropagationPolicy. @@ -151,7 +151,6 @@ type ClusterResourceBinding struct { Status ResourceBindingStatus `json:"status,omitempty"` } -// +kubebuilder:resource:scope="Cluster" // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterResourceBindingList contains a list of ClusterResourceBinding. diff --git a/work/v1alpha1/well_known_constants.go b/work/v1alpha1/well_known_constants.go deleted file mode 100644 index b11daa5..0000000 --- a/work/v1alpha1/well_known_constants.go +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright 2021 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. -*/ - -package v1alpha1 - -const ( - // ResourceBindingNamespaceLabel is added to objects to specify associated ResourceBinding's namespace. - ResourceBindingNamespaceLabel = "resourcebinding.karmada.io/namespace" - - // ResourceBindingNameLabel is added to objects to specify associated ResourceBinding's name. - ResourceBindingNameLabel = "resourcebinding.karmada.io/name" - - // ClusterResourceBindingLabel is added to objects to specify associated ClusterResourceBinding. - ClusterResourceBindingLabel = "clusterresourcebinding.karmada.io/name" - - // WorkNamespaceLabel is added to objects to specify associated Work's namespace. - WorkNamespaceLabel = "work.karmada.io/namespace" - - // WorkNameLabel is added to objects to specify associated Work's name. - WorkNameLabel = "work.karmada.io/name" -) diff --git a/work/v1alpha1/work_types.go b/work/v1alpha1/work_types.go index e90695a..3c3b2ed 100644 --- a/work/v1alpha1/work_types.go +++ b/work/v1alpha1/work_types.go @@ -35,7 +35,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:subresource:status -// +kubebuilder:resource:categories={karmada-io},shortName=wk +// +kubebuilder:resource:path=works,scope=Namespaced,shortName=wk,categories={karmada-io} // +kubebuilder:printcolumn:JSONPath=`.spec.workload.manifests[*].kind`,name="Workload-Kind",type=string // +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Applied")].status`,name="Applied",type=string // +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date diff --git a/work/v1alpha2/binding_types.go b/work/v1alpha2/binding_types.go index 314e736..83a43e3 100644 --- a/work/v1alpha2/binding_types.go +++ b/work/v1alpha2/binding_types.go @@ -48,7 +48,7 @@ const ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=rb,categories={karmada-io} +// +kubebuilder:resource:path=resourcebindings,scope=Namespaced,shortName=rb,categories={karmada-io} // +kubebuilder:storageversion // +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Scheduled")].status`,name="Scheduled",type=string // +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="FullyApplied")].status`,name="FullyApplied",type=string @@ -136,6 +136,16 @@ type ResourceBindingSpec struct { // +kubebuilder:validation:Enum=Abort;Overwrite // +optional ConflictResolution policyv1alpha1.ConflictResolution `json:"conflictResolution,omitempty"` + + // RescheduleTriggeredAt is a timestamp representing when the referenced resource is triggered rescheduling. + // When this field is updated, it means a rescheduling is manually triggered by user, and the expected behavior + // of this action is to do a complete recalculation without referring to last scheduling results. + // It works with the status.lastScheduledTime field, and only when this timestamp is later than timestamp in + // status.lastScheduledTime will the rescheduling actually execute, otherwise, ignored. + // + // It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC. + // +optional + RescheduleTriggeredAt *metav1.Time `json:"rescheduleTriggeredAt,omitempty"` } // ObjectReference contains enough information to locate the referenced object inside current cluster. @@ -297,6 +307,11 @@ type ResourceBindingStatus struct { // +optional SchedulerObservedAffinityName string `json:"schedulerObservingAffinityName,omitempty"` + // 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. + // +optional + LastScheduledTime *metav1.Time `json:"lastScheduledTime,omitempty"` + // Conditions contain the different condition statuses. // +optional Conditions []metav1.Condition `json:"conditions,omitempty"` @@ -391,7 +406,7 @@ const ( // +genclient // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope="Cluster",shortName=crb,categories={karmada-io} +// +kubebuilder:resource:path=clusterresourcebindings,scope="Cluster",shortName=crb,categories={karmada-io} // +kubebuilder:subresource:status // +kubebuilder:storageversion // +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Scheduled")].status`,name="Scheduled",type=string @@ -411,7 +426,6 @@ type ClusterResourceBinding struct { Status ResourceBindingStatus `json:"status,omitempty"` } -// +kubebuilder:resource:scope="Cluster" // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterResourceBindingList contains a list of ClusterResourceBinding. diff --git a/work/v1alpha2/binding_types_helper_test.go b/work/v1alpha2/binding_types_helper_test.go index 73e093f..9049580 100644 --- a/work/v1alpha2/binding_types_helper_test.go +++ b/work/v1alpha2/binding_types_helper_test.go @@ -20,7 +20,7 @@ import ( "reflect" "testing" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) func TestResourceBindingSpec_TargetContains(t *testing.T) { @@ -181,7 +181,7 @@ func TestResourceBindingSpec_GracefulEvictCluster(t *testing.T) { GracefulEvictionTasks: []GracefulEvictionTask{ { FromCluster: "m1", - Replicas: pointer.Int32(1), + Replicas: ptr.To[int32](1), Reason: EvictionReasonTaintUntolerated, Message: "graceful eviction", Producer: EvictionProducerTaintManager, @@ -205,7 +205,7 @@ func TestResourceBindingSpec_GracefulEvictCluster(t *testing.T) { GracefulEvictionTasks: []GracefulEvictionTask{ { FromCluster: "m2", - Replicas: pointer.Int32(2), + Replicas: ptr.To[int32](2), Reason: EvictionReasonTaintUntolerated, Message: "graceful eviction", Producer: EvictionProducerTaintManager, @@ -229,7 +229,7 @@ func TestResourceBindingSpec_GracefulEvictCluster(t *testing.T) { GracefulEvictionTasks: []GracefulEvictionTask{ { FromCluster: "m3", - Replicas: pointer.Int32(3), + Replicas: ptr.To[int32](3), Reason: EvictionReasonTaintUntolerated, Message: "graceful eviction", Producer: EvictionProducerTaintManager, @@ -257,7 +257,7 @@ func TestResourceBindingSpec_GracefulEvictCluster(t *testing.T) { }, { FromCluster: "m3", - Replicas: pointer.Int32(3), + Replicas: ptr.To[int32](3), Reason: EvictionReasonTaintUntolerated, Message: "graceful eviction", Producer: EvictionProducerTaintManager, @@ -277,7 +277,7 @@ func TestResourceBindingSpec_GracefulEvictCluster(t *testing.T) { GracefulEvictionTasks: []GracefulEvictionTask{ { FromCluster: "m1", - Replicas: pointer.Int32(1), + Replicas: ptr.To[int32](1), Reason: EvictionReasonTaintUntolerated, Message: "graceful eviction v1", Producer: EvictionProducerTaintManager, @@ -286,7 +286,7 @@ func TestResourceBindingSpec_GracefulEvictCluster(t *testing.T) { }, EvictEvent: GracefulEvictionTask{ FromCluster: "m1", - Replicas: pointer.Int32(1), + Replicas: ptr.To[int32](1), Reason: EvictionReasonTaintUntolerated, Message: "graceful eviction v2", Producer: EvictionProducerTaintManager, @@ -296,7 +296,7 @@ func TestResourceBindingSpec_GracefulEvictCluster(t *testing.T) { GracefulEvictionTasks: []GracefulEvictionTask{ { FromCluster: "m1", - Replicas: pointer.Int32(1), + Replicas: ptr.To[int32](1), Reason: EvictionReasonTaintUntolerated, Message: "graceful eviction v1", Producer: EvictionProducerTaintManager, diff --git a/work/v1alpha2/well_known_constants.go b/work/v1alpha2/well_known_constants.go index c09e140..3aa122b 100644 --- a/work/v1alpha2/well_known_constants.go +++ b/work/v1alpha2/well_known_constants.go @@ -34,31 +34,12 @@ const ( // WorkPermanentIDLabel is the ID of Work object. WorkPermanentIDLabel = "work.karmada.io/permanent-id" - // ResourceBindingUIDLabel is the UID of ResourceBinding object. - ResourceBindingUIDLabel = "resourcebinding.karmada.io/uid" - - // ClusterResourceBindingUIDLabel is the uid of ClusterResourceBinding object. - ClusterResourceBindingUIDLabel = "clusterresourcebinding.karmada.io/uid" - // WorkNamespaceAnnotation is added to objects to specify associated Work's namespace. WorkNamespaceAnnotation = "work.karmada.io/namespace" // WorkNameAnnotation is added to objects to specify associated Work's name. WorkNameAnnotation = "work.karmada.io/name" - // WorkUIDLabel is the uid of Work object. - WorkUIDLabel = "work.karmada.io/uid" - - // ResourceBindingReferenceKey is the key of ResourceBinding object. - // It is usually a unique hash value of ResourceBinding object's namespace and name, intended to be added to the Work object. - // It will be used to retrieve all Works objects that derived from a specific ResourceBinding object. - ResourceBindingReferenceKey = "resourcebinding.karmada.io/key" - - // ClusterResourceBindingReferenceKey is the key of ClusterResourceBinding object. - // It is usually a unique hash value of ClusterResourceBinding object's namespace and name, intended to be added to the Work object. - // It will be used to retrieve all Works objects that derived by a specific ClusterResourceBinding object. - ClusterResourceBindingReferenceKey = "clusterresourcebinding.karmada.io/key" - // ResourceBindingNamespaceAnnotationKey is added to object to describe the associated ResourceBinding's namespace. // It is added to: // - Work object: describes the namespace of ResourceBinding which the Work derived from. @@ -77,12 +58,6 @@ const ( // - Manifest in Work object: describes the name of ClusterResourceBinding which the manifest derived from. ClusterResourceBindingAnnotationKey = "clusterresourcebinding.karmada.io/name" - // WorkNamespaceLabel is added to objects to specify associated Work's namespace. - WorkNamespaceLabel = "work.karmada.io/namespace" - - // WorkNameLabel is added to objects to specify associated Work's name. - WorkNameLabel = "work.karmada.io/name" - // BindingManagedByLabel is added to ResourceBinding to represent what kind of resource manages this Binding. BindingManagedByLabel = "binding.karmada.io/managed-by" ) diff --git a/work/v1alpha2/zz_generated.deepcopy.go b/work/v1alpha2/zz_generated.deepcopy.go index a407637..d27f78f 100644 --- a/work/v1alpha2/zz_generated.deepcopy.go +++ b/work/v1alpha2/zz_generated.deepcopy.go @@ -344,6 +344,10 @@ func (in *ResourceBindingSpec) DeepCopyInto(out *ResourceBindingSpec) { *out = new(v1alpha1.FailoverBehavior) (*in).DeepCopyInto(*out) } + if in.RescheduleTriggeredAt != nil { + in, out := &in.RescheduleTriggeredAt, &out.RescheduleTriggeredAt + *out = (*in).DeepCopy() + } return } @@ -360,6 +364,10 @@ func (in *ResourceBindingSpec) DeepCopy() *ResourceBindingSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceBindingStatus) DeepCopyInto(out *ResourceBindingStatus) { *out = *in + if in.LastScheduledTime != nil { + in, out := &in.LastScheduledTime, &out.LastScheduledTime + *out = (*in).DeepCopy() + } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]metav1.Condition, len(*in))