Contains controllers that support:
- the registration of managed clusters to a hub to place them under management (see cluster join process for design deatails)
- the concept of clusterset (see KEP-1645 for details)
by
ManagedClusterSet
API to group managed clusters (see managed cluster set for design deatails) - the concept of clusterclaim (see KEP-2149 for details)
by
ManagedClusterClaim
API to collect the cluster information from a managed cluster (see cluster claim for design deatails) - the management of managed cluster add-ons (see managed cluster addons management for design deatails)
- Clone this repo:
git clone https://github.com/open-cluster-management-io/registration.git && cd registration
- Prepare a kind cluster, like:
kind create cluster
Note: The Kubernetes cluster needs v1.19 or greater
- Export your kind cluster config, like:
export KUBECONFIG=$HOME/.kube/config
- Deploy the hub control plane:
make deploy-hub
make deploy-webhook
- Deploy the registraion agent:
make bootstrap-secret
make deploy-spoke
You now have a cluster with registraion up and running. The cluster has been registered to itself.
Next you need to approve your cluster like this:
- Approve the managed cluster
kubectl patch managedcluster cluster1 -p='{"spec":{"hubAcceptsClient":true}}' --type=merge
- Apporve the CSR of the managed clsuter
kubectl get csr -l open-cluster-management.io/cluster-name=cluster1 | grep Pending | awk '{print $1}' | xargs kubectl certificate approve
- Finally, you can find the managed cluster is joined and available
kubectl get managedcluster
NAME HUB ACCEPTED MANAGED CLUSTER URLS JOINED AVAILABLE AGE
cluster1 true True True 2m21s
You can find more details for cluster join process from this design doc, and after the registration is deployed, you can try the following features
- Create a cluster set by
ManagedClusterSet
API
cat << EOF | kubectl apply -f -
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: ManagedClusterSet
metadata:
name: clusterset1
EOF
- Add your cluster to the created cluster
kubectl label managedclusters cluster1 "cluster.open-cluster-management.io/clusterset=clusterset1" --overwrite
- Then, you can find there is one managed cluster is selected from the managed cluster set status, e.g:
kubectl get managedclustersets clusterset1 -o jsonpath='{.status.conditions[?(@.type=="ClusterSetEmpty")]}'
{"lastTransitionTime":"2021-08-17T06:18:26Z","message":"1 ManagedClusters selected","reason":"ClustersSelected","status":"False","type":"ClusterSetEmpty"}
You can find more details from the managed cluster set design doc
- Create a
ClusterClaim
to claim the ID of this cluster
cat << EOF | kubectl apply -f -
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: ClusterClaim
metadata:
name: id.k8s.io
spec:
value: cluster1
EOF
- Then, you can find the claim from the managed cluster status, like:
kubectl get managedcluster cluster1 -o jsonpath='{.status.clusterClaims}'
[{"name":"id.k8s.io","value":"cluster1"}]
You can find more details from the cluster claim design doc
A managed cluster add-ons is deployed on the managed cluster to extend the capability of managed cluster. Developers can leverage add-on framework to implement their add-ons. The registration provides the management of the lease update and registration for all managed cluster addons, you can find more details from the Managed cluster addons management design doc
Note: The addon-management is in alpha stage, it is not enabled by default, it is controlled by feature gate
AddonManagement
Check the CONTRIBUTING Doc for how to contribute to the repo.
Slack channel: #open-cluster-mgmt
This code is released under the Apache 2.0 license. See the file LICENSE for more information.