diff --git a/client/client.go b/client/client.go index daba28bf..4f5bfee0 100644 --- a/client/client.go +++ b/client/client.go @@ -8,7 +8,7 @@ import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/rest" clusterv1client "open-cluster-management.io/api/client/cluster/clientset/versioned" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" "open-cluster-management.io/cluster-proxy/pkg/generated/clientset/versioned" "open-cluster-management.io/cluster-proxy/pkg/util" ) @@ -36,11 +36,11 @@ func GetProxyHost(ctx context.Context, kubeconfig *rest.Config, clusterName stri continue } - set, err := clusterClient.ClusterV1beta1().ManagedClusterSets().Get(ctx, sr.Spec.ManagedClusterSelector.ManagedClusterSet.Name, v1.GetOptions{}) + set, err := clusterClient.ClusterV1beta2().ManagedClusterSets().Get(ctx, sr.Spec.ManagedClusterSelector.ManagedClusterSet.Name, v1.GetOptions{}) if err != nil { return "", err } - selector, err := clusterv1beta1.BuildClusterSelector(set) + selector, err := clusterv1beta2.BuildClusterSelector(set) if err != nil { return "", err } diff --git a/cmd/addon-manager/main.go b/cmd/addon-manager/main.go index 98a258f7..9d344c8e 100644 --- a/cmd/addon-manager/main.go +++ b/cmd/addon-manager/main.go @@ -39,7 +39,7 @@ import ( "open-cluster-management.io/api/client/addon/clientset/versioned" addonclient "open-cluster-management.io/api/client/addon/clientset/versioned" "open-cluster-management.io/api/client/addon/informers/externalversions" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "open-cluster-management.io/cluster-proxy/pkg/config" "open-cluster-management.io/cluster-proxy/pkg/proxyagent/agent" @@ -60,7 +60,7 @@ func init() { utilruntime.Must(addonv1alpha1.AddToScheme(scheme)) utilruntime.Must(proxyv1alpha1.AddToScheme(scheme)) - utilruntime.Must(clusterv1beta1.AddToScheme(scheme)) + utilruntime.Must(clusterv1beta2.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } diff --git a/go.mod b/go.mod index 4fd574b1..bbecb72e 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( k8s.io/klog/v2 v2.80.1 k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 open-cluster-management.io/addon-framework v0.6.1 - open-cluster-management.io/api v0.10.1 + open-cluster-management.io/api v0.11.1-0.20230905055724-cf1ead467a83 sigs.k8s.io/apiserver-network-proxy v0.0.27 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.37 sigs.k8s.io/controller-runtime v0.14.4 diff --git a/go.sum b/go.sum index b1ea6cd4..4c91a7ad 100644 --- a/go.sum +++ b/go.sum @@ -710,8 +710,8 @@ k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5 k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= open-cluster-management.io/addon-framework v0.6.1 h1:gnBZaCRgtiPRjCBJoaRqMivajng/XOKp0NQhJUqLd+U= open-cluster-management.io/addon-framework v0.6.1/go.mod h1:Uu4XC3Ec0ATS7U73PJtzAP4NCDfbDBVy1k5RUUwQDqY= -open-cluster-management.io/api v0.10.1 h1:/qv1qfIkAVSz6RQmKGehSv6zYI34Xmb8hK7sIUVmduM= -open-cluster-management.io/api v0.10.1/go.mod h1:6BB/Y6r3hXlPjpJgDwIs6Ubxyx/kXXOg6D9Cntg1I9E= +open-cluster-management.io/api v0.11.1-0.20230905055724-cf1ead467a83 h1:3zbT3sT/tEAQbpjIk6uRiTQGknQ3kQlfd11ElVuXyyQ= +open-cluster-management.io/api v0.11.1-0.20230905055724-cf1ead467a83/go.mod h1:nsQ/G5JpfjQUg7dHpblyywWC6BRqklNaF6fIswVCHyY= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/hack/crd/bases/cluster.open-cluster-management.io_managedclustersets.yaml b/hack/crd/bases/cluster.open-cluster-management.io_managedclustersets.yaml index 9e771392..35109c2e 100644 --- a/hack/crd/bases/cluster.open-cluster-management.io_managedclustersets.yaml +++ b/hack/crd/bases/cluster.open-cluster-management.io_managedclustersets.yaml @@ -9,207 +9,196 @@ spec: listKind: ManagedClusterSetList plural: managedclustersets shortNames: - - mclset - - mclsets + - mclset + - mclsets singular: managedclusterset - scope: Cluster preserveUnknownFields: false + scope: Cluster versions: - - name: v1alpha1 - deprecated: true - deprecationWarning: "cluster.open-cluster-management.io/v1alpha1 ManagedClusterSet is deprecated; use cluster.open-cluster-management.io/v1beta1 ManagedClusterSet" - schema: - openAPIV3Schema: - description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." - type: object - 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 the ManagedClusterSet - type: object - status: - description: Status represents the current status of the ManagedClusterSet - type: object - properties: - conditions: - description: Conditions contains the different condition statuses for this ManagedClusterSet. - type: array - 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, 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 }" - type: object - required: - - lastTransitionTime - - message - - reason - - status - - type + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=="ClusterSetEmpty")].status + name: Empty + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta2 + schema: + openAPIV3Schema: + description: "ManagedClusterSet defines a group of ManagedClusters that user's + workload can run on. A workload can be defined to deployed on a ManagedClusterSet, + which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet + 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet + 3. The service exposed by the workload can be shared in any ManagedCluster + in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian + ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` + on the ManagedCluster to refers to the ManagedClusterSet. User is not allow + to add/remove this label on a ManagedCluster unless they have a RBAC rule + to CREATE on a virtual subresource of managedclustersets/join. In order + to update this label, user must have the permission on both the old and + new ManagedClusterSet." + 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: + default: + clusterSelector: + selectorType: ExclusiveClusterSetLabel + description: Spec defines the attributes of the ManagedClusterSet + properties: + clusterSelector: + default: + selectorType: ExclusiveClusterSetLabel + description: ClusterSelector represents a selector of ManagedClusters + properties: + labelSelector: + description: LabelSelector define the general labelSelector which + clusterset will use to select target managedClusters 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. - type: string - format: date-time - message: - description: message is a human readable message indicating details about the transition. This may be an empty string. - type: string - maxLength: 32768 - 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. - type: integer - format: int64 - minimum: 0 - 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. - type: string - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - status: - description: status of the condition, one of True, False, Unknown. - type: string - enum: - - "True" - - "False" - - Unknown - 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) - type: string - 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])$ - served: true - storage: false - subresources: - status: {} - - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=="ClusterSetEmpty")].status - name: Empty - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - schema: - openAPIV3Schema: - description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." - type: object - 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 the ManagedClusterSet - type: object - default: - clusterSelector: - selectorType: LegacyClusterSetLabel - properties: - clusterSelector: - description: ClusterSelector represents a selector of ManagedClusters - type: object - default: - selectorType: LegacyClusterSetLabel - properties: - labelSelector: - description: LabelSelector define the general labelSelector which clusterset will use to select target managedClusters - type: object - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - type: array - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - type: object - required: - - key - - operator - 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. + 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 - 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. - type: array - items: - type: string - matchLabels: - 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: array + required: + - key + - operator type: object - additionalProperties: - type: string - selectorType: - description: SelectorType could only be "LegacyClusterSetLabel", "ExclusiveClusterSetLabel" or "LabelSelector" "ExclusiveClusterSetLabel" means to use label "cluster.open-cluster-management.io/clusterset:"" to select target clusters. "LegacyClusterSetLabel" will be replaced by "ExclusiveClusterSetLabel" future "LabelSelector" means use labelSelector to select target managedClusters + 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 + selectorType: + default: ExclusiveClusterSetLabel + description: SelectorType could only be "ExclusiveClusterSetLabel" + or "LabelSelector" "ExclusiveClusterSetLabel" means to use label + "cluster.open-cluster-management.io/clusterset:"" to select target clusters. "LabelSelector" means use + labelSelector to select target managedClusters + enum: + - ExclusiveClusterSetLabel + - LabelSelector + type: string + type: object + type: object + status: + description: Status represents the current status of the ManagedClusterSet + properties: + conditions: + description: Conditions contains the different condition statuses + for this ManagedClusterSet. + 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 - default: LegacyClusterSetLabel + 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: - - LegacyClusterSetLabel - - ExclusiveClusterSetLabel - - LabelSelector - status: - description: Status represents the current status of the ManagedClusterSet - type: object - properties: - conditions: - description: Conditions contains the different condition statuses for this ManagedClusterSet. - type: array - 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, 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 }" - type: object - required: - - lastTransitionTime - - message - - reason - - status - - type - 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. - type: string - format: date-time - message: - description: message is a human readable message indicating details about the transition. This may be an empty string. - type: string - maxLength: 32768 - 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. - type: integer - format: int64 - minimum: 0 - 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. - type: string - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - status: - description: status of the condition, one of True, False, Unknown. - type: string - enum: - - "True" - - "False" - - Unknown - 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) - type: string - 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])$ - served: true - storage: true - subresources: - status: {} + - "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 + type: object + type: object + served: true + storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/hack/crd/cluster/managedclusterset.yaml b/hack/crd/cluster/managedclusterset.yaml index 9e771392..35109c2e 100644 --- a/hack/crd/cluster/managedclusterset.yaml +++ b/hack/crd/cluster/managedclusterset.yaml @@ -9,207 +9,196 @@ spec: listKind: ManagedClusterSetList plural: managedclustersets shortNames: - - mclset - - mclsets + - mclset + - mclsets singular: managedclusterset - scope: Cluster preserveUnknownFields: false + scope: Cluster versions: - - name: v1alpha1 - deprecated: true - deprecationWarning: "cluster.open-cluster-management.io/v1alpha1 ManagedClusterSet is deprecated; use cluster.open-cluster-management.io/v1beta1 ManagedClusterSet" - schema: - openAPIV3Schema: - description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." - type: object - 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 the ManagedClusterSet - type: object - status: - description: Status represents the current status of the ManagedClusterSet - type: object - properties: - conditions: - description: Conditions contains the different condition statuses for this ManagedClusterSet. - type: array - 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, 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 }" - type: object - required: - - lastTransitionTime - - message - - reason - - status - - type + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=="ClusterSetEmpty")].status + name: Empty + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta2 + schema: + openAPIV3Schema: + description: "ManagedClusterSet defines a group of ManagedClusters that user's + workload can run on. A workload can be defined to deployed on a ManagedClusterSet, + which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet + 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet + 3. The service exposed by the workload can be shared in any ManagedCluster + in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian + ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` + on the ManagedCluster to refers to the ManagedClusterSet. User is not allow + to add/remove this label on a ManagedCluster unless they have a RBAC rule + to CREATE on a virtual subresource of managedclustersets/join. In order + to update this label, user must have the permission on both the old and + new ManagedClusterSet." + 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: + default: + clusterSelector: + selectorType: ExclusiveClusterSetLabel + description: Spec defines the attributes of the ManagedClusterSet + properties: + clusterSelector: + default: + selectorType: ExclusiveClusterSetLabel + description: ClusterSelector represents a selector of ManagedClusters + properties: + labelSelector: + description: LabelSelector define the general labelSelector which + clusterset will use to select target managedClusters 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. - type: string - format: date-time - message: - description: message is a human readable message indicating details about the transition. This may be an empty string. - type: string - maxLength: 32768 - 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. - type: integer - format: int64 - minimum: 0 - 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. - type: string - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - status: - description: status of the condition, one of True, False, Unknown. - type: string - enum: - - "True" - - "False" - - Unknown - 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) - type: string - 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])$ - served: true - storage: false - subresources: - status: {} - - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=="ClusterSetEmpty")].status - name: Empty - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - schema: - openAPIV3Schema: - description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." - type: object - 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 the ManagedClusterSet - type: object - default: - clusterSelector: - selectorType: LegacyClusterSetLabel - properties: - clusterSelector: - description: ClusterSelector represents a selector of ManagedClusters - type: object - default: - selectorType: LegacyClusterSetLabel - properties: - labelSelector: - description: LabelSelector define the general labelSelector which clusterset will use to select target managedClusters - type: object - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. The requirements are ANDed. - type: array - items: - description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. - type: object - required: - - key - - operator - 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. + 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 - 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. - type: array - items: - type: string - matchLabels: - 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: array + required: + - key + - operator type: object - additionalProperties: - type: string - selectorType: - description: SelectorType could only be "LegacyClusterSetLabel", "ExclusiveClusterSetLabel" or "LabelSelector" "ExclusiveClusterSetLabel" means to use label "cluster.open-cluster-management.io/clusterset:"" to select target clusters. "LegacyClusterSetLabel" will be replaced by "ExclusiveClusterSetLabel" future "LabelSelector" means use labelSelector to select target managedClusters + 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 + selectorType: + default: ExclusiveClusterSetLabel + description: SelectorType could only be "ExclusiveClusterSetLabel" + or "LabelSelector" "ExclusiveClusterSetLabel" means to use label + "cluster.open-cluster-management.io/clusterset:"" to select target clusters. "LabelSelector" means use + labelSelector to select target managedClusters + enum: + - ExclusiveClusterSetLabel + - LabelSelector + type: string + type: object + type: object + status: + description: Status represents the current status of the ManagedClusterSet + properties: + conditions: + description: Conditions contains the different condition statuses + for this ManagedClusterSet. + 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 - default: LegacyClusterSetLabel + 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: - - LegacyClusterSetLabel - - ExclusiveClusterSetLabel - - LabelSelector - status: - description: Status represents the current status of the ManagedClusterSet - type: object - properties: - conditions: - description: Conditions contains the different condition statuses for this ManagedClusterSet. - type: array - 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, 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 }" - type: object - required: - - lastTransitionTime - - message - - reason - - status - - type - 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. - type: string - format: date-time - message: - description: message is a human readable message indicating details about the transition. This may be an empty string. - type: string - maxLength: 32768 - 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. - type: integer - format: int64 - minimum: 0 - 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. - type: string - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - status: - description: status of the condition, one of True, False, Unknown. - type: string - enum: - - "True" - - "False" - - Unknown - 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) - type: string - 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])$ - served: true - storage: true - subresources: - status: {} + - "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 + type: object + type: object + served: true + storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/pkg/proxyagent/agent/agent.go b/pkg/proxyagent/agent/agent.go index 07599d0c..0b82f9e5 100644 --- a/pkg/proxyagent/agent/agent.go +++ b/pkg/proxyagent/agent/agent.go @@ -25,7 +25,7 @@ import ( addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" addonclient "open-cluster-management.io/api/client/addon/clientset/versioned" clusterv1 "open-cluster-management.io/api/cluster/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "open-cluster-management.io/cluster-proxy/pkg/common" "open-cluster-management.io/cluster-proxy/pkg/config" @@ -247,7 +247,7 @@ func GetClusterProxyValueFunc( // servicesToExpose defines the services we want to expose to the hub. // List all available managedClusterSets - managedClusterSetList := &clusterv1beta1.ManagedClusterSetList{} + managedClusterSetList := &clusterv1beta2.ManagedClusterSetList{} err = runtimeClient.List(context.TODO(), managedClusterSetList) if err != nil { return nil, err @@ -328,8 +328,8 @@ const ( AgentCASecretName = "cluster-proxy-ca" ) -func managedClusterSetsToFilteredMap(managedClusterSets []clusterv1beta1.ManagedClusterSet, clusterlabels map[string]string) (map[string]clusterv1beta1.ManagedClusterSet, error) { - managedClusterSetMap := map[string]clusterv1beta1.ManagedClusterSet{} +func managedClusterSetsToFilteredMap(managedClusterSets []clusterv1beta2.ManagedClusterSet, clusterlabels map[string]string) (map[string]clusterv1beta2.ManagedClusterSet, error) { + managedClusterSetMap := map[string]clusterv1beta2.ManagedClusterSet{} for i := range managedClusterSets { mcs := managedClusterSets[i] @@ -339,7 +339,7 @@ func managedClusterSetsToFilteredMap(managedClusterSets []clusterv1beta1.Managed } // only cluseterSet cover current cluster include in the list. - selector, err := clusterv1beta1.BuildClusterSelector(&mcs) + selector, err := clusterv1beta2.BuildClusterSelector(&mcs) if err != nil { return nil, err } @@ -352,7 +352,7 @@ func managedClusterSetsToFilteredMap(managedClusterSets []clusterv1beta1.Managed return managedClusterSetMap, nil } -func managedProxyServiceResolverToFilterServiceToExpose(serviceResolvers []proxyv1alpha1.ManagedProxyServiceResolver, managedClusterSetMap map[string]clusterv1beta1.ManagedClusterSet, clusterName string) []serviceToExpose { +func managedProxyServiceResolverToFilterServiceToExpose(serviceResolvers []proxyv1alpha1.ManagedProxyServiceResolver, managedClusterSetMap map[string]clusterv1beta2.ManagedClusterSet, clusterName string) []serviceToExpose { servicesToExpose := []serviceToExpose{} for i := range serviceResolvers { sr := serviceResolvers[i] diff --git a/pkg/proxyagent/agent/agent_test.go b/pkg/proxyagent/agent/agent_test.go index 6a55e22e..d8a95922 100644 --- a/pkg/proxyagent/agent/agent_test.go +++ b/pkg/proxyagent/agent/agent_test.go @@ -32,7 +32,7 @@ import ( addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" fakeaddon "open-cluster-management.io/api/client/addon/clientset/versioned/fake" clusterv1 "open-cluster-management.io/api/cluster/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "open-cluster-management.io/cluster-proxy/pkg/config" "open-cluster-management.io/cluster-proxy/pkg/proxyserver/operator/authentication/selfsigned" @@ -49,7 +49,7 @@ var ( func init() { testscheme.AddKnownTypes(proxyv1alpha1.SchemeGroupVersion, &proxyv1alpha1.ManagedProxyConfiguration{}) - testscheme.AddKnownTypes(clusterv1beta1.SchemeGroupVersion, &clusterv1beta1.ManagedClusterSetList{}) + testscheme.AddKnownTypes(clusterv1beta2.SchemeGroupVersion, &clusterv1beta2.ManagedClusterSetList{}) testscheme.AddKnownTypes(proxyv1alpha1.SchemeGroupVersion, &proxyv1alpha1.ManagedProxyServiceResolverList{}) } @@ -57,7 +57,7 @@ func TestFilterMPSR(t *testing.T) { testcases := []struct { name string resolvers []proxyv1alpha1.ManagedProxyServiceResolver - mcsMap map[string]clusterv1beta1.ManagedClusterSet + mcsMap map[string]clusterv1beta2.ManagedClusterSet expected []serviceToExpose }{ { @@ -105,7 +105,7 @@ func TestFilterMPSR(t *testing.T) { }, }, }, - mcsMap: map[string]clusterv1beta1.ManagedClusterSet{ + mcsMap: map[string]clusterv1beta2.ManagedClusterSet{ "set-1": { ObjectMeta: metav1.ObjectMeta{ Name: "set-1", @@ -163,7 +163,7 @@ func TestFilterMPSR(t *testing.T) { }, }, }, - mcsMap: map[string]clusterv1beta1.ManagedClusterSet{ + mcsMap: map[string]clusterv1beta2.ManagedClusterSet{ "set-1": { ObjectMeta: metav1.ObjectMeta{ Name: "set-1", @@ -197,15 +197,15 @@ func TestFilterMCS(t *testing.T) { testcases := []struct { name string clusterlabels map[string]string - clusters []clusterv1beta1.ManagedClusterSet - expected map[string]clusterv1beta1.ManagedClusterSet + clusters []clusterv1beta2.ManagedClusterSet + expected map[string]clusterv1beta2.ManagedClusterSet }{ { name: "filter out the cluster with deletion timestamp", clusterlabels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "set-1", + clusterv1beta2.ClusterSetLabel: "set-1", }, - clusters: []clusterv1beta1.ManagedClusterSet{ + clusters: []clusterv1beta2.ManagedClusterSet{ { ObjectMeta: metav1.ObjectMeta{ Name: "set-1", @@ -213,14 +213,14 @@ func TestFilterMCS(t *testing.T) { }, }, }, - expected: map[string]clusterv1beta1.ManagedClusterSet{}, + expected: map[string]clusterv1beta2.ManagedClusterSet{}, }, { name: "filter out the cluster without the current cluster label", clusterlabels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "set-1", + clusterv1beta2.ClusterSetLabel: "set-1", }, - clusters: []clusterv1beta1.ManagedClusterSet{ + clusters: []clusterv1beta2.ManagedClusterSet{ { ObjectMeta: metav1.ObjectMeta{ Name: "set-1", @@ -232,7 +232,7 @@ func TestFilterMCS(t *testing.T) { }, }, }, - expected: map[string]clusterv1beta1.ManagedClusterSet{ + expected: map[string]clusterv1beta2.ManagedClusterSet{ "set-1": { ObjectMeta: metav1.ObjectMeta{ Name: "set-1", diff --git a/pkg/proxyserver/controllers/service_resolver_controller.go b/pkg/proxyserver/controllers/service_resolver_controller.go index 7d535ae7..4fe69f4b 100644 --- a/pkg/proxyserver/controllers/service_resolver_controller.go +++ b/pkg/proxyserver/controllers/service_resolver_controller.go @@ -8,7 +8,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" utilerrors "k8s.io/apimachinery/pkg/util/errors" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "open-cluster-management.io/cluster-proxy/pkg/proxyserver/operator/eventhandler" "open-cluster-management.io/cluster-proxy/pkg/util" @@ -42,7 +42,7 @@ func (c *ServiceResolverReconciler) SetupWithManager(mgr ctrl.Manager) error { ). Watches( &source.Kind{ - Type: &clusterv1beta1.ManagedClusterSet{}, + Type: &clusterv1beta2.ManagedClusterSet{}, }, &eventhandler.ClustersetHandler{ Client: mgr.GetClient(), @@ -82,7 +82,7 @@ func (c *ServiceResolverReconciler) refreshManageProxyServiceResolversStatus() e } } else { // get managedclusterset - managedClusterSet := &clusterv1beta1.ManagedClusterSet{} + managedClusterSet := &clusterv1beta2.ManagedClusterSet{} if err := c.Client.Get(context.TODO(), types.NamespacedName{ Name: resolver.Spec.ManagedClusterSelector.ManagedClusterSet.Name, }, managedClusterSet); err != nil { diff --git a/pkg/proxyserver/operator/eventhandler/clusterset_event.go b/pkg/proxyserver/operator/eventhandler/clusterset_event.go index 63223a40..80a354c6 100644 --- a/pkg/proxyserver/operator/eventhandler/clusterset_event.go +++ b/pkg/proxyserver/operator/eventhandler/clusterset_event.go @@ -4,7 +4,7 @@ import ( "context" "k8s.io/client-go/util/workqueue" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "open-cluster-management.io/cluster-proxy/pkg/util" "sigs.k8s.io/controller-runtime/pkg/client" @@ -20,27 +20,27 @@ type ClustersetHandler struct { } func (m ClustersetHandler) Create(event event.CreateEvent, limitingInterface workqueue.RateLimitingInterface) { - clusterset := event.Object.(*clusterv1beta1.ManagedClusterSet) + clusterset := event.Object.(*clusterv1beta2.ManagedClusterSet) m.findClusterProxyAddon(clusterset, limitingInterface) } func (m ClustersetHandler) Update(event event.UpdateEvent, limitingInterface workqueue.RateLimitingInterface) { - clusterset := event.ObjectNew.(*clusterv1beta1.ManagedClusterSet) + clusterset := event.ObjectNew.(*clusterv1beta2.ManagedClusterSet) m.findClusterProxyAddon(clusterset, limitingInterface) } func (m ClustersetHandler) Delete(event event.DeleteEvent, limitingInterface workqueue.RateLimitingInterface) { - clusterset := event.Object.(*clusterv1beta1.ManagedClusterSet) + clusterset := event.Object.(*clusterv1beta2.ManagedClusterSet) m.findClusterProxyAddon(clusterset, limitingInterface) } func (m ClustersetHandler) Generic(event event.GenericEvent, limitingInterface workqueue.RateLimitingInterface) { - clusterset := event.Object.(*clusterv1beta1.ManagedClusterSet) + clusterset := event.Object.(*clusterv1beta2.ManagedClusterSet) m.findClusterProxyAddon(clusterset, limitingInterface) } // findClusterProxyAddon will triger clustermanagementaddon on all managed clusters to reconcile. -func (m *ClustersetHandler) findClusterProxyAddon(clusterset *clusterv1beta1.ManagedClusterSet, limitingInterface workqueue.RateLimitingInterface) { +func (m *ClustersetHandler) findClusterProxyAddon(clusterset *clusterv1beta2.ManagedClusterSet, limitingInterface workqueue.RateLimitingInterface) { var err error // Check whether the clusterset is related with any managedproxyserviceresolver. mpsrList := &proxyv1alpha1.ManagedProxyServiceResolverList{} diff --git a/test/e2e/connect/connect.go b/test/e2e/connect/connect.go index 693df1ad..e6fb173c 100644 --- a/test/e2e/connect/connect.go +++ b/test/e2e/connect/connect.go @@ -18,7 +18,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "open-cluster-management.io/cluster-proxy/pkg/util" @@ -250,7 +250,7 @@ func deployHelleWorldApplication(ctx context.Context, name, namespace string, e2 } func deployMCS(ctx context.Context, clusterset string, e2eframe framework.Framework) error { - return e2eframe.HubRuntimeClient().Create(ctx, &clusterv1beta1.ManagedClusterSet{ + return e2eframe.HubRuntimeClient().Create(ctx, &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: clusterset, }, diff --git a/test/e2e/framework/scheme.go b/test/e2e/framework/scheme.go index 3f9fc2fe..3f4cd28e 100644 --- a/test/e2e/framework/scheme.go +++ b/test/e2e/framework/scheme.go @@ -6,7 +6,7 @@ import ( k8sscheme "k8s.io/client-go/kubernetes/scheme" addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" clusterv1 "open-cluster-management.io/api/cluster/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" ) @@ -15,7 +15,7 @@ var scheme = runtime.NewScheme() func init() { utilruntime.Must(proxyv1alpha1.AddToScheme(scheme)) utilruntime.Must(clusterv1.AddToScheme(scheme)) - utilruntime.Must(clusterv1beta1.AddToScheme(scheme)) + utilruntime.Must(clusterv1beta2.AddToScheme(scheme)) utilruntime.Must(addonv1alpha1.AddToScheme(scheme)) utilruntime.Must(k8sscheme.AddToScheme(scheme)) } diff --git a/test/integration/controllers/serviceresolver_controller_test.go b/test/integration/controllers/serviceresolver_controller_test.go index a1f6914b..274f54d2 100644 --- a/test/integration/controllers/serviceresolver_controller_test.go +++ b/test/integration/controllers/serviceresolver_controller_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -85,7 +85,7 @@ var _ = Describe("ServiceResolver Reconciler", func() { }, }, } - clusterset := &clusterv1beta1.ManagedClusterSet{ + clusterset := &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: "sr-test", }, @@ -193,7 +193,7 @@ var _ = Describe("ServiceResolver Reconciler", func() { }, }, } - clusterset := &clusterv1beta1.ManagedClusterSet{ + clusterset := &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: "sr-test3", Finalizers: []string{ @@ -232,7 +232,7 @@ var _ = Describe("ServiceResolver Reconciler", func() { It("Should return confition equals False, and reason is ManagedClusterSetDeleting", func() { Eventually(func() error { - currentClusterSet := &clusterv1beta1.ManagedClusterSet{} + currentClusterSet := &clusterv1beta2.ManagedClusterSet{} err := ctrlClient.Get(ctx, client.ObjectKey{Name: clusterset.Name}, currentClusterSet) if err != nil { return err @@ -247,7 +247,7 @@ var _ = Describe("ServiceResolver Reconciler", func() { return err } - currentClusterSet := &clusterv1beta1.ManagedClusterSet{} + currentClusterSet := &clusterv1beta2.ManagedClusterSet{} err = ctrlClient.Get(ctx, client.ObjectKey{Name: clusterset.Name}, currentClusterSet) if err != nil { return err @@ -293,7 +293,7 @@ var _ = Describe("ServiceResolver Reconciler", func() { }, }, } - clusterset := &clusterv1beta1.ManagedClusterSet{ + clusterset := &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: "sr-test4", }, diff --git a/test/integration/controllers/suite_test.go b/test/integration/controllers/suite_test.go index 02607505..f9f21bf4 100644 --- a/test/integration/controllers/suite_test.go +++ b/test/integration/controllers/suite_test.go @@ -34,7 +34,7 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/util/cert" addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" proxyv1alpha1 "open-cluster-management.io/cluster-proxy/pkg/apis/proxy/v1alpha1" "open-cluster-management.io/cluster-proxy/pkg/proxyserver/controllers" "open-cluster-management.io/cluster-proxy/pkg/proxyserver/operator/authentication/selfsigned" @@ -95,7 +95,7 @@ var _ = BeforeSuite(func() { err = proxyv1alpha1.AddToScheme(scheme) Expect(err).NotTo(HaveOccurred()) - err = clusterv1beta1.AddToScheme(scheme) + err = clusterv1beta2.AddToScheme(scheme) Expect(err).NotTo(HaveOccurred()) kubeClient, err = kubernetes.NewForConfig(cfg)