From 73803d900f480a4b4d694aad783297854b098ff0 Mon Sep 17 00:00:00 2001 From: Chunlin Yang Date: Wed, 18 Sep 2024 13:44:55 +0800 Subject: [PATCH] :sparkles: Introduce managedclustermigration api (#1102) * support migration Signed-off-by: clyang82 * rename to managedclustermigration Signed-off-by: clyang82 --------- Signed-off-by: clyang82 --- go.mod | 5 +- go.sum | 14 +- operator/PROJECT | 9 ++ .../migration/v1alpha1/groupversion_info.go | 36 +++++ .../v1alpha1/managedclustermigration_types.go | 68 +++++++++ .../v1alpha1/zz_generated.deepcopy.go | 127 +++++++++++++++++ ...anagement.io_managedclustermigrations.yaml | 130 ++++++++++++++++++ ...-operator-manager-config_v1_configmap.yaml | 17 --- ...al-hub-operator.clusterserviceversion.yaml | 21 ++- ...anagement.io_managedclustermigrations.yaml | 124 +++++++++++++++++ operator/config/crd/kustomization.yaml | 1 + ...al-hub-operator.clusterserviceversion.yaml | 19 +++ .../manifests/global-hub-kafka-topic.yaml | 0 .../manifests/global-hub-kafka-user.yaml | 0 14 files changed, 544 insertions(+), 27 deletions(-) create mode 100644 operator/api/migration/v1alpha1/groupversion_info.go create mode 100644 operator/api/migration/v1alpha1/managedclustermigration_types.go create mode 100644 operator/api/migration/v1alpha1/zz_generated.deepcopy.go create mode 100644 operator/bundle/manifests/global-hub.open-cluster-management.io_managedclustermigrations.yaml delete mode 100644 operator/bundle/manifests/multicluster-global-hub-operator-manager-config_v1_configmap.yaml create mode 100644 operator/config/crd/bases/global-hub.open-cluster-management.io_managedclustermigrations.yaml create mode 100644 operator/pkg/controllers/hubofhubs/manager/manifests/global-hub-kafka-topic.yaml create mode 100644 operator/pkg/controllers/hubofhubs/manager/manifests/global-hub-kafka-user.yaml diff --git a/go.mod b/go.mod index a1053f56e..ebcd14eeb 100644 --- a/go.mod +++ b/go.mod @@ -62,6 +62,7 @@ require ( require ( github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/certificate-transparency-go v1.1.7 // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect @@ -149,8 +150,8 @@ require ( github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.7 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/leodido/go-urn v1.2.4 // indirect; indirec github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect diff --git a/go.sum b/go.sum index c39c079ce..679cb9b11 100644 --- a/go.sum +++ b/go.sum @@ -417,8 +417,8 @@ github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aA github.com/go-logr/zapr v0.2.0/go.mod h1:qhKdvif7YF5GI9NWEpyxTSSBdGmzkNguibrdCNVPunU= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= -github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -809,11 +809,11 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -1607,9 +1607,9 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/operator/PROJECT b/operator/PROJECT index f9e7c6ab4..7618950c9 100644 --- a/operator/PROJECT +++ b/operator/PROJECT @@ -21,4 +21,13 @@ resources: kind: MulticlusterGlobalHub path: github.com/stolostron/multicluster-global-hub-operator/operator/api/v1alpha4 version: v1alpha4 +- api: + crdVersion: v1 + namespaced: true + controller: true + domain: open-cluster-management.io + group: global-hub + kind: ManagedClusterMigration + path: github.com/stolostron/multicluster-global-hub-operator/migration/api/v1alpha1 + version: v1alpha1 version: "3" diff --git a/operator/api/migration/v1alpha1/groupversion_info.go b/operator/api/migration/v1alpha1/groupversion_info.go new file mode 100644 index 000000000..bdccf93dd --- /dev/null +++ b/operator/api/migration/v1alpha1/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha1 contains API Schema definitions for the operator v1alpha4 API group +// +kubebuilder:object:generate=true +// +groupName=global-hub.open-cluster-management.io +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "global-hub.open-cluster-management.io", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/operator/api/migration/v1alpha1/managedclustermigration_types.go b/operator/api/migration/v1alpha1/managedclustermigration_types.go new file mode 100644 index 000000000..45a14882a --- /dev/null +++ b/operator/api/migration/v1alpha1/managedclustermigration_types.go @@ -0,0 +1,68 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// ManagedClusterMigration is a global hub resource that allows you to migrate managed clusters from one hub to another +type ManagedClusterMigration struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec specifies the desired state of managedclustermigration + Spec ManagedClusterMigrationSpec `json:"spec,omitempty"` + // Status specifies the observed state of managedclustermigration + Status ManagedClusterMigrationStatus `json:"status,omitempty"` +} + +// ManagedClusterMigrationSpec defines the desired state of managedclustermigration +type ManagedClusterMigrationSpec struct { + // IncludedManagedClusters is a list of managed clusters that you want to migrate + // +operator-sdk:csv:customresourcedefinitions:type=spec + IncludedManagedClusters []string `json:"includedManagedClusters,omitempty"` + + // From defines which hub cluster the managed clusters are from + // +optional + From string `json:"from,omitempty"` + + // To defines which hub cluster the managed clusters migrate to + // +operator-sdk:csv:customresourcedefinitions:type=spec + To string `json:"to,omitempty"` +} + +// ManagedClusterMigrationStatus defines the observed state of managedclustermigration +type ManagedClusterMigrationStatus struct { + // Conditions represents the latest available observations of the current state + // +operator-sdk:csv:customresourcedefinitions:type=status + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// ManagedClusterMigrationList contains a list of migration +type ManagedClusterMigrationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ManagedClusterMigration `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ManagedClusterMigration{}, &ManagedClusterMigrationList{}) +} diff --git a/operator/api/migration/v1alpha1/zz_generated.deepcopy.go b/operator/api/migration/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..5c976c043 --- /dev/null +++ b/operator/api/migration/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,127 @@ +//go:build !ignore_autogenerated + +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "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 *ManagedClusterMigration) DeepCopyInto(out *ManagedClusterMigration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterMigration. +func (in *ManagedClusterMigration) DeepCopy() *ManagedClusterMigration { + if in == nil { + return nil + } + out := new(ManagedClusterMigration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ManagedClusterMigration) 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 *ManagedClusterMigrationList) DeepCopyInto(out *ManagedClusterMigrationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ManagedClusterMigration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterMigrationList. +func (in *ManagedClusterMigrationList) DeepCopy() *ManagedClusterMigrationList { + if in == nil { + return nil + } + out := new(ManagedClusterMigrationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ManagedClusterMigrationList) 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 *ManagedClusterMigrationSpec) DeepCopyInto(out *ManagedClusterMigrationSpec) { + *out = *in + if in.IncludedManagedClusters != nil { + in, out := &in.IncludedManagedClusters, &out.IncludedManagedClusters + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterMigrationSpec. +func (in *ManagedClusterMigrationSpec) DeepCopy() *ManagedClusterMigrationSpec { + if in == nil { + return nil + } + out := new(ManagedClusterMigrationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ManagedClusterMigrationStatus) DeepCopyInto(out *ManagedClusterMigrationStatus) { + *out = *in + 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]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterMigrationStatus. +func (in *ManagedClusterMigrationStatus) DeepCopy() *ManagedClusterMigrationStatus { + if in == nil { + return nil + } + out := new(ManagedClusterMigrationStatus) + in.DeepCopyInto(out) + return out +} diff --git a/operator/bundle/manifests/global-hub.open-cluster-management.io_managedclustermigrations.yaml b/operator/bundle/manifests/global-hub.open-cluster-management.io_managedclustermigrations.yaml new file mode 100644 index 000000000..05a13bdf1 --- /dev/null +++ b/operator/bundle/manifests/global-hub.open-cluster-management.io_managedclustermigrations.yaml @@ -0,0 +1,130 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.0 + creationTimestamp: null + name: managedclustermigrations.global-hub.open-cluster-management.io +spec: + group: global-hub.open-cluster-management.io + names: + kind: ManagedClusterMigration + listKind: ManagedClusterMigrationList + plural: managedclustermigrations + singular: managedclustermigration + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ManagedClusterMigration is a global hub resource that allows + you to migrate managed clusters from one hub to another + 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 specifies the desired state of managedclustermigration + properties: + from: + description: From defines which hub cluster the managed clusters are + from + type: string + includedManagedClusters: + description: IncludedManagedClusters is a list of managed clusters + that you want to migrate + items: + type: string + type: array + to: + description: To defines which hub cluster the managed clusters migrate + to + type: string + type: object + status: + description: Status specifies the observed state of managedclustermigration + properties: + conditions: + description: Conditions represents the latest available observations + of the current state + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + 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. + 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: "" + plural: "" + conditions: null + storedVersions: null diff --git a/operator/bundle/manifests/multicluster-global-hub-operator-manager-config_v1_configmap.yaml b/operator/bundle/manifests/multicluster-global-hub-operator-manager-config_v1_configmap.yaml deleted file mode 100644 index d5edb904e..000000000 --- a/operator/bundle/manifests/multicluster-global-hub-operator-manager-config_v1_configmap.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -data: - controller_manager_config.yaml: | - apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 - kind: ControllerManagerConfig - health: - healthProbeBindAddress: :8081 - metrics: - bindAddress: 127.0.0.1:8080 - webhook: - port: 9443 - leaderElection: - leaderElect: true - resourceName: 549a8919.open-cluster-management.io -kind: ConfigMap -metadata: - name: multicluster-global-hub-operator-manager-config diff --git a/operator/bundle/manifests/multicluster-global-hub-operator.clusterserviceversion.yaml b/operator/bundle/manifests/multicluster-global-hub-operator.clusterserviceversion.yaml index 7dc8ce967..4596fc7d8 100644 --- a/operator/bundle/manifests/multicluster-global-hub-operator.clusterserviceversion.yaml +++ b/operator/bundle/manifests/multicluster-global-hub-operator.clusterserviceversion.yaml @@ -23,7 +23,7 @@ metadata: categories: Integration & Delivery,OpenShift Optional certified: "false" containerImage: quay.io/stolostron/multicluster-global-hub-operator:latest - createdAt: "2024-09-09T07:05:58Z" + createdAt: "2024-09-13T07:24:35Z" description: Manages the installation and upgrade of the Multicluster Global Hub. olm.skipRange: '>=1.2.0 <1.3.0' operatorframework.io/initialization-resource: '{"apiVersion":"operator.open-cluster-management.io/v1alpha4", @@ -40,6 +40,25 @@ spec: apiservicedefinitions: {} customresourcedefinitions: owned: + - description: ManagedClusterMigration is a global hub resource that allows you + to migrate managed clusters from one hub to another + displayName: Managed Cluster Migration + kind: ManagedClusterMigration + name: managedclustermigrations.global-hub.open-cluster-management.io + specDescriptors: + - description: IncludedManagedClusters is a list of managed clusters that you + want to migrate + displayName: Included Managed Clusters + path: includedManagedClusters + - description: To defines which hub cluster the managed clusters migrate to + displayName: To + path: to + statusDescriptors: + - description: Conditions represents the latest available observations of the + current state + displayName: Conditions + path: conditions + version: v1alpha1 - description: MulticlusterGlobalHub defines the configuration for an instance of the multiCluster global hub displayName: Multicluster Global Hub diff --git a/operator/config/crd/bases/global-hub.open-cluster-management.io_managedclustermigrations.yaml b/operator/config/crd/bases/global-hub.open-cluster-management.io_managedclustermigrations.yaml new file mode 100644 index 000000000..d1ff98758 --- /dev/null +++ b/operator/config/crd/bases/global-hub.open-cluster-management.io_managedclustermigrations.yaml @@ -0,0 +1,124 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.0 + name: managedclustermigrations.global-hub.open-cluster-management.io +spec: + group: global-hub.open-cluster-management.io + names: + kind: ManagedClusterMigration + listKind: ManagedClusterMigrationList + plural: managedclustermigrations + singular: managedclustermigration + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ManagedClusterMigration is a global hub resource that allows + you to migrate managed clusters from one hub to another + 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 specifies the desired state of managedclustermigration + properties: + from: + description: From defines which hub cluster the managed clusters are + from + type: string + includedManagedClusters: + description: IncludedManagedClusters is a list of managed clusters + that you want to migrate + items: + type: string + type: array + to: + description: To defines which hub cluster the managed clusters migrate + to + type: string + type: object + status: + description: Status specifies the observed state of managedclustermigration + properties: + conditions: + description: Conditions represents the latest available observations + of the current state + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + 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. + 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: {} diff --git a/operator/config/crd/kustomization.yaml b/operator/config/crd/kustomization.yaml index 997776a74..995861f0b 100644 --- a/operator/config/crd/kustomization.yaml +++ b/operator/config/crd/kustomization.yaml @@ -3,6 +3,7 @@ # It should be run by config/default resources: - bases/operator.open-cluster-management.io_multiclusterglobalhubs.yaml +- bases/global-hub.open-cluster-management.io_managedclustermigrations.yaml #+kubebuilder:scaffold:crdkustomizeresource patchesStrategicMerge: diff --git a/operator/config/manifests/bases/multicluster-global-hub-operator.clusterserviceversion.yaml b/operator/config/manifests/bases/multicluster-global-hub-operator.clusterserviceversion.yaml index 7e53ff560..d5483578b 100644 --- a/operator/config/manifests/bases/multicluster-global-hub-operator.clusterserviceversion.yaml +++ b/operator/config/manifests/bases/multicluster-global-hub-operator.clusterserviceversion.yaml @@ -23,6 +23,25 @@ spec: apiservicedefinitions: {} customresourcedefinitions: owned: + - description: ManagedClusterMigration is a global hub resource that allows you + to migrate managed clusters from one hub to another + displayName: Managed Cluster Migration + kind: ManagedClusterMigration + name: managedclustermigrations.global-hub.open-cluster-management.io + specDescriptors: + - description: IncludedManagedClusters is a list of managed clusters that you + want to migrate + displayName: Included Managed Clusters + path: includedManagedClusters + - description: To defines which hub cluster the managed clusters migrate to + displayName: To + path: to + statusDescriptors: + - description: Conditions represents the latest available observations of the + current state + displayName: Conditions + path: conditions + version: v1alpha1 - description: MulticlusterGlobalHub defines the configuration for an instance of the multiCluster global hub displayName: Multicluster Global Hub diff --git a/operator/pkg/controllers/hubofhubs/manager/manifests/global-hub-kafka-topic.yaml b/operator/pkg/controllers/hubofhubs/manager/manifests/global-hub-kafka-topic.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/operator/pkg/controllers/hubofhubs/manager/manifests/global-hub-kafka-user.yaml b/operator/pkg/controllers/hubofhubs/manager/manifests/global-hub-kafka-user.yaml new file mode 100644 index 000000000..e69de29bb