Skip to content

Commit

Permalink
add feature gate ClusterInit (#766)
Browse files Browse the repository at this point in the history
Signed-off-by: Di Xu <stephenhsu90@gmail.com>
  • Loading branch information
dixudx authored Nov 24, 2023
1 parent d46b99f commit a533540
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions clusters/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ const (
const (
// ClusterReady means cluster is ready.
ClusterReady = "Ready"

// ClusterInit indicates whether the cluster has been initialised (optional) after joining.
// In some cases, some extra customized operations are needed to provide some add-on features, such as
// multi-cluster networking, etc.
// With this feature, Clusternet provides a hook to help perform such operations.
ClusterInit = "ClusterInit"
)

// ClusterRegistrationRequestSpec defines the desired state of ClusterRegistrationRequest
Expand Down Expand Up @@ -181,6 +187,7 @@ type ClusterRegistrationRequestList struct {
}

// ManagedClusterSpec defines the desired state of ManagedCluster
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.clusterInitSubName) || has(self.clusterInitSubName)", message="clusterInitSubName is required once set"
type ManagedClusterSpec struct {
// ClusterID, a Random (Version 4) UUID, is a unique value in time and space value representing for child cluster.
// It is typically generated by the clusternet agent on the successful creation of a "clusternet-agent" Lease
Expand All @@ -199,6 +206,17 @@ type ManagedClusterSpec struct {
// +kubebuilder:validation:Type=string
ClusterType ClusterType `json:"clusterType,omitempty"`

// ClusterInitBaseName denotes the name of a Base used for initialization.
// Also a taint "clusters.clusternet.io/initialization:NoSchedule" will be added during the operation and removed
// after successful initialization.
// If this cluster has got an annotation "clusters.clusternet.io/skip-cluster-init", this field will be empty.
// Normally this field is fully managed by clusternet-controller-manager and immutable.
//
// +kubebuilder:validation:Optional
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="clusterInitBaseName is immutable"
// +kubebuilder:validation:MaxLength=512
ClusterInitBaseName *string `json:"clusterInitBaseName"`

// SyncMode decides how to sync resources from parent cluster to child cluster.
//
// +required
Expand Down
5 changes: 5 additions & 0 deletions clusters/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a533540

Please sign in to comment.