forked from stolostron/multicluster-global-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Introduce managedclustermigration api (stolostron#1102)
* support migration Signed-off-by: clyang82 <[email protected]> * rename to managedclustermigration Signed-off-by: clyang82 <[email protected]> --------- Signed-off-by: clyang82 <[email protected]>
- Loading branch information
Showing
14 changed files
with
544 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
68 changes: 68 additions & 0 deletions
68
operator/api/migration/v1alpha1/managedclustermigration_types.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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{}) | ||
} |
127 changes: 127 additions & 0 deletions
127
operator/api/migration/v1alpha1/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.