Skip to content

Commit

Permalink
added controlPlaneEnpoint variable in clusterclass
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakm-ntnx committed Dec 20, 2023
1 parent e188070 commit a2b54dc
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 43 deletions.
1 change: 1 addition & 0 deletions clusterctl.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CLUSTERCTL_LOG_LEVEL: 10
EXP_CLUSTER_RESOURCE_SET: "true"
CLUSTER_TOPOLOGY: "true"

NUTANIX_ENDPOINT: "" # IP or FQDN of Prism Central
NUTANIX_USER: "" # Prism Central user
Expand Down
29 changes: 25 additions & 4 deletions templates/cluster-template-clusterclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,37 @@ spec:
names:
- ${CLUSTER_CLASS_NAME}-worker
name: add-ssh-user
- definitions:
- jsonPatches:
- op: add
path: /spec/template/spec/controlPlaneEndpoint
valueFrom:
template: |
host: '{{ .controlPlaneEndpoint.IP }}'
port: {{ .controlPlaneEndpoint.Port }}
selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: NutanixClusterTemplate
matchResources:
infrastructureCluster: true
name: add-control-plane-endpoint
variables:
- name: sshKey
required: false
required: true
schema:
openAPIV3Schema:
description: Public key to SSH onto the cluster nodes.
type: string
- name: controlPlaneEndpoint
required: true
schema:
openAPIV3Schema:
properties:
IP:
type: string
Port:
type: integer
type: object
workers:
machineDeployments:
- class: ${CLUSTER_CLASS_NAME}-worker
Expand Down Expand Up @@ -526,9 +550,6 @@ metadata:
spec:
template:
spec:
controlPlaneEndpoint:
host: ${CONTROL_PLANE_ENDPOINT_IP}
port: ${CONTROL_PLANE_ENDPOINT_PORT=6443}
failureDomains: []
prismCentral:
additionalTrustBundle:
Expand Down
4 changes: 4 additions & 0 deletions templates/cluster-template-topology.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ spec:
variables:
- name: sshKey
value: ${NUTANIX_SSH_AUTHORIZED_KEY}
- name: controlPlaneEndpoint
value:
IP: ${CONTROL_PLANE_ENDPOINT_IP}
Port: ${CONTROL_PLANE_ENDPOINT_PORT=6443}
version: ${KUBERNETES_VERSION}
workers:
machineDeployments:
Expand Down
92 changes: 58 additions & 34 deletions templates/clusterclass/clusterclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,43 +83,67 @@ spec:
namespace: ${NAMESPACE}
patches:
- definitions:
- jsonPatches:
- op: add
path: /spec/template/spec/kubeadmConfigSpec/users
valueFrom:
template: |
- name: capxuser
lockPassword: false
sudo: ALL=(ALL) NOPASSWD:ALL
sshAuthorizedKeys:
- '{{ .sshKey }}'
selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
- jsonPatches:
- op: add
path: /spec/template/spec/users
valueFrom:
template: |
- name: capxuser
lockPassword: false
sudo: ALL=(ALL) NOPASSWD:ALL
sshAuthorizedKeys:
- '{{ .sshKey }}'
selector:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
matchResources:
machineDeploymentClass:
names:
- ${CLUSTER_CLASS_NAME}-worker
- jsonPatches:
- op: add
path: /spec/template/spec/kubeadmConfigSpec/users
valueFrom:
template: |
- name: capxuser
lockPassword: false
sudo: ALL=(ALL) NOPASSWD:ALL
sshAuthorizedKeys:
- '{{ .sshKey }}'
selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
- jsonPatches:
- op: add
path: /spec/template/spec/users
valueFrom:
template: |
- name: capxuser
lockPassword: false
sudo: ALL=(ALL) NOPASSWD:ALL
sshAuthorizedKeys:
- '{{ .sshKey }}'
selector:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
matchResources:
machineDeploymentClass:
names:
- ${CLUSTER_CLASS_NAME}-worker
name: add-ssh-user
- definitions:
- jsonPatches:
- op: add
path: /spec/template/spec/controlPlaneEndpoint
valueFrom:
template: |
host: '{{ .controlPlaneEndpoint.IP }}'
port: {{ .controlPlaneEndpoint.Port }}
selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: NutanixClusterTemplate
matchResources:
infrastructureCluster: true
name: add-control-plane-endpoint
variables:
- name: sshKey
required: false
required: true
schema:
openAPIV3Schema:
description: Public key to SSH onto the cluster nodes.
type: string
type: string
- name: controlPlaneEndpoint
required: true
schema:
openAPIV3Schema:
properties:
IP:
type: string
Port:
type: integer
type: object
5 changes: 1 addition & 4 deletions templates/clusterclass/nct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ spec:
kind: Secret
additionalTrustBundle:
name: ${CLUSTER_NAME}-pc-trusted-ca-bundle
kind: ConfigMap
controlPlaneEndpoint:
host: "${CONTROL_PLANE_ENDPOINT_IP}"
port: ${CONTROL_PLANE_ENDPOINT_PORT=6443}
kind: ConfigMap
6 changes: 5 additions & 1 deletion templates/topology/cluster-with-topology.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ spec:
metadata: {}
variables:
- name: sshKey
value: '${NUTANIX_SSH_AUTHORIZED_KEY}'
value: '${NUTANIX_SSH_AUTHORIZED_KEY}'
- name: controlPlaneEndpoint
value:
IP: "${CONTROL_PLANE_ENDPOINT_IP}"
Port: ${CONTROL_PLANE_ENDPOINT_PORT=6443}

0 comments on commit a2b54dc

Please sign in to comment.