From f55df54f0a8273cc586e460e74548b067be86cbe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 01:35:04 +0000 Subject: [PATCH] Update module open-cluster-management.io/api to v0.14.0 --- go.mod | 2 +- go.sum | 2 + vendor/modules.txt | 6 +- ...ter-management.io_managedclusters.crd.yaml | 285 -------- .../api/cluster/v1/doc.go | 9 - .../api/cluster/v1/register.go | 38 - .../api/cluster/v1/types.go | 259 ------- .../api/cluster/v1/zz_generated.deepcopy.go | 237 ------ .../v1/zz_generated.swagger_doc_generated.go | 100 --- .../api/cluster/v1alpha1/doc.go | 2 - .../api/cluster/v1alpha1/helpers.go | 382 ---------- .../cluster/v1alpha1/types_rolloutstrategy.go | 99 ++- .../cluster/v1alpha1/zz_generated.deepcopy.go | 91 +-- .../zz_generated.swagger_doc_generated.go | 27 +- ...-cluster-management.io_placements.crd.yaml | 673 ------------------ ...-management.io_placementdecisions.crd.yaml | 76 -- .../api/cluster/v1beta1/doc.go | 9 - .../api/cluster/v1beta1/helpers.go | 274 ------- .../api/cluster/v1beta1/register.go | 40 -- .../api/cluster/v1beta1/types_placement.go | 449 ------------ .../v1beta1/types_placementdecision.go | 75 -- .../cluster/v1beta1/zz_generated.deepcopy.go | 551 -------------- .../zz_generated.swagger_doc_generated.go | 240 ------- 23 files changed, 110 insertions(+), 3816 deletions(-) delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1/doc.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1/register.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1/types.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1/zz_generated.deepcopy.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1/zz_generated.swagger_doc_generated.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1alpha1/helpers.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/0000_03_clusters.open-cluster-management.io_placementdecisions.crd.yaml delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/doc.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/helpers.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/register.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go diff --git a/go.mod b/go.mod index 7e0bb2ccc..da4943590 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/onsi/gomega v1.34.1 k8s.io/apimachinery v0.30.3 k8s.io/client-go v0.30.3 - open-cluster-management.io/api v0.12.0 + open-cluster-management.io/api v0.14.0 sigs.k8s.io/controller-runtime v0.18.4 ) diff --git a/go.sum b/go.sum index 42bbef77e..c67156bd9 100644 --- a/go.sum +++ b/go.sum @@ -442,6 +442,8 @@ k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSn k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= open-cluster-management.io/api v0.12.0 h1:sNkj4k2XyWA/GLsTiFg82bLIZ7JDZKkLLLyZjJUlJMs= open-cluster-management.io/api v0.12.0/go.mod h1:/CZhelEH+30/pX7vXGSZOzLMX0zvjthYOkT/5ZTzVTQ= +open-cluster-management.io/api v0.14.0 h1:yjhnNeO/QudiIoEi0i/yUYmP3iElAfUgtj4pHMV+4uM= +open-cluster-management.io/api v0.14.0/go.mod h1:ltijKJhDifrPH0csvCUmFt5lzaERv+BBfh6X3l83rT0= sigs.k8s.io/controller-runtime v0.18.0 h1:Z7jKuX784TQSUL1TIyeuF7j8KXZ4RtSX0YgtjKcSTME= sigs.k8s.io/controller-runtime v0.18.0/go.mod h1:tuAt1+wbVsXIT8lPtk5RURxqAnq7xkpv2Mhttslg7Hw= sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= diff --git a/vendor/modules.txt b/vendor/modules.txt index 61b643b87..08112db04 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1136,11 +1136,9 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# open-cluster-management.io/api v0.12.0 -## explicit; go 1.19 -open-cluster-management.io/api/cluster/v1 +# open-cluster-management.io/api v0.14.0 +## explicit; go 1.21 open-cluster-management.io/api/cluster/v1alpha1 -open-cluster-management.io/api/cluster/v1beta1 # sigs.k8s.io/controller-runtime v0.18.4 ## explicit; go 1.22.0 sigs.k8s.io/controller-runtime diff --git a/vendor/open-cluster-management.io/api/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml deleted file mode 100644 index 88fbe6ae5..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml +++ /dev/null @@ -1,285 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: managedclusters.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: ManagedCluster - listKind: ManagedClusterList - plural: managedclusters - shortNames: - - mcl - - mcls - singular: managedcluster - preserveUnknownFields: false - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .spec.hubAcceptsClient - name: Hub Accepted - type: boolean - - jsonPath: .spec.managedClusterClientConfigs[*].url - name: Managed Cluster URLs - type: string - - jsonPath: .status.conditions[?(@.type=="ManagedClusterJoined")].status - name: Joined - type: string - - jsonPath: .status.conditions[?(@.type=="ManagedClusterConditionAvailable")].status - name: Available - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: "ManagedCluster represents the desired state and current status - of managed cluster. ManagedCluster is a cluster scoped resource. The name - is the cluster UID. \n The cluster join process follows a double opt-in - process: \n 1. Agent on managed cluster creates CSR on hub with cluster - UID and agent name. 2. Agent on managed cluster creates ManagedCluster on - hub. 3. Cluster admin on hub approves the CSR for UID and agent name of - the ManagedCluster. 4. Cluster admin sets spec.acceptClient of ManagedCluster - to true. 5. Cluster admin on managed cluster creates credential of kubeconfig - to hub. \n Once the hub creates the cluster namespace, the Klusterlet agent - on the ManagedCluster pushes the credential to the hub to use against the - kube-apiserver of the ManagedCluster." - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: Spec represents a desired configuration for the agent on - the managed cluster. - properties: - hubAcceptsClient: - description: hubAcceptsClient represents that hub accepts the joining - of Klusterlet agent on the managed cluster with the hub. The default - value is false, and can only be set true when the user on hub has - an RBAC rule to UPDATE on the virtual subresource of managedclusters/accept. - When the value is set true, a namespace whose name is the same as - the name of ManagedCluster is created on the hub. This namespace - represents the managed cluster, also role/rolebinding is created - on the namespace to grant the permision of access from the agent - on the managed cluster. When the value is set to false, the namespace - representing the managed cluster is deleted. - type: boolean - leaseDurationSeconds: - default: 60 - description: LeaseDurationSeconds is used to coordinate the lease - update time of Klusterlet agents on the managed cluster. If its - value is zero, the Klusterlet agent will update its lease every - 60 seconds by default - format: int32 - type: integer - managedClusterClientConfigs: - description: ManagedClusterClientConfigs represents a list of the - apiserver address of the managed cluster. If it is empty, the managed - cluster has no accessible address for the hub to connect with it. - items: - description: ClientConfig represents the apiserver address of the - managed cluster. TODO include credential to connect to managed - cluster kube-apiserver - properties: - caBundle: - description: CABundle is the ca bundle to connect to apiserver - of the managed cluster. System certs are used if it is not - set. - format: byte - type: string - url: - description: URL is the URL of apiserver endpoint of the managed - cluster. - type: string - type: object - type: array - taints: - description: Taints is a property of managed cluster that allow the - cluster to be repelled when scheduling. Taints, including 'ManagedClusterUnavailable' - and 'ManagedClusterUnreachable', can not be added/removed by agent - running on the managed cluster; while it's fine to add/remove other - taints from either hub cluser or managed cluster. - items: - description: The managed cluster this Taint is attached to has the - "effect" on any placement that does not tolerate the Taint. - properties: - effect: - description: Effect indicates the effect of the taint on placements - that do not tolerate the taint. Valid effects are NoSelect, - PreferNoSelect and NoSelectIfNew. - enum: - - NoSelect - - PreferNoSelect - - NoSelectIfNew - type: string - key: - description: Key is the taint key applied to a cluster. e.g. - bar or foo.example.com/bar. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - timeAdded: - description: TimeAdded represents the time at which the taint - was added. - format: date-time - nullable: true - type: string - value: - description: Value is the taint value corresponding to the taint - key. - maxLength: 1024 - type: string - required: - - effect - - key - type: object - type: array - type: object - status: - description: Status represents the current status of joined managed cluster - properties: - allocatable: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: Allocatable represents the total allocatable resources - on the managed cluster. - type: object - capacity: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: Capacity represents the total resource capacity from - all nodeStatuses on the managed cluster. - type: object - clusterClaims: - description: ClusterClaims represents cluster information that a managed - cluster claims, for example a unique cluster identifier (id.k8s.io) - and kubernetes version (kubeversion.open-cluster-management.io). - They are written from the managed cluster. The set of claims is - not uniform across a fleet, some claims can be vendor or version - specific and may not be included from all managed clusters. - items: - description: ManagedClusterClaim represents a ClusterClaim collected - from a managed cluster. - properties: - name: - description: Name is the name of a ClusterClaim resource on - managed cluster. It's a well known or customized name to identify - the claim. - maxLength: 253 - minLength: 1 - type: string - value: - description: Value is a claim-dependent string - maxLength: 1024 - minLength: 1 - type: string - type: object - type: array - conditions: - description: Conditions contains the different condition statuses - for this managed cluster. - items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - version: - description: Version represents the kubernetes version of the managed - cluster. - properties: - kubernetes: - description: Kubernetes is the kubernetes version of managed cluster. - type: string - type: object - type: object - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/open-cluster-management.io/api/cluster/v1/doc.go b/vendor/open-cluster-management.io/api/cluster/v1/doc.go deleted file mode 100644 index 8e2eaea79..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package v1 contains API Schema definitions for the cluster v1 API group -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=open-cluster-management.io/api/cluster -// +k8s:defaulter-gen=TypeMeta -// +k8s:openapi-gen=true - -// +kubebuilder:validation:Optional -// +groupName=cluster.open-cluster-management.io -package v1 diff --git a/vendor/open-cluster-management.io/api/cluster/v1/register.go b/vendor/open-cluster-management.io/api/cluster/v1/register.go deleted file mode 100644 index 6ac0fdc41..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1/register.go +++ /dev/null @@ -1,38 +0,0 @@ -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -var ( - GroupName = "cluster.open-cluster-management.io" - GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} - schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // Install is a function which adds this version to a scheme - Install = schemeBuilder.AddToScheme - - // SchemeGroupVersion generated code relies on this name - // Deprecated - SchemeGroupVersion = GroupVersion - // AddToScheme exists solely to keep the old generators creating valid code - // DEPRECATED - AddToScheme = schemeBuilder.AddToScheme -) - -// Resource generated code relies on this being here, but it logically belongs to the group -// DEPRECATED -func Resource(resource string) schema.GroupResource { - return schema.GroupResource{Group: GroupName, Resource: resource} -} - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(GroupVersion, - &ManagedCluster{}, - &ManagedClusterList{}, - ) - metav1.AddToGroupVersion(scheme, GroupVersion) - return nil -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1/types.go b/vendor/open-cluster-management.io/api/cluster/v1/types.go deleted file mode 100644 index 499ca72d1..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1/types.go +++ /dev/null @@ -1,259 +0,0 @@ -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope="Cluster",shortName={"mcl","mcls"} -// +kubebuilder:printcolumn:JSONPath=`.spec.hubAcceptsClient`,name="Hub Accepted",type=boolean -// +kubebuilder:printcolumn:JSONPath=`.spec.managedClusterClientConfigs[*].url`,name="Managed Cluster URLs",type=string -// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ManagedClusterJoined")].status`,name="Joined",type=string -// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ManagedClusterConditionAvailable")].status`,name="Available",type=string -// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date - -// ManagedCluster represents the desired state and current status of managed -// cluster. ManagedCluster is a cluster scoped resource. The name is the cluster -// UID. -// -// The cluster join process follows a double opt-in process: -// -// 1. Agent on managed cluster creates CSR on hub with cluster UID and agent name. -// 2. Agent on managed cluster creates ManagedCluster on hub. -// 3. Cluster admin on hub approves the CSR for UID and agent name of the ManagedCluster. -// 4. Cluster admin sets spec.acceptClient of ManagedCluster to true. -// 5. Cluster admin on managed cluster creates credential of kubeconfig to hub. -// -// Once the hub creates the cluster namespace, the Klusterlet agent on the ManagedCluster -// pushes the credential to the hub to use against the kube-apiserver of the ManagedCluster. -type ManagedCluster struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec represents a desired configuration for the agent on the managed cluster. - Spec ManagedClusterSpec `json:"spec"` - - // Status represents the current status of joined managed cluster - // +optional - Status ManagedClusterStatus `json:"status,omitempty"` -} - -// ManagedClusterSpec provides the information to securely connect to a remote server -// and verify its identity. -type ManagedClusterSpec struct { - // ManagedClusterClientConfigs represents a list of the apiserver address of the managed cluster. - // If it is empty, the managed cluster has no accessible address for the hub to connect with it. - // +optional - ManagedClusterClientConfigs []ClientConfig `json:"managedClusterClientConfigs,omitempty"` - - // hubAcceptsClient represents that hub accepts the joining of Klusterlet agent on - // the managed cluster with the hub. The default value is false, and can only be set - // true when the user on hub has an RBAC rule to UPDATE on the virtual subresource - // of managedclusters/accept. - // When the value is set true, a namespace whose name is the same as the name of ManagedCluster - // is created on the hub. This namespace represents the managed cluster, also role/rolebinding is created on - // the namespace to grant the permision of access from the agent on the managed cluster. - // When the value is set to false, the namespace representing the managed cluster is - // deleted. - // +required - HubAcceptsClient bool `json:"hubAcceptsClient"` - - // LeaseDurationSeconds is used to coordinate the lease update time of Klusterlet agents on the managed cluster. - // If its value is zero, the Klusterlet agent will update its lease every 60 seconds by default - // +optional - // +kubebuilder:default=60 - LeaseDurationSeconds int32 `json:"leaseDurationSeconds,omitempty"` - - // Taints is a property of managed cluster that allow the cluster to be repelled when scheduling. - // Taints, including 'ManagedClusterUnavailable' and 'ManagedClusterUnreachable', can not be added/removed by agent - // running on the managed cluster; while it's fine to add/remove other taints from either hub cluser or managed cluster. - // +optional - Taints []Taint `json:"taints,omitempty"` -} - -// ClientConfig represents the apiserver address of the managed cluster. -// TODO include credential to connect to managed cluster kube-apiserver -type ClientConfig struct { - // URL is the URL of apiserver endpoint of the managed cluster. - // +required - URL string `json:"url"` - - // CABundle is the ca bundle to connect to apiserver of the managed cluster. - // System certs are used if it is not set. - // +optional - CABundle []byte `json:"caBundle,omitempty"` -} - -// The managed cluster this Taint is attached to has the "effect" on -// any placement that does not tolerate the Taint. -type Taint struct { - // Key is the taint key applied to a cluster. e.g. bar or foo.example.com/bar. - // The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - // +kubebuilder:validation:Required - // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` - // +kubebuilder:validation:MaxLength=316 - // +required - Key string `json:"key"` - // Value is the taint value corresponding to the taint key. - // +kubebuilder:validation:MaxLength=1024 - // +optional - Value string `json:"value,omitempty"` - // Effect indicates the effect of the taint on placements that do not tolerate the taint. - // Valid effects are NoSelect, PreferNoSelect and NoSelectIfNew. - // +kubebuilder:validation:Required - // +kubebuilder:validation:Enum:=NoSelect;PreferNoSelect;NoSelectIfNew - // +required - Effect TaintEffect `json:"effect"` - // TimeAdded represents the time at which the taint was added. - // +nullable - // +required - TimeAdded metav1.Time `json:"timeAdded"` -} - -type TaintEffect string - -const ( - // TaintEffectNoSelect means placements are not allowed to select the cluster unless they tolerate the taint. - // The cluster will be removed from the placement cluster decisions if a placement has already selected - // this cluster. - TaintEffectNoSelect TaintEffect = "NoSelect" - // TaintEffectPreferNoSelect means the scheduler tries not to select the cluster, rather than prohibiting - // placements from selecting the cluster entirely. - TaintEffectPreferNoSelect TaintEffect = "PreferNoSelect" - // TaintEffectNoSelectIfNew means placements are not allowed to select the cluster unless - // 1) they tolerate the taint; - // 2) they have already had the cluster in their cluster decisions; - TaintEffectNoSelectIfNew TaintEffect = "NoSelectIfNew" -) - -const ( - // ManagedClusterTaintUnavailable is the key of the taint added to a managed cluster when it is not available. - // To be specific, the cluster has a condition 'ManagedClusterConditionAvailable' with status of 'False'; - ManagedClusterTaintUnavailable string = "cluster.open-cluster-management.io/unavailable" - // ManagedClusterTaintUnreachable is the key of the taint added to a managed cluster when it is not reachable. - // To be specific, - // 1) The cluster has no condition 'ManagedClusterConditionAvailable'; - // 2) Or the status of condition 'ManagedClusterConditionAvailable' is 'Unknown'; - ManagedClusterTaintUnreachable string = "cluster.open-cluster-management.io/unreachable" -) - -// ManagedClusterStatus represents the current status of joined managed cluster. -type ManagedClusterStatus struct { - // Conditions contains the different condition statuses for this managed cluster. - Conditions []metav1.Condition `json:"conditions"` - - // Capacity represents the total resource capacity from all nodeStatuses - // on the managed cluster. - Capacity ResourceList `json:"capacity,omitempty"` - - // Allocatable represents the total allocatable resources on the managed cluster. - Allocatable ResourceList `json:"allocatable,omitempty"` - - // Version represents the kubernetes version of the managed cluster. - Version ManagedClusterVersion `json:"version,omitempty"` - - // ClusterClaims represents cluster information that a managed cluster claims, - // for example a unique cluster identifier (id.k8s.io) and kubernetes version - // (kubeversion.open-cluster-management.io). They are written from the managed - // cluster. The set of claims is not uniform across a fleet, some claims can be - // vendor or version specific and may not be included from all managed clusters. - // +optional - ClusterClaims []ManagedClusterClaim `json:"clusterClaims,omitempty"` -} - -// ManagedClusterVersion represents version information about the managed cluster. -// TODO add managed agent versions -type ManagedClusterVersion struct { - // Kubernetes is the kubernetes version of managed cluster. - // +optional - Kubernetes string `json:"kubernetes,omitempty"` -} - -// ManagedClusterClaim represents a ClusterClaim collected from a managed cluster. -type ManagedClusterClaim struct { - // Name is the name of a ClusterClaim resource on managed cluster. It's a well known - // or customized name to identify the claim. - // +kubebuilder:validation:MaxLength=253 - // +kubebuilder:validation:MinLength=1 - Name string `json:"name,omitempty"` - - // Value is a claim-dependent string - // +kubebuilder:validation:MaxLength=1024 - // +kubebuilder:validation:MinLength=1 - Value string `json:"value,omitempty"` -} - -const ( - // ManagedClusterConditionJoined means the managed cluster has successfully joined the hub. - ManagedClusterConditionJoined string = "ManagedClusterJoined" - // ManagedClusterConditionHubAccepted means the request to join the cluster is - // approved by cluster-admin on hub. - ManagedClusterConditionHubAccepted string = "HubAcceptedManagedCluster" - // ManagedClusterConditionHubDenied means the request to join the cluster is denied by - // cluster-admin on hub. - ManagedClusterConditionHubDenied string = "HubDeniedManagedCluster" - // ManagedClusterConditionAvailable means the managed cluster is available. If a managed - // cluster is available, the kube-apiserver is healthy and the Klusterlet agent is - // running with the minimum deployment on this managed cluster - ManagedClusterConditionAvailable string = "ManagedClusterConditionAvailable" -) - -// ResourceName is the name identifying various resources in a ResourceList. -type ResourceName string - -const ( - // ResourceCPU defines the number of CPUs in cores. (500m = .5 cores) - ResourceCPU ResourceName = "cpu" - // ResourceMemory defines the amount of memory in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024) - ResourceMemory ResourceName = "memory" -) - -// ResourceList defines a map for the quantity of different resources, the definition -// matches the ResourceList defined in k8s.io/api/core/v1. -type ResourceList map[ResourceName]resource.Quantity - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ManagedClusterList is a collection of managed cluster. -type ManagedClusterList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds - // +optional - metav1.ListMeta `json:"metadata,omitempty"` - - // Items is a list of managed clusters. - Items []ManagedCluster `json:"items"` -} - -const ( - // ClusterNameLabelKey is the key of a label to set ManagedCluster name. - ClusterNameLabelKey = "open-cluster-management.io/cluster-name" -) - -const ( - // ClusterImageRegistriesAnnotationKey is an annotation key on ManagedCluster to configure image override for addons - // running on the ManagedCluster, the value of the annotation should be a json string like this: - // - // { - // "registries": [ - // { - // "source": "quay.io/ocm", - // "mirrors": "quay.io/open-cluster-management" - // } - // ] - // } - // - // Note: Image registries configured in the addonDeploymentConfig will take precedence over this annotation. - ClusterImageRegistriesAnnotationKey = "open-cluster-management.io/image-registries" -) - -const ( - // ManagedClusterFinalizer is the name of the finalizer added to ManagedCluster, it is to ensure that resources - // relating to the ManagedCluster is removed when the ManagedCluster is deleted. - ManagedClusterFinalizer = "cluster.open-cluster-management.io/api-resource-cleanup" -) diff --git a/vendor/open-cluster-management.io/api/cluster/v1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/cluster/v1/zz_generated.deepcopy.go deleted file mode 100644 index 19a63be91..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,237 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - 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 *ClientConfig) DeepCopyInto(out *ClientConfig) { - *out = *in - if in.CABundle != nil { - in, out := &in.CABundle, &out.CABundle - *out = make([]byte, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientConfig. -func (in *ClientConfig) DeepCopy() *ClientConfig { - if in == nil { - return nil - } - out := new(ClientConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedCluster) DeepCopyInto(out *ManagedCluster) { - *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 ManagedCluster. -func (in *ManagedCluster) DeepCopy() *ManagedCluster { - if in == nil { - return nil - } - out := new(ManagedCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ManagedCluster) 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 *ManagedClusterClaim) DeepCopyInto(out *ManagedClusterClaim) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterClaim. -func (in *ManagedClusterClaim) DeepCopy() *ManagedClusterClaim { - if in == nil { - return nil - } - out := new(ManagedClusterClaim) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedClusterList) DeepCopyInto(out *ManagedClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ManagedCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterList. -func (in *ManagedClusterList) DeepCopy() *ManagedClusterList { - if in == nil { - return nil - } - out := new(ManagedClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ManagedClusterList) 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 *ManagedClusterSpec) DeepCopyInto(out *ManagedClusterSpec) { - *out = *in - if in.ManagedClusterClientConfigs != nil { - in, out := &in.ManagedClusterClientConfigs, &out.ManagedClusterClientConfigs - *out = make([]ClientConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Taints != nil { - in, out := &in.Taints, &out.Taints - *out = make([]Taint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSpec. -func (in *ManagedClusterSpec) DeepCopy() *ManagedClusterSpec { - if in == nil { - return nil - } - out := new(ManagedClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedClusterStatus) DeepCopyInto(out *ManagedClusterStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]metav1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Capacity != nil { - in, out := &in.Capacity, &out.Capacity - *out = make(ResourceList, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() - } - } - if in.Allocatable != nil { - in, out := &in.Allocatable, &out.Allocatable - *out = make(ResourceList, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() - } - } - out.Version = in.Version - if in.ClusterClaims != nil { - in, out := &in.ClusterClaims, &out.ClusterClaims - *out = make([]ManagedClusterClaim, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterStatus. -func (in *ManagedClusterStatus) DeepCopy() *ManagedClusterStatus { - if in == nil { - return nil - } - out := new(ManagedClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedClusterVersion) DeepCopyInto(out *ManagedClusterVersion) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterVersion. -func (in *ManagedClusterVersion) DeepCopy() *ManagedClusterVersion { - if in == nil { - return nil - } - out := new(ManagedClusterVersion) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in ResourceList) DeepCopyInto(out *ResourceList) { - { - in := &in - *out = make(ResourceList, len(*in)) - for key, val := range *in { - (*out)[key] = val.DeepCopy() - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceList. -func (in ResourceList) DeepCopy() ResourceList { - if in == nil { - return nil - } - out := new(ResourceList) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Taint) DeepCopyInto(out *Taint) { - *out = *in - in.TimeAdded.DeepCopyInto(&out.TimeAdded) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Taint. -func (in *Taint) DeepCopy() *Taint { - if in == nil { - return nil - } - out := new(Taint) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1/zz_generated.swagger_doc_generated.go deleted file mode 100644 index 3b06be595..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1/zz_generated.swagger_doc_generated.go +++ /dev/null @@ -1,100 +0,0 @@ -package v1 - -// This file contains a collection of methods that can be used from go-restful to -// generate Swagger API documentation for its models. Please read this PR for more -// information on the implementation: https://github.com/emicklei/go-restful/pull/215 -// -// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if -// they are on one line! For multiple line or blocks that you want to ignore use ---. -// Any context after a --- is ignored. -// -// Those methods can be generated by using hack/update-swagger-docs.sh - -// AUTO-GENERATED FUNCTIONS START HERE -var map_ClientConfig = map[string]string{ - "": "ClientConfig represents the apiserver address of the managed cluster.", - "url": "URL is the URL of apiserver endpoint of the managed cluster.", - "caBundle": "CABundle is the ca bundle to connect to apiserver of the managed cluster. System certs are used if it is not set.", -} - -func (ClientConfig) SwaggerDoc() map[string]string { - return map_ClientConfig -} - -var map_ManagedCluster = map[string]string{ - "": "ManagedCluster represents the desired state and current status of managed cluster. ManagedCluster is a cluster scoped resource. The name is the cluster UID.\n\nThe cluster join process follows a double opt-in process:\n\n1. Agent on managed cluster creates CSR on hub with cluster UID and agent name. 2. Agent on managed cluster creates ManagedCluster on hub. 3. Cluster admin on hub approves the CSR for UID and agent name of the ManagedCluster. 4. Cluster admin sets spec.acceptClient of ManagedCluster to true. 5. Cluster admin on managed cluster creates credential of kubeconfig to hub.\n\nOnce the hub creates the cluster namespace, the Klusterlet agent on the ManagedCluster pushes the credential to the hub to use against the kube-apiserver of the ManagedCluster.", - "spec": "Spec represents a desired configuration for the agent on the managed cluster.", - "status": "Status represents the current status of joined managed cluster", -} - -func (ManagedCluster) SwaggerDoc() map[string]string { - return map_ManagedCluster -} - -var map_ManagedClusterClaim = map[string]string{ - "": "ManagedClusterClaim represents a ClusterClaim collected from a managed cluster.", - "name": "Name is the name of a ClusterClaim resource on managed cluster. It's a well known or customized name to identify the claim.", - "value": "Value is a claim-dependent string", -} - -func (ManagedClusterClaim) SwaggerDoc() map[string]string { - return map_ManagedClusterClaim -} - -var map_ManagedClusterList = map[string]string{ - "": "ManagedClusterList is a collection of managed cluster.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", - "items": "Items is a list of managed clusters.", -} - -func (ManagedClusterList) SwaggerDoc() map[string]string { - return map_ManagedClusterList -} - -var map_ManagedClusterSpec = map[string]string{ - "": "ManagedClusterSpec provides the information to securely connect to a remote server and verify its identity.", - "managedClusterClientConfigs": "ManagedClusterClientConfigs represents a list of the apiserver address of the managed cluster. If it is empty, the managed cluster has no accessible address for the hub to connect with it.", - "hubAcceptsClient": "hubAcceptsClient represents that hub accepts the joining of Klusterlet agent on the managed cluster with the hub. The default value is false, and can only be set true when the user on hub has an RBAC rule to UPDATE on the virtual subresource of managedclusters/accept. When the value is set true, a namespace whose name is the same as the name of ManagedCluster is created on the hub. This namespace represents the managed cluster, also role/rolebinding is created on the namespace to grant the permision of access from the agent on the managed cluster. When the value is set to false, the namespace representing the managed cluster is deleted.", - "leaseDurationSeconds": "LeaseDurationSeconds is used to coordinate the lease update time of Klusterlet agents on the managed cluster. If its value is zero, the Klusterlet agent will update its lease every 60 seconds by default", - "taints": "Taints is a property of managed cluster that allow the cluster to be repelled when scheduling. Taints, including 'ManagedClusterUnavailable' and 'ManagedClusterUnreachable', can not be added/removed by agent running on the managed cluster; while it's fine to add/remove other taints from either hub cluser or managed cluster.", -} - -func (ManagedClusterSpec) SwaggerDoc() map[string]string { - return map_ManagedClusterSpec -} - -var map_ManagedClusterStatus = map[string]string{ - "": "ManagedClusterStatus represents the current status of joined managed cluster.", - "conditions": "Conditions contains the different condition statuses for this managed cluster.", - "capacity": "Capacity represents the total resource capacity from all nodeStatuses on the managed cluster.", - "allocatable": "Allocatable represents the total allocatable resources on the managed cluster.", - "version": "Version represents the kubernetes version of the managed cluster.", - "clusterClaims": "ClusterClaims represents cluster information that a managed cluster claims, for example a unique cluster identifier (id.k8s.io) and kubernetes version (kubeversion.open-cluster-management.io). They are written from the managed cluster. The set of claims is not uniform across a fleet, some claims can be vendor or version specific and may not be included from all managed clusters.", -} - -func (ManagedClusterStatus) SwaggerDoc() map[string]string { - return map_ManagedClusterStatus -} - -var map_ManagedClusterVersion = map[string]string{ - "": "ManagedClusterVersion represents version information about the managed cluster.", - "kubernetes": "Kubernetes is the kubernetes version of managed cluster.", -} - -func (ManagedClusterVersion) SwaggerDoc() map[string]string { - return map_ManagedClusterVersion -} - -var map_Taint = map[string]string{ - "": "The managed cluster this Taint is attached to has the \"effect\" on any placement that does not tolerate the Taint.", - "key": "Key is the taint key applied to a cluster. e.g. bar or foo.example.com/bar. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)", - "value": "Value is the taint value corresponding to the taint key.", - "effect": "Effect indicates the effect of the taint on placements that do not tolerate the taint. Valid effects are NoSelect, PreferNoSelect and NoSelectIfNew.", - "timeAdded": "TimeAdded represents the time at which the taint was added.", -} - -func (Taint) SwaggerDoc() map[string]string { - return map_Taint -} - -// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/doc.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/doc.go index 28765f356..93f37581c 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/doc.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/doc.go @@ -1,7 +1,5 @@ // Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group // +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=open-cluster-management.io/api/cluster -// +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true // +kubebuilder:validation:Optional diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/helpers.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/helpers.go deleted file mode 100644 index d70865825..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/helpers.go +++ /dev/null @@ -1,382 +0,0 @@ -package v1alpha1 - -import ( - "fmt" - "math" - "regexp" - "sort" - "strconv" - "strings" - "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" - "k8s.io/utils/clock" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" -) - -var RolloutClock = clock.Clock(clock.RealClock{}) -var maxTimeDuration = time.Duration(math.MaxInt64) - -// RolloutStatus represents the status of a rollout operation. -type RolloutStatus int - -const ( - // ToApply indicates that the resource's desired status has not been applied yet. - ToApply RolloutStatus = iota - // Progressing indicates that the resource's desired status is applied and last applied status is not updated. - Progressing - // Succeeded indicates that the resource's desired status is applied and last applied status is successful. - Succeeded - // Failed indicates that the resource's desired status is applied and last applied status has failed. - Failed - // TimeOut indicates that the rollout status is progressing or failed and the status remains - // for longer than the timeout, resulting in a timeout status. - TimeOut - // Skip indicates that the rollout should be skipped on this cluster. - Skip -) - -// ClusterRolloutStatusFunc defines a function to return the rollout status for a managed cluster. -type ClusterRolloutStatusFunc func(clusterName string) ClusterRolloutStatus - -// ClusterRolloutStatus holds the rollout status information for a cluster. -type ClusterRolloutStatus struct { - // GroupKey represents the cluster group key (optional field). - GroupKey clusterv1beta1.GroupKey - // Status is the required field indicating the rollout status. - Status RolloutStatus - // LastTransitionTime is the last transition time of the rollout status (optional field). - // Used to calculate timeout for progressing and failed status. - LastTransitionTime *metav1.Time - // TimeOutTime is the timeout time when the status is progressing or failed (optional field). - TimeOutTime *metav1.Time -} - -// RolloutResult contains the clusters to be rolled out and the clusters that have timed out. -type RolloutResult struct { - // ClustersToRollout is a map where the key is the cluster name and the value is the ClusterRolloutStatus. - ClustersToRollout map[string]ClusterRolloutStatus - // ClustersTimeOut is a map where the key is the cluster name and the value is the ClusterRolloutStatus. - ClustersTimeOut map[string]ClusterRolloutStatus -} - -// +k8s:deepcopy-gen=false -type RolloutHandler struct { - // placement decision tracker - pdTracker *clusterv1beta1.PlacementDecisionClustersTracker -} - -func NewRolloutHandler(pdTracker *clusterv1beta1.PlacementDecisionClustersTracker) (*RolloutHandler, error) { - if pdTracker == nil { - return nil, fmt.Errorf("invalid placement decision tracker %v", pdTracker) - } - - return &RolloutHandler{pdTracker: pdTracker}, nil -} - -// The input is a duck type RolloutStrategy and a ClusterRolloutStatusFunc to return the rollout status on each managed cluster. -// Return the strategy actual take effect and a list of clusters that need to rollout and that are timeout. -// -// ClustersToRollout: If mandatory decision groups are defined in strategy, will return the clusters to rollout in mandatory decision groups first. -// When all the mandatory decision groups rollout successfully, will return the rest of the clusters that need to rollout. -// -// ClustersTimeOut: If the cluster status is Progressing or Failed, and the status lasts longer than timeout defined in strategy, -// will list them RolloutResult.ClustersTimeOut with status TimeOut. -func (r *RolloutHandler) GetRolloutCluster(rolloutStrategy RolloutStrategy, statusFunc ClusterRolloutStatusFunc) (*RolloutStrategy, RolloutResult, error) { - switch rolloutStrategy.Type { - case All: - return r.getRolloutAllClusters(rolloutStrategy, statusFunc) - case Progressive: - return r.getProgressiveClusters(rolloutStrategy, statusFunc) - case ProgressivePerGroup: - return r.getProgressivePerGroupClusters(rolloutStrategy, statusFunc) - default: - return nil, RolloutResult{}, fmt.Errorf("incorrect rollout strategy type %v", rolloutStrategy.Type) - } -} - -func (r *RolloutHandler) getRolloutAllClusters(rolloutStrategy RolloutStrategy, statusFunc ClusterRolloutStatusFunc) (*RolloutStrategy, RolloutResult, error) { - // Prepare the rollout strategy - strategy := RolloutStrategy{Type: All} - strategy.All = rolloutStrategy.All.DeepCopy() - if strategy.All == nil { - strategy.All = &RolloutAll{} - } - - // Parse timeout for the rollout - failureTimeout, err := parseTimeout(strategy.All.Timeout.Timeout) - if err != nil { - return &strategy, RolloutResult{}, err - } - - // Get all clusters and perform progressive rollout - totalClusterGroups := r.pdTracker.ExistingClusterGroupsBesides() - totalClusters := totalClusterGroups.GetClusters().UnsortedList() - rolloutResult := progressivePerCluster(totalClusterGroups, len(totalClusters), failureTimeout, statusFunc) - - return &strategy, rolloutResult, nil -} - -func (r *RolloutHandler) getProgressiveClusters(rolloutStrategy RolloutStrategy, statusFunc ClusterRolloutStatusFunc) (*RolloutStrategy, RolloutResult, error) { - // Prepare the rollout strategy - strategy := RolloutStrategy{Type: Progressive} - strategy.Progressive = rolloutStrategy.Progressive.DeepCopy() - if strategy.Progressive == nil { - strategy.Progressive = &RolloutProgressive{} - } - - // Upgrade mandatory decision groups first - groupKeys := decisionGroupsToGroupKeys(strategy.Progressive.MandatoryDecisionGroups.MandatoryDecisionGroups) - clusterGroups := r.pdTracker.ExistingClusterGroups(groupKeys...) - - // Perform progressive rollout for mandatory decision groups - rolloutResult := progressivePerGroup(clusterGroups, maxTimeDuration, statusFunc) - if len(rolloutResult.ClustersToRollout) > 0 { - return &strategy, rolloutResult, nil - } - - // Parse timeout for non-mandatory decision groups - failureTimeout, err := parseTimeout(strategy.Progressive.Timeout.Timeout) - if err != nil { - return &strategy, RolloutResult{}, err - } - - // Calculate the length for progressive rollout - totalClusters := r.pdTracker.ExistingClusterGroupsBesides().GetClusters() - length, err := calculateLength(strategy.Progressive.MaxConcurrency, len(totalClusters)) - if err != nil { - return &strategy, RolloutResult{}, err - } - - // Upgrade the remaining clusters - restClusterGroups := r.pdTracker.ExistingClusterGroupsBesides(clusterGroups.GetOrderedGroupKeys()...) - rolloutResult = progressivePerCluster(restClusterGroups, length, failureTimeout, statusFunc) - - return &strategy, rolloutResult, nil -} - -func (r *RolloutHandler) getProgressivePerGroupClusters(rolloutStrategy RolloutStrategy, statusFunc ClusterRolloutStatusFunc) (*RolloutStrategy, RolloutResult, error) { - // Prepare the rollout strategy - strategy := RolloutStrategy{Type: ProgressivePerGroup} - strategy.ProgressivePerGroup = rolloutStrategy.ProgressivePerGroup.DeepCopy() - if strategy.ProgressivePerGroup == nil { - strategy.ProgressivePerGroup = &RolloutProgressivePerGroup{} - } - - // Upgrade mandatory decision groups first - mandatoryDecisionGroups := strategy.ProgressivePerGroup.MandatoryDecisionGroups.MandatoryDecisionGroups - groupKeys := decisionGroupsToGroupKeys(mandatoryDecisionGroups) - clusterGroups := r.pdTracker.ExistingClusterGroups(groupKeys...) - - // Perform progressive rollout per group for mandatory decision groups - rolloutResult := progressivePerGroup(clusterGroups, maxTimeDuration, statusFunc) - if len(rolloutResult.ClustersToRollout) > 0 { - return &strategy, rolloutResult, nil - } - - // Parse timeout for non-mandatory decision groups - failureTimeout, err := parseTimeout(strategy.ProgressivePerGroup.Timeout.Timeout) - if err != nil { - return &strategy, RolloutResult{}, err - } - - // Upgrade the rest of the decision groups - restClusterGroups := r.pdTracker.ExistingClusterGroupsBesides(clusterGroups.GetOrderedGroupKeys()...) - - // Perform progressive rollout per group for the remaining decision groups - rolloutResult = progressivePerGroup(restClusterGroups, failureTimeout, statusFunc) - return &strategy, rolloutResult, nil -} - -func progressivePerCluster(clusterGroupsMap clusterv1beta1.ClusterGroupsMap, length int, timeout time.Duration, statusFunc ClusterRolloutStatusFunc) RolloutResult { - rolloutClusters := map[string]ClusterRolloutStatus{} - timeoutClusters := map[string]ClusterRolloutStatus{} - - if length == 0 { - return RolloutResult{ - ClustersToRollout: rolloutClusters, - ClustersTimeOut: timeoutClusters, - } - } - - clusters := clusterGroupsMap.GetClusters().UnsortedList() - clusterToGroupKey := clusterGroupsMap.ClusterToGroupKey() - - // Sort the clusters in alphabetical order to ensure consistency. - sort.Strings(clusters) - for _, cluster := range clusters { - status := statusFunc(cluster) - if groupKey, exists := clusterToGroupKey[cluster]; exists { - status.GroupKey = groupKey - } - - newStatus, needToRollout := determineRolloutStatusAndContinue(status, timeout) - status.Status = newStatus.Status - status.TimeOutTime = newStatus.TimeOutTime - - if needToRollout { - rolloutClusters[cluster] = status - } - if status.Status == TimeOut { - timeoutClusters[cluster] = status - } - - if len(rolloutClusters)%length == 0 && len(rolloutClusters) > 0 { - return RolloutResult{ - ClustersToRollout: rolloutClusters, - ClustersTimeOut: timeoutClusters, - } - } - } - - return RolloutResult{ - ClustersToRollout: rolloutClusters, - ClustersTimeOut: timeoutClusters, - } -} - -func progressivePerGroup(clusterGroupsMap clusterv1beta1.ClusterGroupsMap, timeout time.Duration, statusFunc ClusterRolloutStatusFunc) RolloutResult { - rolloutClusters := map[string]ClusterRolloutStatus{} - timeoutClusters := map[string]ClusterRolloutStatus{} - - clusterGroupKeys := clusterGroupsMap.GetOrderedGroupKeys() - - for _, key := range clusterGroupKeys { - if subclusters, ok := clusterGroupsMap[key]; ok { - // Iterate through clusters in the group - for _, cluster := range subclusters.UnsortedList() { - status := statusFunc(cluster) - status.GroupKey = key - - newStatus, needToRollout := determineRolloutStatusAndContinue(status, timeout) - status.Status = newStatus.Status - status.TimeOutTime = newStatus.TimeOutTime - - if needToRollout { - rolloutClusters[cluster] = status - } - if status.Status == TimeOut { - timeoutClusters[cluster] = status - } - } - - // Return if there are clusters to rollout - if len(rolloutClusters) > 0 { - return RolloutResult{ - ClustersToRollout: rolloutClusters, - ClustersTimeOut: timeoutClusters, - } - } - } - } - - return RolloutResult{ - ClustersToRollout: rolloutClusters, - ClustersTimeOut: timeoutClusters, - } -} - -// determineRolloutStatusAndContinue checks whether a cluster should continue its rollout based on -// its current status and timeout. The function returns an updated cluster status and a boolean -// indicating whether the rollout should continue. -// -// The timeout parameter is utilized for handling progressing and failed statuses: -// 1. If timeout is set to None (maxTimeDuration), the function will wait until cluster reaching a success status. -// It returns true to include the cluster in the result and halts the rollout of other clusters or groups. -// 2. If timeout is set to 0, the function proceeds with upgrading other clusters without waiting. -// It returns false to skip waiting for the cluster to reach a success status and continues to rollout others. -func determineRolloutStatusAndContinue(status ClusterRolloutStatus, timeout time.Duration) (*ClusterRolloutStatus, bool) { - newStatus := status.DeepCopy() - switch status.Status { - case ToApply: - return newStatus, true - case TimeOut, Succeeded, Skip: - return newStatus, false - case Progressing, Failed: - timeOutTime := getTimeOutTime(status.LastTransitionTime, timeout) - newStatus.TimeOutTime = timeOutTime - - // check if current time is before the timeout time - if RolloutClock.Now().Before(timeOutTime.Time) { - return newStatus, true - } else { - newStatus.Status = TimeOut - return newStatus, false - } - default: - return newStatus, true - } -} - -// get the timeout time -func getTimeOutTime(startTime *metav1.Time, timeout time.Duration) *metav1.Time { - var timeoutTime time.Time - if startTime == nil { - timeoutTime = RolloutClock.Now().Add(timeout) - } else { - timeoutTime = startTime.Add(timeout) - } - return &metav1.Time{Time: timeoutTime} -} - -func calculateLength(maxConcurrency intstr.IntOrString, total int) (int, error) { - length := total - - switch maxConcurrency.Type { - case intstr.Int: - length = maxConcurrency.IntValue() - case intstr.String: - str := maxConcurrency.StrVal - if strings.HasSuffix(str, "%") { - f, err := strconv.ParseFloat(str[:len(str)-1], 64) - if err != nil { - return length, err - } - length = int(math.Ceil(f / 100 * float64(total))) - } else { - return length, fmt.Errorf("%v invalid type: string is not a percentage", maxConcurrency) - } - default: - return length, fmt.Errorf("incorrect MaxConcurrency type %v", maxConcurrency.Type) - } - - if length <= 0 || length > total { - length = total - } - - return length, nil -} - -func parseTimeout(timeoutStr string) (time.Duration, error) { - // Define the regex pattern to match the timeout string - pattern := "^(([0-9])+[h|m|s])|None$" - regex := regexp.MustCompile(pattern) - - if timeoutStr == "None" || timeoutStr == "" { - // If the timeout is "None" or empty, return the maximum duration - return maxTimeDuration, nil - } - - // Check if the timeout string matches the pattern - if !regex.MatchString(timeoutStr) { - return maxTimeDuration, fmt.Errorf("invalid timeout format") - } - - return time.ParseDuration(timeoutStr) -} - -func decisionGroupsToGroupKeys(decisionsGroup []MandatoryDecisionGroup) []clusterv1beta1.GroupKey { - result := []clusterv1beta1.GroupKey{} - for _, d := range decisionsGroup { - gk := clusterv1beta1.GroupKey{} - // GroupName is considered first to select the decisionGroups then GroupIndex. - if d.GroupName != "" { - gk.GroupName = d.GroupName - } else { - gk.GroupIndex = d.GroupIndex - } - result = append(result, gk) - } - return result -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_rolloutstrategy.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_rolloutstrategy.go index c9fa38155..2c863bb50 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_rolloutstrategy.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_rolloutstrategy.go @@ -1,73 +1,116 @@ package v1alpha1 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) // +k8s:deepcopy-gen=true -// RolloutStrategy API used by workload applier APIs to define how the workload will be applied to the selected clusters by the Placement and DecisionStrategy. +// RolloutStrategy API used by workload applier APIs to define how the workload will be applied to +// the selected clusters by the Placement and DecisionStrategy. + +type RolloutType string const ( //All means apply the workload to all clusters in the decision groups at once. - All string = "All" + All RolloutType = "All" //Progressive means apply the workload to the selected clusters progressively per cluster. - Progressive string = "Progressive" + Progressive RolloutType = "Progressive" //ProgressivePerGroup means apply the workload to the selected clusters progressively per group. - ProgressivePerGroup string = "ProgressivePerGroup" + ProgressivePerGroup RolloutType = "ProgressivePerGroup" ) // Rollout strategy to apply workload to the selected clusters by Placement and DecisionStrategy. type RolloutStrategy struct { // Rollout strategy Types are All, Progressive and ProgressivePerGroup // 1) All means apply the workload to all clusters in the decision groups at once. - // 2) Progressive means apply the workload to the selected clusters progressively per cluster. The workload will not be applied to the next cluster unless one of the current applied clusters reach the successful state or timeout. - // 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per group. The workload will not be applied to the next decisionGroup unless all clusters in the current group reach the successful state or timeout. + // 2) Progressive means apply the workload to the selected clusters progressively per cluster. The + // workload will not be applied to the next cluster unless one of the current applied clusters + // reach the successful state and haven't breached the MaxFailures configuration. + // 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per + // group. The workload will not be applied to the next decisionGroup unless all clusters in the + // current group reach the successful state and haven't breached the MaxFailures configuration. + // +kubebuilder:validation:Enum=All;Progressive;ProgressivePerGroup // +kubebuilder:default:=All // +optional - Type string `json:"type,omitempty"` + Type RolloutType `json:"type,omitempty"` - // All define required fields for RolloutStrategy type All + // All defines required fields for RolloutStrategy type All // +optional All *RolloutAll `json:"all,omitempty"` - // Progressive define required fields for RolloutStrategy type Progressive + // Progressive defines required fields for RolloutStrategy type Progressive // +optional Progressive *RolloutProgressive `json:"progressive,omitempty"` - // ProgressivePerGroup define required fields for RolloutStrategy type ProgressivePerGroup + // ProgressivePerGroup defines required fields for RolloutStrategy type ProgressivePerGroup // +optional ProgressivePerGroup *RolloutProgressivePerGroup `json:"progressivePerGroup,omitempty"` } // Timeout to consider while applying the workload. -type Timeout struct { - // Timeout define how long workload applier controller will wait till workload reach successful state in the cluster. - // Timeout default value is None meaning the workload applier will not proceed apply workload to other clusters if did not reach the successful state. - // Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s +type RolloutConfig struct { + // MinSuccessTime is a "soak" time. In other words, the minimum amount of time the workload + // applier controller will wait from the start of each rollout before proceeding (assuming a + // successful state has been reached and MaxFailures wasn't breached). + // MinSuccessTime is only considered for rollout types Progressive and ProgressivePerGroup. + // The default value is 0 meaning the workload applier proceeds immediately after a successful + // state is reached. + // MinSuccessTime must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s + // +kubebuilder:default:="0" + // +optional + MinSuccessTime metav1.Duration `json:"minSuccessTime,omitempty"` + // ProgressDeadline defines how long workload applier controller will wait for the workload to + // reach a successful state in the cluster. + // If the workload does not reach a successful state after ProgressDeadline, will stop waiting + // and workload will be treated as "timeout" and be counted into MaxFailures. Once the MaxFailures + // is breached, the rollout will stop. + // ProgressDeadline default value is "None", meaning the workload applier will wait for a + // successful state indefinitely. + // ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s // +kubebuilder:validation:Pattern="^(([0-9])+[h|m|s])|None$" - // +kubebuilder:default:=None + // +kubebuilder:default:="None" + // +optional + ProgressDeadline string `json:"progressDeadline,omitempty"` + // MaxFailures is a percentage or number of clusters in the current rollout that can fail before + // proceeding to the next rollout. Fail means the cluster has a failed status or timeout status + // (does not reach successful status after ProgressDeadline). + // Once the MaxFailures is breached, the rollout will stop. + // MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For + // Progressive, this is considered over the total number of clusters. For ProgressivePerGroup, + // this is considered according to the size of the current group. For both Progressive and + // ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate + // no failures. + // Default is that no failures are tolerated. + // +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$" + // +kubebuilder:validation:XIntOrString + // +kubebuilder:default=0 // +optional - Timeout string `json:"timeout,omitempty"` + MaxFailures intstr.IntOrString `json:"maxFailures,omitempty"` } // MandatoryDecisionGroup set the decision group name or group index. // GroupName is considered first to select the decisionGroups then GroupIndex. type MandatoryDecisionGroup struct { - // GroupName of the decision group should match the placementDecisions label value with label key cluster.open-cluster-management.io/decision-group-name + // GroupName of the decision group should match the placementDecisions label value with label key + // cluster.open-cluster-management.io/decision-group-name // +optional GroupName string `json:"groupName,omitempty"` - // GroupIndex of the decision group should match the placementDecisions label value with label key cluster.open-cluster-management.io/decision-group-index + // GroupIndex of the decision group should match the placementDecisions label value with label key + // cluster.open-cluster-management.io/decision-group-index // +optional GroupIndex int32 `json:"groupIndex,omitempty"` } // MandatoryDecisionGroups type MandatoryDecisionGroups struct { - // List of the decision groups names or indexes to apply the workload first and fail if workload did not reach successful state. - // GroupName or GroupIndex must match with the decisionGroups defined in the placement's decisionStrategy + // List of the decision groups names or indexes to apply the workload first and fail if workload + // did not reach successful state. + // GroupName or GroupIndex must match with the decisionGroups defined in the placement's + // decisionStrategy // +optional MandatoryDecisionGroups []MandatoryDecisionGroup `json:"mandatoryDecisionGroups,omitempty"` } @@ -75,29 +118,31 @@ type MandatoryDecisionGroups struct { // RolloutAll is a RolloutStrategy Type type RolloutAll struct { // +optional - Timeout `json:",inline"` + RolloutConfig `json:",inline"` } // RolloutProgressivePerGroup is a RolloutStrategy Type type RolloutProgressivePerGroup struct { // +optional - MandatoryDecisionGroups `json:",inline"` + RolloutConfig `json:",inline"` // +optional - Timeout `json:",inline"` + MandatoryDecisionGroups `json:",inline"` } // RolloutProgressive is a RolloutStrategy Type type RolloutProgressive struct { + // +optional + RolloutConfig `json:",inline"` + // +optional MandatoryDecisionGroups `json:",inline"` - // MaxConcurrency is the max number of clusters to deploy workload concurrently. The default value for MaxConcurrency is determined from the clustersPerDecisionGroup defined in the placement->DecisionStrategy. + // MaxConcurrency is the max number of clusters to deploy workload concurrently. The default value + // for MaxConcurrency is determined from the clustersPerDecisionGroup defined in the + // placement->DecisionStrategy. // +kubebuilder:validation:Pattern="^((100|[0-9]{1,2})%|[0-9]+)$" // +kubebuilder:validation:XIntOrString // +optional MaxConcurrency intstr.IntOrString `json:"maxConcurrency,omitempty"` - - // +optional - Timeout `json:",inline"` } diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go index a72d4c816..e40f74e4d 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go @@ -194,31 +194,6 @@ func (in *ClusterClaimSpec) DeepCopy() *ClusterClaimSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterRolloutStatus) DeepCopyInto(out *ClusterRolloutStatus) { - *out = *in - out.GroupKey = in.GroupKey - if in.LastTransitionTime != nil { - in, out := &in.LastTransitionTime, &out.LastTransitionTime - *out = (*in).DeepCopy() - } - if in.TimeOutTime != nil { - in, out := &in.TimeOutTime, &out.TimeOutTime - *out = (*in).DeepCopy() - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRolloutStatus. -func (in *ClusterRolloutStatus) DeepCopy() *ClusterRolloutStatus { - if in == nil { - return nil - } - out := new(ClusterRolloutStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MandatoryDecisionGroup) DeepCopyInto(out *MandatoryDecisionGroup) { *out = *in @@ -259,7 +234,7 @@ func (in *MandatoryDecisionGroups) DeepCopy() *MandatoryDecisionGroups { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RolloutAll) DeepCopyInto(out *RolloutAll) { *out = *in - out.Timeout = in.Timeout + out.RolloutConfig = in.RolloutConfig return } @@ -274,68 +249,56 @@ func (in *RolloutAll) DeepCopy() *RolloutAll { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RolloutProgressive) DeepCopyInto(out *RolloutProgressive) { +func (in *RolloutConfig) DeepCopyInto(out *RolloutConfig) { *out = *in - in.MandatoryDecisionGroups.DeepCopyInto(&out.MandatoryDecisionGroups) - out.MaxConcurrency = in.MaxConcurrency - out.Timeout = in.Timeout + out.MinSuccessTime = in.MinSuccessTime + out.MaxFailures = in.MaxFailures return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutProgressive. -func (in *RolloutProgressive) DeepCopy() *RolloutProgressive { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutConfig. +func (in *RolloutConfig) DeepCopy() *RolloutConfig { if in == nil { return nil } - out := new(RolloutProgressive) + out := new(RolloutConfig) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RolloutProgressivePerGroup) DeepCopyInto(out *RolloutProgressivePerGroup) { +func (in *RolloutProgressive) DeepCopyInto(out *RolloutProgressive) { *out = *in + out.RolloutConfig = in.RolloutConfig in.MandatoryDecisionGroups.DeepCopyInto(&out.MandatoryDecisionGroups) - out.Timeout = in.Timeout + out.MaxConcurrency = in.MaxConcurrency return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutProgressivePerGroup. -func (in *RolloutProgressivePerGroup) DeepCopy() *RolloutProgressivePerGroup { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutProgressive. +func (in *RolloutProgressive) DeepCopy() *RolloutProgressive { if in == nil { return nil } - out := new(RolloutProgressivePerGroup) + out := new(RolloutProgressive) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RolloutResult) DeepCopyInto(out *RolloutResult) { +func (in *RolloutProgressivePerGroup) DeepCopyInto(out *RolloutProgressivePerGroup) { *out = *in - if in.ClustersToRollout != nil { - in, out := &in.ClustersToRollout, &out.ClustersToRollout - *out = make(map[string]ClusterRolloutStatus, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.ClustersTimeOut != nil { - in, out := &in.ClustersTimeOut, &out.ClustersTimeOut - *out = make(map[string]ClusterRolloutStatus, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } + out.RolloutConfig = in.RolloutConfig + in.MandatoryDecisionGroups.DeepCopyInto(&out.MandatoryDecisionGroups) return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutResult. -func (in *RolloutResult) DeepCopy() *RolloutResult { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutProgressivePerGroup. +func (in *RolloutProgressivePerGroup) DeepCopy() *RolloutProgressivePerGroup { if in == nil { return nil } - out := new(RolloutResult) + out := new(RolloutProgressivePerGroup) in.DeepCopyInto(out) return out } @@ -370,19 +333,3 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Timeout) DeepCopyInto(out *Timeout) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Timeout. -func (in *Timeout) DeepCopy() *Timeout { - if in == nil { - return nil - } - out := new(Timeout) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go index 4cadc7a2e..64c51d246 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go @@ -105,6 +105,17 @@ func (RolloutAll) SwaggerDoc() map[string]string { return map_RolloutAll } +var map_RolloutConfig = map[string]string{ + "": "Timeout to consider while applying the workload.", + "minSuccessTime": "MinSuccessTime is a \"soak\" time. In other words, the minimum amount of time the workload applier controller will wait from the start of each rollout before proceeding (assuming a successful state has been reached and MaxFailures wasn't breached). MinSuccessTime is only considered for rollout types Progressive and ProgressivePerGroup. The default value is 0 meaning the workload applier proceeds immediately after a successful state is reached. MinSuccessTime must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", + "progressDeadline": "ProgressDeadline defines how long workload applier controller will wait for the workload to reach a successful state in the cluster. If the workload does not reach a successful state after ProgressDeadline, will stop waiting and workload will be treated as \"timeout\" and be counted into MaxFailures. Once the MaxFailures is breached, the rollout will stop. ProgressDeadline default value is \"None\", meaning the workload applier will wait for a successful state indefinitely. ProgressDeadline must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", + "maxFailures": "MaxFailures is a percentage or number of clusters in the current rollout that can fail before proceeding to the next rollout. Fail means the cluster has a failed status or timeout status (does not reach successful status after ProgressDeadline). Once the MaxFailures is breached, the rollout will stop. MaxFailures is only considered for rollout types Progressive and ProgressivePerGroup. For Progressive, this is considered over the total number of clusters. For ProgressivePerGroup, this is considered according to the size of the current group. For both Progressive and ProgressivePerGroup, the MaxFailures does not apply for MandatoryDecisionGroups, which tolerate no failures. Default is that no failures are tolerated.", +} + +func (RolloutConfig) SwaggerDoc() map[string]string { + return map_RolloutConfig +} + var map_RolloutProgressive = map[string]string{ "": "RolloutProgressive is a RolloutStrategy Type", "maxConcurrency": "MaxConcurrency is the max number of clusters to deploy workload concurrently. The default value for MaxConcurrency is determined from the clustersPerDecisionGroup defined in the placement->DecisionStrategy.", @@ -124,23 +135,13 @@ func (RolloutProgressivePerGroup) SwaggerDoc() map[string]string { var map_RolloutStrategy = map[string]string{ "": "Rollout strategy to apply workload to the selected clusters by Placement and DecisionStrategy.", - "type": "Rollout strategy Types are All, Progressive and ProgressivePerGroup 1) All means apply the workload to all clusters in the decision groups at once. 2) Progressive means apply the workload to the selected clusters progressively per cluster. The workload will not be applied to the next cluster unless one of the current applied clusters reach the successful state or timeout. 3) ProgressivePerGroup means apply the workload to decisionGroup clusters progressively per group. The workload will not be applied to the next decisionGroup unless all clusters in the current group reach the successful state or timeout.", - "all": "All define required fields for RolloutStrategy type All", - "progressive": "Progressive define required fields for RolloutStrategy type Progressive", - "progressivePerGroup": "ProgressivePerGroup define required fields for RolloutStrategy type ProgressivePerGroup", + "all": "All defines required fields for RolloutStrategy type All", + "progressive": "Progressive defines required fields for RolloutStrategy type Progressive", + "progressivePerGroup": "ProgressivePerGroup defines required fields for RolloutStrategy type ProgressivePerGroup", } func (RolloutStrategy) SwaggerDoc() map[string]string { return map_RolloutStrategy } -var map_Timeout = map[string]string{ - "": "Timeout to consider while applying the workload.", - "timeout": "Timeout define how long workload applier controller will wait till workload reach successful state in the cluster. Timeout default value is None meaning the workload applier will not proceed apply workload to other clusters if did not reach the successful state. Timeout must be defined in [0-9h]|[0-9m]|[0-9s] format examples; 2h , 90m , 360s", -} - -func (Timeout) SwaggerDoc() map[string]string { - return map_Timeout -} - // AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml deleted file mode 100644 index f2f9f546e..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml +++ /dev/null @@ -1,673 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: placements.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: Placement - listKind: PlacementList - plural: placements - singular: placement - preserveUnknownFields: false - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=="PlacementSatisfied")].status - name: Succeeded - type: string - - jsonPath: .status.conditions[?(@.type=="PlacementSatisfied")].reason - name: Reason - type: string - - jsonPath: .status.numberOfSelectedClusters - name: SelectedClusters - type: integer - name: v1beta1 - schema: - openAPIV3Schema: - description: "Placement defines a rule to select a set of ManagedClusters - from the ManagedClusterSets bound to the placement namespace. \n Here is - how the placement policy combines with other selection methods to determine - a matching list of ManagedClusters: 1. Kubernetes clusters are registered - with hub as cluster-scoped ManagedClusters; 2. ManagedClusters are organized - into cluster-scoped ManagedClusterSets; 3. ManagedClusterSets are bound - to workload namespaces; 4. Namespace-scoped Placements specify a slice of - ManagedClusterSets which select a working set of potential ManagedClusters; - 5. Then Placements subselect from that working set using label/claim selection. - \n No ManagedCluster will be selected if no ManagedClusterSet is bound to - the placement namespace. User is able to bind a ManagedClusterSet to a namespace - by creating a ManagedClusterSetBinding in that namespace if they have a - RBAC rule to CREATE on the virtual subresource of `managedclustersets/bind`. - \n A slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement - name} will be created to represent the ManagedClusters selected by this - placement. \n If a ManagedCluster is selected and added into the PlacementDecisions, - other components may apply workload on it; once it is removed from the PlacementDecisions, - the workload applied on this ManagedCluster should be evicted accordingly." - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: Spec defines the attributes of Placement. - properties: - clusterSets: - description: ClusterSets represent the ManagedClusterSets from which - the ManagedClusters are selected. If the slice is empty, ManagedClusters - will be selected from the ManagedClusterSets bound to the placement - namespace, otherwise ManagedClusters will be selected from the intersection - of this slice and the ManagedClusterSets bound to the placement - namespace. - items: - type: string - type: array - decisionStrategy: - description: DecisionStrategy divide the created placement decision - to groups and define number of clusters per decision group. - properties: - groupStrategy: - description: GroupStrategy define strategies to divide selected - clusters to decision groups. - properties: - clustersPerDecisionGroup: - anyOf: - - type: integer - - type: string - default: 100% - description: "ClustersPerDecisionGroup is a specific number - or percentage of the total selected clusters. The specific - number will divide the placementDecisions to decisionGroups - each group has max number of clusters equal to that specific - number. The percentage will divide the placementDecisions - to decisionGroups each group has max number of clusters - based on the total num of selected clusters and percentage. - ex; for a total 100 clusters selected, ClustersPerDecisionGroup - equal to 20% will divide the placement decision to 5 groups - each group should have 20 clusters. Default is having all - clusters in a single group. \n The predefined decisionGroups - is expected to be a subset of the selected clusters and - the number of items in each group SHOULD be less than ClustersPerDecisionGroup. - Once the number of items exceeds the ClustersPerDecisionGroup, - the decisionGroups will also be be divided into multiple - decisionGroups with same GroupName but different GroupIndex." - pattern: ^((100|[1-9][0-9]{0,1})%|[1-9][0-9]*)$ - x-kubernetes-int-or-string: true - decisionGroups: - description: DecisionGroups represents a list of predefined - groups to put decision results. Decision groups will be - constructed based on the DecisionGroups field at first. - The clusters not included in the DecisionGroups will be - divided to other decision groups afterwards. Each decision - group should not have the number of clusters larger than - the ClustersPerDecisionGroup. - items: - description: DecisionGroup define a subset of clusters that - will be added to placementDecisions with groupName label. - properties: - groupClusterSelector: - description: LabelSelector to select clusters subset - by label. - properties: - claimSelector: - description: ClaimSelector represents a selector - of ManagedClusters by clusterClaims in status - properties: - matchExpressions: - description: matchExpressions is a list of cluster - claim selector requirements. The requirements - are ANDed. - items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. - type: string - values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - labelSelector: - description: LabelSelector represents a selector - of ManagedClusters by label - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: A label selector requirement - is a selector that contains values, a key, - and an operator that relates the key and - values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and - DoesNotExist. - type: string - values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. - If the operator is Exists or DoesNotExist, - the values array must be empty. This - array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is - "In", and the values array contains only "value". - The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - type: object - groupName: - description: Group name to be added as label value to - the created placement Decisions labels with label - key cluster.open-cluster-management.io/decision-group-name - pattern: ^[a-zA-Z0-9][-A-Za-z0-9_.]{0,61}[a-zA-Z0-9]$ - type: string - required: - - groupClusterSelector - - groupName - type: object - type: array - type: object - type: object - numberOfClusters: - description: NumberOfClusters represents the desired number of ManagedClusters - to be selected which meet the placement requirements. 1) If not - specified, all ManagedClusters which meet the placement requirements - (including ClusterSets, and Predicates) will be selected; 2) Otherwise - if the nubmer of ManagedClusters meet the placement requirements - is larger than NumberOfClusters, a random subset with desired number - of ManagedClusters will be selected; 3) If the nubmer of ManagedClusters - meet the placement requirements is equal to NumberOfClusters, all - of them will be selected; 4) If the nubmer of ManagedClusters meet - the placement requirements is less than NumberOfClusters, all of - them will be selected, and the status of condition `PlacementConditionSatisfied` - will be set to false; - format: int32 - type: integer - predicates: - description: Predicates represent a slice of predicates to select - ManagedClusters. The predicates are ORed. - items: - description: ClusterPredicate represents a predicate to select ManagedClusters. - properties: - requiredClusterSelector: - description: RequiredClusterSelector represents a selector of - ManagedClusters by label and claim. If specified, 1) Any ManagedCluster, - which does not match the selector, should not be selected - by this ClusterPredicate; 2) If a selected ManagedCluster - (of this ClusterPredicate) ceases to match the selector (e.g. - due to an update) of any ClusterPredicate, it will be eventually - removed from the placement decisions; 3) If a ManagedCluster - (not selected previously) starts to match the selector, it - will either be selected or at least has a chance to be selected - (when NumberOfClusters is specified); - properties: - claimSelector: - description: ClaimSelector represents a selector of ManagedClusters - by clusterClaims in status - properties: - matchExpressions: - description: matchExpressions is a list of cluster claim - selector requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, - NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists - or DoesNotExist, the values array must be empty. - This array is replaced during a strategic merge - patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - labelSelector: - description: LabelSelector represents a selector of ManagedClusters - by label - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, - NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists - or DoesNotExist, the values array must be empty. - This array is replaced during a strategic merge - patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field - is "key", the operator is "In", and the values array - contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - type: object - type: object - type: array - prioritizerPolicy: - description: PrioritizerPolicy defines the policy of the prioritizers. - If this field is unset, then default prioritizer mode and configurations - are used. Referring to PrioritizerPolicy to see more description - about Mode and Configurations. - properties: - configurations: - items: - description: PrioritizerConfig represents the configuration - of prioritizer - properties: - scoreCoordinate: - description: ScoreCoordinate represents the configuration - of the prioritizer and score source. - properties: - addOn: - description: When type is "AddOn", AddOn defines the - resource name and score name. - properties: - resourceName: - description: ResourceName defines the resource name - of the AddOnPlacementScore. The placement prioritizer - selects AddOnPlacementScore CR by this name. - type: string - scoreName: - description: ScoreName defines the score name inside - AddOnPlacementScore. AddOnPlacementScore contains - a list of score name and score value, ScoreName - specify the score to be used by the prioritizer. - type: string - required: - - resourceName - - scoreName - type: object - builtIn: - description: 'BuiltIn defines the name of a BuiltIn - prioritizer. Below are the valid BuiltIn prioritizer - names. 1) Balance: balance the decisions among the - clusters. 2) Steady: ensure the existing decision - is stabilized. 3) ResourceAllocatableCPU & ResourceAllocatableMemory: - sort clusters based on the allocatable. 4) Spread: - spread the workload evenly to topologies.' - type: string - type: - default: BuiltIn - description: Type defines the type of the prioritizer - score. Type is either "BuiltIn", "AddOn" or "", where - "" is "BuiltIn" by default. When the type is "BuiltIn", - need to specify a BuiltIn prioritizer name in BuiltIn. - When the type is "AddOn", need to configure the score - source in AddOn. - enum: - - BuiltIn - - AddOn - type: string - required: - - type - type: object - weight: - default: 1 - description: Weight defines the weight of the prioritizer - score. The value must be ranged in [-10,10]. Each prioritizer - will calculate an integer score of a cluster in the range - of [-100, 100]. The final score of a cluster will be sum(weight - * prioritizer_score). A higher weight indicates that the - prioritizer weights more in the cluster selection, while - 0 weight indicates that the prioritizer is disabled. A - negative weight indicates wants to select the last ones. - format: int32 - maximum: 10 - minimum: -10 - type: integer - required: - - scoreCoordinate - type: object - type: array - mode: - default: Additive - description: Mode is either Exact, Additive, "" where "" is Additive - by default. In Additive mode, any prioritizer not explicitly - enumerated is enabled in its default Configurations, in which - Steady and Balance prioritizers have the weight of 1 while other - prioritizers have the weight of 0. Additive doesn't require - configuring all prioritizers. The default Configurations may - change in the future, and additional prioritization will happen. - In Exact mode, any prioritizer not explicitly enumerated is - weighted as zero. Exact requires knowing the full set of prioritizers - you want, but avoids behavior changes between releases. - type: string - type: object - spreadPolicy: - description: SpreadPolicy defines how placement decisions should be - distributed among a set of ManagedClusters. - properties: - spreadConstraints: - description: SpreadConstraints defines how the placement decision - should be distributed among a set of ManagedClusters. The importance - of the SpreadConstraintsTerms follows the natural order of their - index in the slice. The scheduler first consider SpreadConstraintsTerms - with smaller index then those with larger index to distribute - the placement decision. - items: - description: SpreadConstraintsTerm defines a terminology to - spread placement decisions. - properties: - maxSkew: - default: 1 - description: MaxSkew represents the degree to which the - workload may be unevenly distributed. Skew is the maximum - difference between the number of selected ManagedClusters - in a topology and the global minimum. The global minimum - is the minimum number of selected ManagedClusters for - the topologies within the same TopologyKey. The minimum - possible value of MaxSkew is 1, and the default value - is 1. - format: int32 - minimum: 1 - type: integer - topologyKey: - description: TopologyKey is either a label key or a cluster - claim name of ManagedClusters. - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$ - type: string - topologyKeyType: - description: TopologyKeyType indicates the type of TopologyKey. - It could be Label or Claim. - enum: - - Label - - Claim - type: string - whenUnsatisfiable: - default: ScheduleAnyway - description: WhenUnsatisfiable represents the action of - the scheduler when MaxSkew cannot be satisfied. It could - be DoNotSchedule or ScheduleAnyway. The default value - is ScheduleAnyway. DoNotSchedule instructs the scheduler - not to schedule more ManagedClusters when MaxSkew is not - satisfied. ScheduleAnyway instructs the scheduler to keep - scheduling even if MaxSkew is not satisfied. - enum: - - DoNotSchedule - - ScheduleAnyway - type: string - required: - - topologyKey - - topologyKeyType - type: object - maxItems: 8 - type: array - type: object - tolerations: - description: Tolerations are applied to placements, and allow (but - do not require) the managed clusters with certain taints to be selected - by placements with matching tolerations. - items: - description: Toleration represents the toleration object that can - be attached to a placement. The placement this Toleration is attached - to tolerates any taint that matches the triple - using the matching operator . - properties: - effect: - description: Effect indicates the taint effect to match. Empty - means match all taint effects. When specified, allowed values - are NoSelect, PreferNoSelect and NoSelectIfNew. - enum: - - NoSelect - - PreferNoSelect - - NoSelectIfNew - type: string - key: - description: Key is the taint key that the toleration applies - to. Empty means match all taint keys. If the key is empty, - operator must be Exists; this combination means to match all - values and all keys. - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - operator: - default: Equal - description: Operator represents a key's relationship to the - value. Valid operators are Exists and Equal. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a placement - can tolerate all taints of a particular category. - type: string - tolerationSeconds: - description: TolerationSeconds represents the period of time - the toleration (which must be of effect NoSelect/PreferNoSelect, - otherwise this field is ignored) tolerates the taint. The - default value is nil, which indicates it tolerates the taint - forever. The start time of counting the TolerationSeconds - should be the TimeAdded in Taint, not the cluster scheduled - time or TolerationSeconds added time. - format: int64 - type: integer - value: - description: Value is the taint value the toleration matches - to. If the operator is Exists, the value should be empty, - otherwise just a regular string. - maxLength: 1024 - type: string - type: object - type: array - type: object - status: - description: Status represents the current status of the Placement - properties: - conditions: - description: Conditions contains the different condition status for - this Placement. - items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - \n type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: \"Available\", - \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge - // +listType=map // +listMapKey=type Conditions []metav1.Condition - `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" - properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - decisionGroups: - description: List of decision groups determined by the placement and - DecisionStrategy. - items: - description: Present decision groups status based on the DecisionStrategy - definition. - properties: - clusterCount: - default: 0 - description: Total number of clusters in the decision group. - Clusters count is equal or less than the clusterPerDecisionGroups - defined in the decision strategy. - format: int32 - type: integer - decisionGroupIndex: - description: Present the decision group index. If there is no - decision strategy defined all placement decisions will be - in group index 0 - format: int32 - type: integer - decisionGroupName: - description: Decision group name that is defined in the DecisionStrategy's - DecisionGroup. - type: string - decisions: - description: List of placement decisions names associated with - the decision group - items: - type: string - type: array - type: object - type: array - numberOfSelectedClusters: - description: NumberOfSelectedClusters represents the number of selected - ManagedClusters - format: int32 - type: integer - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_03_clusters.open-cluster-management.io_placementdecisions.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_03_clusters.open-cluster-management.io_placementdecisions.crd.yaml deleted file mode 100644 index dd5bb7a29..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_03_clusters.open-cluster-management.io_placementdecisions.crd.yaml +++ /dev/null @@ -1,76 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: placementdecisions.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: PlacementDecision - listKind: PlacementDecisionList - plural: placementdecisions - singular: placementdecision - preserveUnknownFields: false - scope: Namespaced - versions: - - name: v1beta1 - schema: - openAPIV3Schema: - description: "PlacementDecision indicates a decision from a placement PlacementDecision - should has a label cluster.open-cluster-management.io/placement={placement - name} to reference a certain placement. \n If a placement has spec.numberOfClusters - specified, the total number of decisions contained in status.decisions of - PlacementDecisions should always be NumberOfClusters; otherwise, the total - number of decisions should be the number of ManagedClusters which match - the placement requirements. \n Some of the decisions might be empty when - there are no enough ManagedClusters meet the placement requirements." - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - status: - description: Status represents the current status of the PlacementDecision - properties: - decisions: - description: Decisions is a slice of decisions according to a placement - The number of decisions should not be larger than 100 - items: - description: ClusterDecision represents a decision from a placement - An empty ClusterDecision indicates it is not scheduled yet. - properties: - clusterName: - description: ClusterName is the name of the ManagedCluster. - If it is not empty, its value should be unique cross all placement - decisions for the Placement. - type: string - reason: - description: Reason represents the reason why the ManagedCluster - is selected. - type: string - required: - - clusterName - - reason - type: object - type: array - required: - - decisions - type: object - type: object - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/doc.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/doc.go deleted file mode 100644 index 16e016287..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package v1beta1 contains API Schema definitions for the cluster v1beta1 API group -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=open-cluster-management.io/api/cluster -// +k8s:defaulter-gen=TypeMeta -// +k8s:openapi-gen=true - -// +kubebuilder:validation:Optional -// +groupName=cluster.open-cluster-management.io -package v1beta1 diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/helpers.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/helpers.go deleted file mode 100644 index 503dbc7b6..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/helpers.go +++ /dev/null @@ -1,274 +0,0 @@ -package v1beta1 - -import ( - "fmt" - "sort" - "strconv" - "sync" - - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/util/sets" -) - -type PlacementDecisionGetter interface { - List(selector labels.Selector, namespace string) (ret []*PlacementDecision, err error) -} - -// +k8s:deepcopy-gen=false -type PlacementDecisionClustersTracker struct { - placement *Placement - placementDecisionGetter PlacementDecisionGetter - existingScheduledClusterGroups ClusterGroupsMap - clusterGroupsIndexToName map[int32]string - clusterGroupsNameToIndex map[string][]int32 - lock sync.RWMutex -} - -// +k8s:deepcopy-gen=false -type GroupKey struct { - GroupName string `json:"groupName,omitempty"` - GroupIndex int32 `json:"groupIndex,omitempty"` -} - -// NewPlacementDecisionClustersTracker initializes a PlacementDecisionClustersTracker -// using existing clusters. Clusters are added to the default cluster group with index 0. -// Set existingScheduledClusters to nil if there are no existing clusters. -func NewPlacementDecisionClustersTracker(placement *Placement, pdl PlacementDecisionGetter, existingScheduledClusters sets.Set[string]) *PlacementDecisionClustersTracker { - pdct := &PlacementDecisionClustersTracker{ - placement: placement, - placementDecisionGetter: pdl, - existingScheduledClusterGroups: ClusterGroupsMap{{GroupIndex: 0}: existingScheduledClusters}, - } - - // Generate group name indices for the tracker. - pdct.generateGroupsNameIndex() - return pdct -} - -// NewPlacementDecisionClustersTrackerWithGroups initializes a PlacementDecisionClustersTracker -// using existing cluster groups. Set existingScheduledClusterGroups to nil if no groups exist. -func NewPlacementDecisionClustersTrackerWithGroups(placement *Placement, pdl PlacementDecisionGetter, existingScheduledClusterGroups ClusterGroupsMap) *PlacementDecisionClustersTracker { - pdct := &PlacementDecisionClustersTracker{ - placement: placement, - placementDecisionGetter: pdl, - existingScheduledClusterGroups: existingScheduledClusterGroups, - } - - // Generate group name indices for the tracker. - pdct.generateGroupsNameIndex() - return pdct -} - -// Refresh refreshes the tracker's decisionClusters. -func (pdct *PlacementDecisionClustersTracker) Refresh() error { - pdct.lock.Lock() - defer pdct.lock.Unlock() - - if pdct.placement == nil || pdct.placementDecisionGetter == nil { - return nil - } - - // Get the generated PlacementDecisions - decisionSelector := labels.SelectorFromSet(labels.Set{ - PlacementLabel: pdct.placement.Name, - }) - decisions, err := pdct.placementDecisionGetter.List(decisionSelector, pdct.placement.Namespace) - if err != nil { - return fmt.Errorf("failed to list PlacementDecisions: %w", err) - } - - // Get the decision cluster names and groups - newScheduledClusterGroups := map[GroupKey]sets.Set[string]{} - for _, d := range decisions { - groupKey, err := parseGroupKeyFromDecision(d) - if err != nil { - return err - } - - if _, exist := newScheduledClusterGroups[groupKey]; !exist { - newScheduledClusterGroups[groupKey] = sets.New[string]() - } - - for _, sd := range d.Status.Decisions { - newScheduledClusterGroups[groupKey].Insert(sd.ClusterName) - } - } - - // Update the existing decision cluster groups - pdct.existingScheduledClusterGroups = newScheduledClusterGroups - pdct.generateGroupsNameIndex() - - return nil -} - -// GetClusterChanges updates the tracker's decisionClusters and returns added and deleted cluster names. -func (pdct *PlacementDecisionClustersTracker) GetClusterChanges() (sets.Set[string], sets.Set[string], error) { - // Get existing clusters - existingScheduledClusters := pdct.existingScheduledClusterGroups.GetClusters() - - // Refresh clusters - err := pdct.Refresh() - if err != nil { - return nil, nil, err - } - newScheduledClusters := pdct.existingScheduledClusterGroups.GetClusters() - - // Compare the difference - added := newScheduledClusters.Difference(existingScheduledClusters) - deleted := existingScheduledClusters.Difference(newScheduledClusters) - - return added, deleted, nil -} - -func (pdct *PlacementDecisionClustersTracker) generateGroupsNameIndex() { - pdct.clusterGroupsIndexToName = map[int32]string{} - pdct.clusterGroupsNameToIndex = map[string][]int32{} - - for groupkey := range pdct.existingScheduledClusterGroups { - // index to name - pdct.clusterGroupsIndexToName[groupkey.GroupIndex] = groupkey.GroupName - // name to index - if index, exist := pdct.clusterGroupsNameToIndex[groupkey.GroupName]; exist { - pdct.clusterGroupsNameToIndex[groupkey.GroupName] = append(index, groupkey.GroupIndex) - } else { - pdct.clusterGroupsNameToIndex[groupkey.GroupName] = []int32{groupkey.GroupIndex} - } - } - - // sort index order - for _, index := range pdct.clusterGroupsNameToIndex { - sort.Slice(index, func(i, j int) bool { - return index[i] < index[j] - }) - } -} - -// ExistingClusterGroups returns the tracker's existing decision cluster groups for groups listed in groupKeys. -// Return empty set when groupKeys is empty. -func (pdct *PlacementDecisionClustersTracker) ExistingClusterGroups(groupKeys ...GroupKey) ClusterGroupsMap { - pdct.lock.RLock() - defer pdct.lock.RUnlock() - - resultClusterGroups := make(map[GroupKey]sets.Set[string]) - - includeGroupKeys := pdct.fulfillGroupKeys(groupKeys) - for _, groupKey := range includeGroupKeys { - if clusters, found := pdct.existingScheduledClusterGroups[groupKey]; found { - resultClusterGroups[groupKey] = clusters - } - } - - return resultClusterGroups -} - -// ExistingClusterGroupsBesides returns the tracker's existing decision cluster groups except cluster groups listed in groupKeys. -// Return all the clusters when groupKeys is empty. -func (pdct *PlacementDecisionClustersTracker) ExistingClusterGroupsBesides(groupKeys ...GroupKey) ClusterGroupsMap { - pdct.lock.RLock() - defer pdct.lock.RUnlock() - - resultClusterGroups := make(map[GroupKey]sets.Set[string]) - - excludeGroupKeys := pdct.fulfillGroupKeys(groupKeys) - includeGroupKeys := pdct.getGroupKeysBesides(excludeGroupKeys) - for _, groupKey := range includeGroupKeys { - if clusters, found := pdct.existingScheduledClusterGroups[groupKey]; found { - resultClusterGroups[groupKey] = clusters - } - } - - return resultClusterGroups -} - -// Fulfill the expect groupkeys with group name or group index, the returned groupkeys are ordered by input group name then group index. -// For example, the input is []GroupKey{{GroupName: "group1"}, {GroupIndex: 2}}, -// the returned is []GroupKey{{GroupName: "group1", GroupIndex: 0}, {GroupName: "group1", GroupIndex: 1}, {GroupName: "group2", GroupIndex: 2}} -func (pdct *PlacementDecisionClustersTracker) fulfillGroupKeys(groupKeys []GroupKey) []GroupKey { - fulfilledGroupKeys := []GroupKey{} - for _, gk := range groupKeys { - if gk.GroupName != "" { - if indexes, exist := pdct.clusterGroupsNameToIndex[gk.GroupName]; exist { - for _, groupIndex := range indexes { - fulfilledGroupKeys = append(fulfilledGroupKeys, GroupKey{GroupName: gk.GroupName, GroupIndex: groupIndex}) - } - } - } else { - if groupName, exist := pdct.clusterGroupsIndexToName[gk.GroupIndex]; exist { - fulfilledGroupKeys = append(fulfilledGroupKeys, GroupKey{GroupName: groupName, GroupIndex: gk.GroupIndex}) - } - } - } - return fulfilledGroupKeys -} - -func (pdct *PlacementDecisionClustersTracker) getGroupKeysBesides(groupKeyToExclude []GroupKey) []GroupKey { - groupKey := []GroupKey{} - for i := 0; i < len(pdct.clusterGroupsIndexToName); i++ { - gKey := GroupKey{GroupName: pdct.clusterGroupsIndexToName[int32(i)], GroupIndex: int32(i)} - if !containsGroupKey(groupKeyToExclude, gKey) { - groupKey = append(groupKey, gKey) - } - } - - return groupKey -} - -// ClusterGroupsMap is a custom type representing a map of group keys to sets of cluster names. -type ClusterGroupsMap map[GroupKey]sets.Set[string] - -// GetOrderedGroupKeys returns an ordered slice of GroupKeys, sorted by group index. -func (g ClusterGroupsMap) GetOrderedGroupKeys() []GroupKey { - groupKeys := []GroupKey{} - for groupKey := range g { - groupKeys = append(groupKeys, groupKey) - } - - // sort by group index index - sort.Slice(groupKeys, func(i, j int) bool { - return groupKeys[i].GroupIndex < groupKeys[j].GroupIndex - }) - - return groupKeys -} - -// GetClusters returns a set containing all clusters from all group sets. -func (g ClusterGroupsMap) GetClusters() sets.Set[string] { - clusterSet := sets.New[string]() - for _, clusterGroup := range g { - clusterSet = clusterSet.Union(clusterGroup) - } - return clusterSet -} - -// ClusterToGroupKey returns a mapping of cluster names to their respective group keys. -func (g ClusterGroupsMap) ClusterToGroupKey() map[string]GroupKey { - clusterToGroupKey := map[string]GroupKey{} - - for groupKey, clusterGroup := range g { - for c := range clusterGroup { - clusterToGroupKey[c] = groupKey - } - } - - return clusterToGroupKey -} - -// Helper function to check if a groupKey is present in the groupKeys slice. -func containsGroupKey(groupKeys []GroupKey, groupKey GroupKey) bool { - for _, gk := range groupKeys { - if gk == groupKey { - return true - } - } - return false -} - -func parseGroupKeyFromDecision(d *PlacementDecision) (GroupKey, error) { - groupName := d.Labels[DecisionGroupNameLabel] - groupIndex := d.Labels[DecisionGroupIndexLabel] - groupIndexNum, err := strconv.Atoi(groupIndex) - if err != nil { - return GroupKey{}, fmt.Errorf("incorrect group index: %w", err) - } - return GroupKey{GroupName: groupName, GroupIndex: int32(groupIndexNum)}, nil -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/register.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/register.go deleted file mode 100644 index 0f9156d26..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/register.go +++ /dev/null @@ -1,40 +0,0 @@ -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -var ( - GroupName = "cluster.open-cluster-management.io" - GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} - schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // Install is a function which adds this version to a scheme - Install = schemeBuilder.AddToScheme - - // SchemeGroupVersion generated code relies on this name - // Deprecated - SchemeGroupVersion = GroupVersion - // AddToScheme exists solely to keep the old generators creating valid code - // DEPRECATED - AddToScheme = schemeBuilder.AddToScheme -) - -// Resource generated code relies on this being here, but it logically belongs to the group -// DEPRECATED -func Resource(resource string) schema.GroupResource { - return schema.GroupResource{Group: GroupName, Resource: resource} -} - -// Adds the list of known types to api.Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(GroupVersion, - &Placement{}, - &PlacementList{}, - &PlacementDecision{}, - &PlacementDecisionList{}, - ) - metav1.AddToGroupVersion(scheme, GroupVersion) - return nil -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go deleted file mode 100644 index 9065b597b..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go +++ /dev/null @@ -1,449 +0,0 @@ -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" - v1 "open-cluster-management.io/api/cluster/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope="Namespaced" -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Succeeded",type="string",JSONPath=".status.conditions[?(@.type==\"PlacementSatisfied\")].status" -// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type==\"PlacementSatisfied\")].reason" -// +kubebuilder:printcolumn:name="SelectedClusters",type="integer",JSONPath=".status.numberOfSelectedClusters" - -// Placement defines a rule to select a set of ManagedClusters from the ManagedClusterSets bound -// to the placement namespace. -// -// Here is how the placement policy combines with other selection methods to determine a matching -// list of ManagedClusters: -// 1. Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters; -// 2. ManagedClusters are organized into cluster-scoped ManagedClusterSets; -// 3. ManagedClusterSets are bound to workload namespaces; -// 4. Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set -// of potential ManagedClusters; -// 5. Then Placements subselect from that working set using label/claim selection. -// -// No ManagedCluster will be selected if no ManagedClusterSet is bound to the placement -// namespace. User is able to bind a ManagedClusterSet to a namespace by creating a -// ManagedClusterSetBinding in that namespace if they have a RBAC rule to CREATE on the virtual -// subresource of `managedclustersets/bind`. -// -// A slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement name} -// will be created to represent the ManagedClusters selected by this placement. -// -// If a ManagedCluster is selected and added into the PlacementDecisions, other components may -// apply workload on it; once it is removed from the PlacementDecisions, the workload applied on -// this ManagedCluster should be evicted accordingly. -type Placement struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the attributes of Placement. - // +kubebuilder:validation:Required - // +required - Spec PlacementSpec `json:"spec"` - - // Status represents the current status of the Placement - // +optional - Status PlacementStatus `json:"status,omitempty"` -} - -// PlacementSpec defines the attributes of Placement. -// An empty PlacementSpec selects all ManagedClusters from the ManagedClusterSets bound to -// the placement namespace. The containing fields are ANDed. -type PlacementSpec struct { - // ClusterSets represent the ManagedClusterSets from which the ManagedClusters are selected. - // If the slice is empty, ManagedClusters will be selected from the ManagedClusterSets bound to the placement - // namespace, otherwise ManagedClusters will be selected from the intersection of this slice and the - // ManagedClusterSets bound to the placement namespace. - // +optional - ClusterSets []string `json:"clusterSets,omitempty"` - - // NumberOfClusters represents the desired number of ManagedClusters to be selected which meet the - // placement requirements. - // 1) If not specified, all ManagedClusters which meet the placement requirements (including ClusterSets, - // and Predicates) will be selected; - // 2) Otherwise if the nubmer of ManagedClusters meet the placement requirements is larger than - // NumberOfClusters, a random subset with desired number of ManagedClusters will be selected; - // 3) If the nubmer of ManagedClusters meet the placement requirements is equal to NumberOfClusters, - // all of them will be selected; - // 4) If the nubmer of ManagedClusters meet the placement requirements is less than NumberOfClusters, - // all of them will be selected, and the status of condition `PlacementConditionSatisfied` will be - // set to false; - // +optional - NumberOfClusters *int32 `json:"numberOfClusters,omitempty"` - - // Predicates represent a slice of predicates to select ManagedClusters. The predicates are ORed. - // +optional - Predicates []ClusterPredicate `json:"predicates,omitempty"` - - // PrioritizerPolicy defines the policy of the prioritizers. - // If this field is unset, then default prioritizer mode and configurations are used. - // Referring to PrioritizerPolicy to see more description about Mode and Configurations. - // +optional - PrioritizerPolicy PrioritizerPolicy `json:"prioritizerPolicy"` - - // SpreadPolicy defines how placement decisions should be distributed among a - // set of ManagedClusters. - // +optional - SpreadPolicy SpreadPolicy `json:"spreadPolicy,omitempty"` - - // Tolerations are applied to placements, and allow (but do not require) the managed clusters with - // certain taints to be selected by placements with matching tolerations. - // +optional - Tolerations []Toleration `json:"tolerations,omitempty"` - - // DecisionStrategy divide the created placement decision to groups and define number of clusters per decision group. - // +optional - DecisionStrategy DecisionStrategy `json:"decisionStrategy,omitempty"` -} - -// DecisionGroup define a subset of clusters that will be added to placementDecisions with groupName label. -type DecisionGroup struct { - // Group name to be added as label value to the created placement Decisions labels with label key cluster.open-cluster-management.io/decision-group-name - // +kubebuilder:validation:Required - // +kubebuilder:validation:Pattern="^[a-zA-Z0-9][-A-Za-z0-9_.]{0,61}[a-zA-Z0-9]$" - // +required - GroupName string `json:"groupName,omitempty"` - - // LabelSelector to select clusters subset by label. - // +kubebuilder:validation:Required - // +required - ClusterSelector ClusterSelector `json:"groupClusterSelector,omitempty"` -} - -// Group the created placementDecision into decision groups based on the number of clusters per decision group. -type GroupStrategy struct { - // DecisionGroups represents a list of predefined groups to put decision results. - // Decision groups will be constructed based on the DecisionGroups field at first. The clusters not included in the - // DecisionGroups will be divided to other decision groups afterwards. Each decision group should not have the number - // of clusters larger than the ClustersPerDecisionGroup. - // +optional - DecisionGroups []DecisionGroup `json:"decisionGroups,omitempty"` - - // ClustersPerDecisionGroup is a specific number or percentage of the total selected clusters. - // The specific number will divide the placementDecisions to decisionGroups each group has max number of clusters - // equal to that specific number. - // The percentage will divide the placementDecisions to decisionGroups each group has max number of clusters based - // on the total num of selected clusters and percentage. - // ex; for a total 100 clusters selected, ClustersPerDecisionGroup equal to 20% will divide the placement decision - // to 5 groups each group should have 20 clusters. - // Default is having all clusters in a single group. - // - // The predefined decisionGroups is expected to be a subset of the selected clusters and the number of items in each - // group SHOULD be less than ClustersPerDecisionGroup. Once the number of items exceeds the ClustersPerDecisionGroup, - // the decisionGroups will also be be divided into multiple decisionGroups with same GroupName but different GroupIndex. - // - // +kubebuilder:validation:XIntOrString - // +kubebuilder:validation:Pattern=`^((100|[1-9][0-9]{0,1})%|[1-9][0-9]*)$` - // +kubebuilder:default:="100%" - // +optional - ClustersPerDecisionGroup intstr.IntOrString `json:"clustersPerDecisionGroup,omitempty"` -} - -// DecisionStrategy divide the created placement decision to groups and define number of clusters per decision group. -type DecisionStrategy struct { - // GroupStrategy define strategies to divide selected clusters to decision groups. - // +optional - GroupStrategy GroupStrategy `json:"groupStrategy,omitempty"` -} - -// ClusterPredicate represents a predicate to select ManagedClusters. -type ClusterPredicate struct { - // RequiredClusterSelector represents a selector of ManagedClusters by label and claim. If specified, - // 1) Any ManagedCluster, which does not match the selector, should not be selected by this ClusterPredicate; - // 2) If a selected ManagedCluster (of this ClusterPredicate) ceases to match the selector (e.g. due to - // an update) of any ClusterPredicate, it will be eventually removed from the placement decisions; - // 3) If a ManagedCluster (not selected previously) starts to match the selector, it will either - // be selected or at least has a chance to be selected (when NumberOfClusters is specified); - // +optional - RequiredClusterSelector ClusterSelector `json:"requiredClusterSelector,omitempty"` -} - -// ClusterSelector represents the AND of the containing selectors. An empty cluster selector matches all objects. -// A null cluster selector matches no objects. -type ClusterSelector struct { - // LabelSelector represents a selector of ManagedClusters by label - // +optional - LabelSelector metav1.LabelSelector `json:"labelSelector,omitempty"` - - // ClaimSelector represents a selector of ManagedClusters by clusterClaims in status - // +optional - ClaimSelector ClusterClaimSelector `json:"claimSelector,omitempty"` -} - -// ClusterClaimSelector is a claim query over a set of ManagedClusters. An empty cluster claim -// selector matches all objects. A null cluster claim selector matches no objects. -type ClusterClaimSelector struct { - // matchExpressions is a list of cluster claim selector requirements. The requirements are ANDed. - // +optional - MatchExpressions []metav1.LabelSelectorRequirement `json:"matchExpressions,omitempty"` -} - -// PrioritizerPolicy represents the policy of prioritizer -type PrioritizerPolicy struct { - // Mode is either Exact, Additive, "" where "" is Additive by default. - // In Additive mode, any prioritizer not explicitly enumerated is enabled in its default Configurations, - // in which Steady and Balance prioritizers have the weight of 1 while other prioritizers have the weight of 0. - // Additive doesn't require configuring all prioritizers. The default Configurations may change in the future, - // and additional prioritization will happen. - // In Exact mode, any prioritizer not explicitly enumerated is weighted as zero. - // Exact requires knowing the full set of prioritizers you want, but avoids behavior changes between releases. - // +kubebuilder:default:=Additive - // +optional - Mode PrioritizerPolicyModeType `json:"mode,omitempty"` - - // +optional - Configurations []PrioritizerConfig `json:"configurations,omitempty"` -} - -// PrioritizerPolicyModeType represents the type of PrioritizerPolicy.Mode -type PrioritizerPolicyModeType string - -const ( - // Valid PrioritizerPolicyModeType value is Exact, Additive. - PrioritizerPolicyModeAdditive PrioritizerPolicyModeType = "Additive" - PrioritizerPolicyModeExact PrioritizerPolicyModeType = "Exact" -) - -// PrioritizerConfig represents the configuration of prioritizer -type PrioritizerConfig struct { - // ScoreCoordinate represents the configuration of the prioritizer and score source. - // +kubebuilder:validation:Required - // +required - ScoreCoordinate *ScoreCoordinate `json:"scoreCoordinate,omitempty"` - - // Weight defines the weight of the prioritizer score. The value must be ranged in [-10,10]. - // Each prioritizer will calculate an integer score of a cluster in the range of [-100, 100]. - // The final score of a cluster will be sum(weight * prioritizer_score). - // A higher weight indicates that the prioritizer weights more in the cluster selection, - // while 0 weight indicates that the prioritizer is disabled. A negative weight indicates - // wants to select the last ones. - // +kubebuilder:validation:Minimum:=-10 - // +kubebuilder:validation:Maximum:=10 - // +kubebuilder:default:=1 - // +optional - Weight int32 `json:"weight,omitempty"` -} - -// ScoreCoordinate represents the configuration of the score type and score source -type ScoreCoordinate struct { - // Type defines the type of the prioritizer score. - // Type is either "BuiltIn", "AddOn" or "", where "" is "BuiltIn" by default. - // When the type is "BuiltIn", need to specify a BuiltIn prioritizer name in BuiltIn. - // When the type is "AddOn", need to configure the score source in AddOn. - // +kubebuilder:validation:Required - // +kubebuilder:validation:Enum=BuiltIn;AddOn - // +kubebuilder:default:=BuiltIn - // +required - Type string `json:"type,omitempty"` - - // BuiltIn defines the name of a BuiltIn prioritizer. Below are the valid BuiltIn prioritizer names. - // 1) Balance: balance the decisions among the clusters. - // 2) Steady: ensure the existing decision is stabilized. - // 3) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable. - // 4) Spread: spread the workload evenly to topologies. - // +optional - BuiltIn string `json:"builtIn,omitempty"` - - // When type is "AddOn", AddOn defines the resource name and score name. - // +optional - AddOn *AddOnScore `json:"addOn,omitempty"` -} - -const ( - // Valid ScoreCoordinate type is BuiltIn, AddOn. - ScoreCoordinateTypeBuiltIn string = "BuiltIn" - ScoreCoordinateTypeAddOn string = "AddOn" -) - -// AddOnScore represents the configuration of the addon score source. -type AddOnScore struct { - // ResourceName defines the resource name of the AddOnPlacementScore. - // The placement prioritizer selects AddOnPlacementScore CR by this name. - // +kubebuilder:validation:Required - // +required - ResourceName string `json:"resourceName"` - - // ScoreName defines the score name inside AddOnPlacementScore. - // AddOnPlacementScore contains a list of score name and score value, ScoreName specify the score to be used by - // the prioritizer. - // +kubebuilder:validation:Required - // +required - ScoreName string `json:"scoreName"` -} - -// SpreadPolicy defines how the placement decision should be spread among the ManagedClusters. -type SpreadPolicy struct { - // SpreadConstraints defines how the placement decision should be distributed among a set of ManagedClusters. - // The importance of the SpreadConstraintsTerms follows the natural order of their index in the slice. - // The scheduler first consider SpreadConstraintsTerms with smaller index then those with larger index - // to distribute the placement decision. - // +optional - // +kubebuilder:validation:MaxItems=8 - SpreadConstraints []SpreadConstraintsTerm `json:"spreadConstraints,omitempty"` -} - -// SpreadConstraintsTerm defines a terminology to spread placement decisions. -type SpreadConstraintsTerm struct { - // TopologyKey is either a label key or a cluster claim name of ManagedClusters. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$` - // +kubebuilder:validation:MaxLength=316 - TopologyKey string `json:"topologyKey"` - - // TopologyKeyType indicates the type of TopologyKey. It could be Label or Claim. - // +required - // +kubebuilder:validation:Required - // +kubebuilder:validation:Enum=Label;Claim - TopologyKeyType TopologyKeyType `json:"topologyKeyType"` - - // MaxSkew represents the degree to which the workload may be unevenly distributed. - // Skew is the maximum difference between the number of selected ManagedClusters in a topology and the global minimum. - // The global minimum is the minimum number of selected ManagedClusters for the topologies within the same TopologyKey. - // The minimum possible value of MaxSkew is 1, and the default value is 1. - // +optional - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:default=1 - MaxSkew int32 `json:"maxSkew"` - - // WhenUnsatisfiable represents the action of the scheduler when MaxSkew cannot be satisfied. - // It could be DoNotSchedule or ScheduleAnyway. The default value is ScheduleAnyway. - // DoNotSchedule instructs the scheduler not to schedule more ManagedClusters when MaxSkew is not satisfied. - // ScheduleAnyway instructs the scheduler to keep scheduling even if MaxSkew is not satisfied. - // +optional - // +kubebuilder:validation:Enum=DoNotSchedule;ScheduleAnyway - // +kubebuilder:default=ScheduleAnyway - WhenUnsatisfiable UnsatisfiableMaxSkewAction `json:"whenUnsatisfiable"` -} - -// TopologyKeyType represents the type of TopologyKey. -type TopologyKeyType string - -const ( - // Valid TopologyKeyType value is Claim, Label. - TopologyKeyTypeClaim TopologyKeyType = "Claim" - TopologyKeyTypeLabel TopologyKeyType = "Label" -) - -// UnsatisfiableMaxSkewAction represents the action when MaxSkew cannot be satisfied. -type UnsatisfiableMaxSkewAction string - -const ( - // Valid UnsatisfiableMaxSkewAction value is DoNotSchedule, ScheduleAnyway. - DoNotSchedule UnsatisfiableMaxSkewAction = "DoNotSchedule" - ScheduleAnyway UnsatisfiableMaxSkewAction = "ScheduleAnyway" -) - -// Toleration represents the toleration object that can be attached to a placement. -// The placement this Toleration is attached to tolerates any taint that matches -// the triple using the matching operator . -type Toleration struct { - // Key is the taint key that the toleration applies to. Empty means match all taint keys. - // If the key is empty, operator must be Exists; this combination means to match all values and all keys. - // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` - // +kubebuilder:validation:MaxLength=316 - // +optional - Key string `json:"key,omitempty"` - // Operator represents a key's relationship to the value. - // Valid operators are Exists and Equal. Defaults to Equal. - // Exists is equivalent to wildcard for value, so that a placement can - // tolerate all taints of a particular category. - // +kubebuilder:default:="Equal" - // +optional - Operator TolerationOperator `json:"operator,omitempty"` - // Value is the taint value the toleration matches to. - // If the operator is Exists, the value should be empty, otherwise just a regular string. - // +kubebuilder:validation:MaxLength=1024 - // +optional - Value string `json:"value,omitempty"` - // Effect indicates the taint effect to match. Empty means match all taint effects. - // When specified, allowed values are NoSelect, PreferNoSelect and NoSelectIfNew. - // +kubebuilder:validation:Enum:=NoSelect;PreferNoSelect;NoSelectIfNew - // +optional - Effect v1.TaintEffect `json:"effect,omitempty"` - // TolerationSeconds represents the period of time the toleration (which must be of effect - // NoSelect/PreferNoSelect, otherwise this field is ignored) tolerates the taint. - // The default value is nil, which indicates it tolerates the taint forever. - // The start time of counting the TolerationSeconds should be the TimeAdded in Taint, not the cluster - // scheduled time or TolerationSeconds added time. - // +optional - TolerationSeconds *int64 `json:"tolerationSeconds,omitempty"` -} - -// TolerationOperator is the set of operators that can be used in a toleration. -type TolerationOperator string - -// These are valid values for TolerationOperator -const ( - TolerationOpExists TolerationOperator = "Exists" - TolerationOpEqual TolerationOperator = "Equal" -) - -// Present decision groups status based on the DecisionStrategy definition. -type DecisionGroupStatus struct { - // Present the decision group index. If there is no decision strategy defined all placement decisions will be in group index 0 - // +optional - DecisionGroupIndex int32 `json:"decisionGroupIndex"` - - // Decision group name that is defined in the DecisionStrategy's DecisionGroup. - // +optional - DecisionGroupName string `json:"decisionGroupName"` - - // List of placement decisions names associated with the decision group - // +optional - Decisions []string `json:"decisions"` - - // Total number of clusters in the decision group. Clusters count is equal or less than the clusterPerDecisionGroups defined in the decision strategy. - // +kubebuilder:default:=0 - // +optional - ClustersCount int32 `json:"clusterCount"` -} - -type PlacementStatus struct { - // NumberOfSelectedClusters represents the number of selected ManagedClusters - // +optional - NumberOfSelectedClusters int32 `json:"numberOfSelectedClusters"` - - // List of decision groups determined by the placement and DecisionStrategy. - // +optional - DecisionGroups []DecisionGroupStatus `json:"decisionGroups"` - - // Conditions contains the different condition status for this Placement. - // +optional - Conditions []metav1.Condition `json:"conditions"` -} - -const ( - // PlacementConditionSatisfied means Placement requirements are satisfied. - // A placement is not satisfied only if there is empty ClusterDecision in the status.decisions - // of PlacementDecisions. - PlacementConditionSatisfied string = "PlacementSatisfied" - // PlacementConditionMisconfigured means Placement configuration is incorrect. - PlacementConditionMisconfigured string = "PlacementMisconfigured" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PlacementList is a collection of Placements. -type PlacementList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds - // +optional - metav1.ListMeta `json:"metadata,omitempty"` - - // Items is a list of Placements. - Items []Placement `json:"items"` -} - -const ( - // PlacementDisableAnnotation is used to disable scheduling for a placement. - // It is a experimental flag to let placement controller ignore this placement, - // so other placement consumers can chime in. - PlacementDisableAnnotation = "cluster.open-cluster-management.io/experimental-scheduling-disable" -) diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go deleted file mode 100644 index b32b11e9b..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go +++ /dev/null @@ -1,75 +0,0 @@ -package v1beta1 - -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:scope="Namespaced" -// +kubebuilder:subresource:status - -// PlacementDecision indicates a decision from a placement -// PlacementDecision should has a label cluster.open-cluster-management.io/placement={placement name} -// to reference a certain placement. -// -// If a placement has spec.numberOfClusters specified, the total number of decisions contained in -// status.decisions of PlacementDecisions should always be NumberOfClusters; otherwise, the total -// number of decisions should be the number of ManagedClusters which match the placement requirements. -// -// Some of the decisions might be empty when there are no enough ManagedClusters meet the placement -// requirements. -type PlacementDecision struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Status represents the current status of the PlacementDecision - // +optional - Status PlacementDecisionStatus `json:"status,omitempty"` -} - -// The placementDecsion labels -const ( - // Placement owner name. - PlacementLabel string = "cluster.open-cluster-management.io/placement" - // decision group index. - DecisionGroupIndexLabel string = "cluster.open-cluster-management.io/decision-group-index" - // decision group name. - DecisionGroupNameLabel string = "cluster.open-cluster-management.io/decision-group-name" -) - -// PlacementDecisionStatus represents the current status of the PlacementDecision. -type PlacementDecisionStatus struct { - // Decisions is a slice of decisions according to a placement - // The number of decisions should not be larger than 100 - // +kubebuilder:validation:Required - // +required - Decisions []ClusterDecision `json:"decisions"` -} - -// ClusterDecision represents a decision from a placement -// An empty ClusterDecision indicates it is not scheduled yet. -type ClusterDecision struct { - // ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all - // placement decisions for the Placement. - // +kubebuilder:validation:Required - // +required - ClusterName string `json:"clusterName"` - - // Reason represents the reason why the ManagedCluster is selected. - // +kubebuilder:validation:Required - // +required - Reason string `json:"reason"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ClusterDecisionList is a collection of PlacementDecision. -type PlacementDecisionList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds - // +optional - metav1.ListMeta `json:"metadata,omitempty"` - - // Items is a list of PlacementDecision. - Items []PlacementDecision `json:"items"` -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index 347b89457..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,551 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - sets "k8s.io/apimachinery/pkg/util/sets" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddOnScore) DeepCopyInto(out *AddOnScore) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnScore. -func (in *AddOnScore) DeepCopy() *AddOnScore { - if in == nil { - return nil - } - out := new(AddOnScore) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterClaimSelector) DeepCopyInto(out *ClusterClaimSelector) { - *out = *in - if in.MatchExpressions != nil { - in, out := &in.MatchExpressions, &out.MatchExpressions - *out = make([]v1.LabelSelectorRequirement, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClaimSelector. -func (in *ClusterClaimSelector) DeepCopy() *ClusterClaimSelector { - if in == nil { - return nil - } - out := new(ClusterClaimSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterDecision) DeepCopyInto(out *ClusterDecision) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterDecision. -func (in *ClusterDecision) DeepCopy() *ClusterDecision { - if in == nil { - return nil - } - out := new(ClusterDecision) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in ClusterGroupsMap) DeepCopyInto(out *ClusterGroupsMap) { - { - in := &in - *out = make(ClusterGroupsMap, len(*in)) - for key, val := range *in { - var outVal map[string]sets.Empty - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make(sets.Set[string], len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - (*out)[key] = outVal - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGroupsMap. -func (in ClusterGroupsMap) DeepCopy() ClusterGroupsMap { - if in == nil { - return nil - } - out := new(ClusterGroupsMap) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterPredicate) DeepCopyInto(out *ClusterPredicate) { - *out = *in - in.RequiredClusterSelector.DeepCopyInto(&out.RequiredClusterSelector) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPredicate. -func (in *ClusterPredicate) DeepCopy() *ClusterPredicate { - if in == nil { - return nil - } - out := new(ClusterPredicate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterSelector) DeepCopyInto(out *ClusterSelector) { - *out = *in - in.LabelSelector.DeepCopyInto(&out.LabelSelector) - in.ClaimSelector.DeepCopyInto(&out.ClaimSelector) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSelector. -func (in *ClusterSelector) DeepCopy() *ClusterSelector { - if in == nil { - return nil - } - out := new(ClusterSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DecisionGroup) DeepCopyInto(out *DecisionGroup) { - *out = *in - in.ClusterSelector.DeepCopyInto(&out.ClusterSelector) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DecisionGroup. -func (in *DecisionGroup) DeepCopy() *DecisionGroup { - if in == nil { - return nil - } - out := new(DecisionGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DecisionGroupStatus) DeepCopyInto(out *DecisionGroupStatus) { - *out = *in - if in.Decisions != nil { - in, out := &in.Decisions, &out.Decisions - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DecisionGroupStatus. -func (in *DecisionGroupStatus) DeepCopy() *DecisionGroupStatus { - if in == nil { - return nil - } - out := new(DecisionGroupStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DecisionStrategy) DeepCopyInto(out *DecisionStrategy) { - *out = *in - in.GroupStrategy.DeepCopyInto(&out.GroupStrategy) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DecisionStrategy. -func (in *DecisionStrategy) DeepCopy() *DecisionStrategy { - if in == nil { - return nil - } - out := new(DecisionStrategy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GroupStrategy) DeepCopyInto(out *GroupStrategy) { - *out = *in - if in.DecisionGroups != nil { - in, out := &in.DecisionGroups, &out.DecisionGroups - *out = make([]DecisionGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - out.ClustersPerDecisionGroup = in.ClustersPerDecisionGroup - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupStrategy. -func (in *GroupStrategy) DeepCopy() *GroupStrategy { - if in == nil { - return nil - } - out := new(GroupStrategy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Placement) DeepCopyInto(out *Placement) { - *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 Placement. -func (in *Placement) DeepCopy() *Placement { - if in == nil { - return nil - } - out := new(Placement) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Placement) 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 *PlacementDecision) DeepCopyInto(out *PlacementDecision) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementDecision. -func (in *PlacementDecision) DeepCopy() *PlacementDecision { - if in == nil { - return nil - } - out := new(PlacementDecision) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PlacementDecision) 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 *PlacementDecisionList) DeepCopyInto(out *PlacementDecisionList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PlacementDecision, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementDecisionList. -func (in *PlacementDecisionList) DeepCopy() *PlacementDecisionList { - if in == nil { - return nil - } - out := new(PlacementDecisionList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PlacementDecisionList) 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 *PlacementDecisionStatus) DeepCopyInto(out *PlacementDecisionStatus) { - *out = *in - if in.Decisions != nil { - in, out := &in.Decisions, &out.Decisions - *out = make([]ClusterDecision, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementDecisionStatus. -func (in *PlacementDecisionStatus) DeepCopy() *PlacementDecisionStatus { - if in == nil { - return nil - } - out := new(PlacementDecisionStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlacementList) DeepCopyInto(out *PlacementList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Placement, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementList. -func (in *PlacementList) DeepCopy() *PlacementList { - if in == nil { - return nil - } - out := new(PlacementList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PlacementList) 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 *PlacementSpec) DeepCopyInto(out *PlacementSpec) { - *out = *in - if in.ClusterSets != nil { - in, out := &in.ClusterSets, &out.ClusterSets - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.NumberOfClusters != nil { - in, out := &in.NumberOfClusters, &out.NumberOfClusters - *out = new(int32) - **out = **in - } - if in.Predicates != nil { - in, out := &in.Predicates, &out.Predicates - *out = make([]ClusterPredicate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.PrioritizerPolicy.DeepCopyInto(&out.PrioritizerPolicy) - in.SpreadPolicy.DeepCopyInto(&out.SpreadPolicy) - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = make([]Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.DecisionStrategy.DeepCopyInto(&out.DecisionStrategy) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementSpec. -func (in *PlacementSpec) DeepCopy() *PlacementSpec { - if in == nil { - return nil - } - out := new(PlacementSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlacementStatus) DeepCopyInto(out *PlacementStatus) { - *out = *in - if in.DecisionGroups != nil { - in, out := &in.DecisionGroups, &out.DecisionGroups - *out = make([]DecisionGroupStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementStatus. -func (in *PlacementStatus) DeepCopy() *PlacementStatus { - if in == nil { - return nil - } - out := new(PlacementStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrioritizerConfig) DeepCopyInto(out *PrioritizerConfig) { - *out = *in - if in.ScoreCoordinate != nil { - in, out := &in.ScoreCoordinate, &out.ScoreCoordinate - *out = new(ScoreCoordinate) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrioritizerConfig. -func (in *PrioritizerConfig) DeepCopy() *PrioritizerConfig { - if in == nil { - return nil - } - out := new(PrioritizerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrioritizerPolicy) DeepCopyInto(out *PrioritizerPolicy) { - *out = *in - if in.Configurations != nil { - in, out := &in.Configurations, &out.Configurations - *out = make([]PrioritizerConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrioritizerPolicy. -func (in *PrioritizerPolicy) DeepCopy() *PrioritizerPolicy { - if in == nil { - return nil - } - out := new(PrioritizerPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ScoreCoordinate) DeepCopyInto(out *ScoreCoordinate) { - *out = *in - if in.AddOn != nil { - in, out := &in.AddOn, &out.AddOn - *out = new(AddOnScore) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScoreCoordinate. -func (in *ScoreCoordinate) DeepCopy() *ScoreCoordinate { - if in == nil { - return nil - } - out := new(ScoreCoordinate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SpreadConstraintsTerm) DeepCopyInto(out *SpreadConstraintsTerm) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpreadConstraintsTerm. -func (in *SpreadConstraintsTerm) DeepCopy() *SpreadConstraintsTerm { - if in == nil { - return nil - } - out := new(SpreadConstraintsTerm) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SpreadPolicy) DeepCopyInto(out *SpreadPolicy) { - *out = *in - if in.SpreadConstraints != nil { - in, out := &in.SpreadConstraints, &out.SpreadConstraints - *out = make([]SpreadConstraintsTerm, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpreadPolicy. -func (in *SpreadPolicy) DeepCopy() *SpreadPolicy { - if in == nil { - return nil - } - out := new(SpreadPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Toleration) DeepCopyInto(out *Toleration) { - *out = *in - if in.TolerationSeconds != nil { - in, out := &in.TolerationSeconds, &out.TolerationSeconds - *out = new(int64) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Toleration. -func (in *Toleration) DeepCopy() *Toleration { - if in == nil { - return nil - } - out := new(Toleration) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go deleted file mode 100644 index bc134648b..000000000 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go +++ /dev/null @@ -1,240 +0,0 @@ -package v1beta1 - -// This file contains a collection of methods that can be used from go-restful to -// generate Swagger API documentation for its models. Please read this PR for more -// information on the implementation: https://github.com/emicklei/go-restful/pull/215 -// -// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if -// they are on one line! For multiple line or blocks that you want to ignore use ---. -// Any context after a --- is ignored. -// -// Those methods can be generated by using hack/update-swagger-docs.sh - -// AUTO-GENERATED FUNCTIONS START HERE -var map_AddOnScore = map[string]string{ - "": "AddOnScore represents the configuration of the addon score source.", - "resourceName": "ResourceName defines the resource name of the AddOnPlacementScore. The placement prioritizer selects AddOnPlacementScore CR by this name.", - "scoreName": "ScoreName defines the score name inside AddOnPlacementScore. AddOnPlacementScore contains a list of score name and score value, ScoreName specify the score to be used by the prioritizer.", -} - -func (AddOnScore) SwaggerDoc() map[string]string { - return map_AddOnScore -} - -var map_ClusterClaimSelector = map[string]string{ - "": "ClusterClaimSelector is a claim query over a set of ManagedClusters. An empty cluster claim selector matches all objects. A null cluster claim selector matches no objects.", - "matchExpressions": "matchExpressions is a list of cluster claim selector requirements. The requirements are ANDed.", -} - -func (ClusterClaimSelector) SwaggerDoc() map[string]string { - return map_ClusterClaimSelector -} - -var map_ClusterPredicate = map[string]string{ - "": "ClusterPredicate represents a predicate to select ManagedClusters.", - "requiredClusterSelector": "RequiredClusterSelector represents a selector of ManagedClusters by label and claim. If specified, 1) Any ManagedCluster, which does not match the selector, should not be selected by this ClusterPredicate; 2) If a selected ManagedCluster (of this ClusterPredicate) ceases to match the selector (e.g. due to\n an update) of any ClusterPredicate, it will be eventually removed from the placement decisions;\n3) If a ManagedCluster (not selected previously) starts to match the selector, it will either\n be selected or at least has a chance to be selected (when NumberOfClusters is specified);", -} - -func (ClusterPredicate) SwaggerDoc() map[string]string { - return map_ClusterPredicate -} - -var map_ClusterSelector = map[string]string{ - "": "ClusterSelector represents the AND of the containing selectors. An empty cluster selector matches all objects. A null cluster selector matches no objects.", - "labelSelector": "LabelSelector represents a selector of ManagedClusters by label", - "claimSelector": "ClaimSelector represents a selector of ManagedClusters by clusterClaims in status", -} - -func (ClusterSelector) SwaggerDoc() map[string]string { - return map_ClusterSelector -} - -var map_DecisionGroup = map[string]string{ - "": "DecisionGroup define a subset of clusters that will be added to placementDecisions with groupName label.", - "groupName": "Group name to be added as label value to the created placement Decisions labels with label key cluster.open-cluster-management.io/decision-group-name", - "groupClusterSelector": "LabelSelector to select clusters subset by label.", -} - -func (DecisionGroup) SwaggerDoc() map[string]string { - return map_DecisionGroup -} - -var map_DecisionGroupStatus = map[string]string{ - "": "Present decision groups status based on the DecisionStrategy definition.", - "decisionGroupIndex": "Present the decision group index. If there is no decision strategy defined all placement decisions will be in group index 0", - "decisionGroupName": "Decision group name that is defined in the DecisionStrategy's DecisionGroup.", - "decisions": "List of placement decisions names associated with the decision group", - "clusterCount": "Total number of clusters in the decision group. Clusters count is equal or less than the clusterPerDecisionGroups defined in the decision strategy.", -} - -func (DecisionGroupStatus) SwaggerDoc() map[string]string { - return map_DecisionGroupStatus -} - -var map_DecisionStrategy = map[string]string{ - "": "DecisionStrategy divide the created placement decision to groups and define number of clusters per decision group.", - "groupStrategy": "GroupStrategy define strategies to divide selected clusters to decision groups.", -} - -func (DecisionStrategy) SwaggerDoc() map[string]string { - return map_DecisionStrategy -} - -var map_GroupStrategy = map[string]string{ - "": "Group the created placementDecision into decision groups based on the number of clusters per decision group.", - "decisionGroups": "DecisionGroups represents a list of predefined groups to put decision results. Decision groups will be constructed based on the DecisionGroups field at first. The clusters not included in the DecisionGroups will be divided to other decision groups afterwards. Each decision group should not have the number of clusters larger than the ClustersPerDecisionGroup.", - "clustersPerDecisionGroup": "ClustersPerDecisionGroup is a specific number or percentage of the total selected clusters. The specific number will divide the placementDecisions to decisionGroups each group has max number of clusters equal to that specific number. The percentage will divide the placementDecisions to decisionGroups each group has max number of clusters based on the total num of selected clusters and percentage. ex; for a total 100 clusters selected, ClustersPerDecisionGroup equal to 20% will divide the placement decision to 5 groups each group should have 20 clusters. Default is having all clusters in a single group.\n\nThe predefined decisionGroups is expected to be a subset of the selected clusters and the number of items in each group SHOULD be less than ClustersPerDecisionGroup. Once the number of items exceeds the ClustersPerDecisionGroup, the decisionGroups will also be be divided into multiple decisionGroups with same GroupName but different GroupIndex.", -} - -func (GroupStrategy) SwaggerDoc() map[string]string { - return map_GroupStrategy -} - -var map_Placement = map[string]string{ - "": "Placement defines a rule to select a set of ManagedClusters from the ManagedClusterSets bound to the placement namespace.\n\nHere is how the placement policy combines with other selection methods to determine a matching list of ManagedClusters:\n 1. Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters;\n 2. ManagedClusters are organized into cluster-scoped ManagedClusterSets;\n 3. ManagedClusterSets are bound to workload namespaces;\n 4. Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set\n of potential ManagedClusters;\n 5. Then Placements subselect from that working set using label/claim selection.\n\nNo ManagedCluster will be selected if no ManagedClusterSet is bound to the placement namespace. User is able to bind a ManagedClusterSet to a namespace by creating a ManagedClusterSetBinding in that namespace if they have a RBAC rule to CREATE on the virtual subresource of `managedclustersets/bind`.\n\nA slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement name} will be created to represent the ManagedClusters selected by this placement.\n\nIf a ManagedCluster is selected and added into the PlacementDecisions, other components may apply workload on it; once it is removed from the PlacementDecisions, the workload applied on this ManagedCluster should be evicted accordingly.", - "spec": "Spec defines the attributes of Placement.", - "status": "Status represents the current status of the Placement", -} - -func (Placement) SwaggerDoc() map[string]string { - return map_Placement -} - -var map_PlacementList = map[string]string{ - "": "PlacementList is a collection of Placements.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", - "items": "Items is a list of Placements.", -} - -func (PlacementList) SwaggerDoc() map[string]string { - return map_PlacementList -} - -var map_PlacementSpec = map[string]string{ - "": "PlacementSpec defines the attributes of Placement. An empty PlacementSpec selects all ManagedClusters from the ManagedClusterSets bound to the placement namespace. The containing fields are ANDed.", - "clusterSets": "ClusterSets represent the ManagedClusterSets from which the ManagedClusters are selected. If the slice is empty, ManagedClusters will be selected from the ManagedClusterSets bound to the placement namespace, otherwise ManagedClusters will be selected from the intersection of this slice and the ManagedClusterSets bound to the placement namespace.", - "numberOfClusters": "NumberOfClusters represents the desired number of ManagedClusters to be selected which meet the placement requirements. 1) If not specified, all ManagedClusters which meet the placement requirements (including ClusterSets,\n and Predicates) will be selected;\n2) Otherwise if the nubmer of ManagedClusters meet the placement requirements is larger than\n NumberOfClusters, a random subset with desired number of ManagedClusters will be selected;\n3) If the nubmer of ManagedClusters meet the placement requirements is equal to NumberOfClusters,\n all of them will be selected;\n4) If the nubmer of ManagedClusters meet the placement requirements is less than NumberOfClusters,\n all of them will be selected, and the status of condition `PlacementConditionSatisfied` will be\n set to false;", - "predicates": "Predicates represent a slice of predicates to select ManagedClusters. The predicates are ORed.", - "prioritizerPolicy": "PrioritizerPolicy defines the policy of the prioritizers. If this field is unset, then default prioritizer mode and configurations are used. Referring to PrioritizerPolicy to see more description about Mode and Configurations.", - "spreadPolicy": "SpreadPolicy defines how placement decisions should be distributed among a set of ManagedClusters.", - "tolerations": "Tolerations are applied to placements, and allow (but do not require) the managed clusters with certain taints to be selected by placements with matching tolerations.", - "decisionStrategy": "DecisionStrategy divide the created placement decision to groups and define number of clusters per decision group.", -} - -func (PlacementSpec) SwaggerDoc() map[string]string { - return map_PlacementSpec -} - -var map_PlacementStatus = map[string]string{ - "numberOfSelectedClusters": "NumberOfSelectedClusters represents the number of selected ManagedClusters", - "decisionGroups": "List of decision groups determined by the placement and DecisionStrategy.", - "conditions": "Conditions contains the different condition status for this Placement.", -} - -func (PlacementStatus) SwaggerDoc() map[string]string { - return map_PlacementStatus -} - -var map_PrioritizerConfig = map[string]string{ - "": "PrioritizerConfig represents the configuration of prioritizer", - "scoreCoordinate": "ScoreCoordinate represents the configuration of the prioritizer and score source.", - "weight": "Weight defines the weight of the prioritizer score. The value must be ranged in [-10,10]. Each prioritizer will calculate an integer score of a cluster in the range of [-100, 100]. The final score of a cluster will be sum(weight * prioritizer_score). A higher weight indicates that the prioritizer weights more in the cluster selection, while 0 weight indicates that the prioritizer is disabled. A negative weight indicates wants to select the last ones.", -} - -func (PrioritizerConfig) SwaggerDoc() map[string]string { - return map_PrioritizerConfig -} - -var map_PrioritizerPolicy = map[string]string{ - "": "PrioritizerPolicy represents the policy of prioritizer", - "mode": "Mode is either Exact, Additive, \"\" where \"\" is Additive by default. In Additive mode, any prioritizer not explicitly enumerated is enabled in its default Configurations, in which Steady and Balance prioritizers have the weight of 1 while other prioritizers have the weight of 0. Additive doesn't require configuring all prioritizers. The default Configurations may change in the future, and additional prioritization will happen. In Exact mode, any prioritizer not explicitly enumerated is weighted as zero. Exact requires knowing the full set of prioritizers you want, but avoids behavior changes between releases.", -} - -func (PrioritizerPolicy) SwaggerDoc() map[string]string { - return map_PrioritizerPolicy -} - -var map_ScoreCoordinate = map[string]string{ - "": "ScoreCoordinate represents the configuration of the score type and score source", - "type": "Type defines the type of the prioritizer score. Type is either \"BuiltIn\", \"AddOn\" or \"\", where \"\" is \"BuiltIn\" by default. When the type is \"BuiltIn\", need to specify a BuiltIn prioritizer name in BuiltIn. When the type is \"AddOn\", need to configure the score source in AddOn.", - "builtIn": "BuiltIn defines the name of a BuiltIn prioritizer. Below are the valid BuiltIn prioritizer names. 1) Balance: balance the decisions among the clusters. 2) Steady: ensure the existing decision is stabilized. 3) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable. 4) Spread: spread the workload evenly to topologies.", - "addOn": "When type is \"AddOn\", AddOn defines the resource name and score name.", -} - -func (ScoreCoordinate) SwaggerDoc() map[string]string { - return map_ScoreCoordinate -} - -var map_SpreadConstraintsTerm = map[string]string{ - "": "SpreadConstraintsTerm defines a terminology to spread placement decisions.", - "topologyKey": "TopologyKey is either a label key or a cluster claim name of ManagedClusters.", - "topologyKeyType": "TopologyKeyType indicates the type of TopologyKey. It could be Label or Claim.", - "maxSkew": "MaxSkew represents the degree to which the workload may be unevenly distributed. Skew is the maximum difference between the number of selected ManagedClusters in a topology and the global minimum. The global minimum is the minimum number of selected ManagedClusters for the topologies within the same TopologyKey. The minimum possible value of MaxSkew is 1, and the default value is 1.", - "whenUnsatisfiable": "WhenUnsatisfiable represents the action of the scheduler when MaxSkew cannot be satisfied. It could be DoNotSchedule or ScheduleAnyway. The default value is ScheduleAnyway. DoNotSchedule instructs the scheduler not to schedule more ManagedClusters when MaxSkew is not satisfied. ScheduleAnyway instructs the scheduler to keep scheduling even if MaxSkew is not satisfied.", -} - -func (SpreadConstraintsTerm) SwaggerDoc() map[string]string { - return map_SpreadConstraintsTerm -} - -var map_SpreadPolicy = map[string]string{ - "": "SpreadPolicy defines how the placement decision should be spread among the ManagedClusters.", - "spreadConstraints": "SpreadConstraints defines how the placement decision should be distributed among a set of ManagedClusters. The importance of the SpreadConstraintsTerms follows the natural order of their index in the slice. The scheduler first consider SpreadConstraintsTerms with smaller index then those with larger index to distribute the placement decision.", -} - -func (SpreadPolicy) SwaggerDoc() map[string]string { - return map_SpreadPolicy -} - -var map_Toleration = map[string]string{ - "": "Toleration represents the toleration object that can be attached to a placement. The placement this Toleration is attached to tolerates any taint that matches the triple using the matching operator .", - "key": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.", - "operator": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a placement can tolerate all taints of a particular category.", - "value": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.", - "effect": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSelect, PreferNoSelect and NoSelectIfNew.", - "tolerationSeconds": "TolerationSeconds represents the period of time the toleration (which must be of effect NoSelect/PreferNoSelect, otherwise this field is ignored) tolerates the taint. The default value is nil, which indicates it tolerates the taint forever. The start time of counting the TolerationSeconds should be the TimeAdded in Taint, not the cluster scheduled time or TolerationSeconds added time.", -} - -func (Toleration) SwaggerDoc() map[string]string { - return map_Toleration -} - -var map_ClusterDecision = map[string]string{ - "": "ClusterDecision represents a decision from a placement An empty ClusterDecision indicates it is not scheduled yet.", - "clusterName": "ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all placement decisions for the Placement.", - "reason": "Reason represents the reason why the ManagedCluster is selected.", -} - -func (ClusterDecision) SwaggerDoc() map[string]string { - return map_ClusterDecision -} - -var map_PlacementDecision = map[string]string{ - "": "PlacementDecision indicates a decision from a placement PlacementDecision should has a label cluster.open-cluster-management.io/placement={placement name} to reference a certain placement.\n\nIf a placement has spec.numberOfClusters specified, the total number of decisions contained in status.decisions of PlacementDecisions should always be NumberOfClusters; otherwise, the total number of decisions should be the number of ManagedClusters which match the placement requirements.\n\nSome of the decisions might be empty when there are no enough ManagedClusters meet the placement requirements.", - "status": "Status represents the current status of the PlacementDecision", -} - -func (PlacementDecision) SwaggerDoc() map[string]string { - return map_PlacementDecision -} - -var map_PlacementDecisionList = map[string]string{ - "": "ClusterDecisionList is a collection of PlacementDecision.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds", - "items": "Items is a list of PlacementDecision.", -} - -func (PlacementDecisionList) SwaggerDoc() map[string]string { - return map_PlacementDecisionList -} - -var map_PlacementDecisionStatus = map[string]string{ - "": "PlacementDecisionStatus represents the current status of the PlacementDecision.", - "decisions": "Decisions is a slice of decisions according to a placement The number of decisions should not be larger than 100", -} - -func (PlacementDecisionStatus) SwaggerDoc() map[string]string { - return map_PlacementDecisionStatus -} - -// AUTO-GENERATED FUNCTIONS END HERE