It is possible to import an existing installed OpenShift in order to be able to add more workers to it. (Day 2 operation)
Here are the needed CRDs to import an existing cluster:
Optional network configuration.
Configure the number of control planes in the provisionRequirements
field to be greater than 1
. This is needed because adding additional nodes to a Single Node OpenShift is not currently supported.
The differences from the Day 1 ClusterDeployment example are the installed
field that is set to true
and the clusterMetadata
section as described below:
- The
adminKubeconfigSecretRef
is a reference to a secret containing thekubeconfig
. Here is how to create it (replace/path/to/kubeconfig
to the location of the kubeconfig file):
kubectl -n spoke-cluster create secret generic test-cluster-admin-kubeconfig --from-file=kubeconfig=/path/to/kubeconfig
- The
adminPasswordSecretRef
is a reference to a secret containing the admin user name and password. Here is how to create it (replacesupersecretname
andsupersecretpassword
to the actual credentials):
kubectl -n spoke-cluster create secret generic test-cluster-admin-password --from-literal=username=supersecretname --from-literal=password=supersecretpassword
-
The
infraID
is obtained fromoc get infrastructure cluster -o json | jq .status.infrastructureName
-
The
clusterID
is obtained fromoc get clusterversion version -o json | jq .spec.clusterID
Example:
apiVersion: hive.openshift.io/v1
kind: ClusterDeployment
metadata:
name: test-cluster
namespace: spoke-cluster
spec:
baseDomain: hive.example.com
clusterInstallRef:
group: extensions.hive.openshift.io
kind: AgentClusterInstall
name: test-agent-cluster-install
version: v1beta1
clusterMetadata:
adminKubeconfigSecretRef:
name: test-cluster-admin-kubeconfig
adminPasswordSecretRef:
name: test-cluster-admin-password
clusterID: e4affb96-7382-406f-80d6-af01ea9a2c0d
infraID: da41b06f-5b27-416b-a06c-90f83d316516
clusterName: test-cluster
installed: true
platform:
agentBareMetal:
agentSelector:
matchLabels:
bla: aaa
pullSecretRef:
name: pull-secret