Skip to content

Commit 661643e

Browse files
authored
Merge pull request #16 from /issues/15
feat: enhance user provisioning
2 parents 681953b + 8dafe1f commit 661643e

File tree

5 files changed

+35
-27
lines changed

5 files changed

+35
-27
lines changed

README.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The implementation uses hash-suffixed templates, `VSphereMachineTemplate` and `K
4242
#### Rolling Update Workflow
4343

4444
1. Update `values.yaml` with new configuration
45-
2. Run: `helm upgrade my-cluster ./cluster-api-kamaji-vsphere`
45+
2. Run: `helm upgrade cluster-name ./cluster-api-kamaji-vsphere`
4646
3. Cluster API automatically replaces nodes using the new configuration
4747

4848
### Split Infrastructure Controller Deployment
@@ -106,7 +106,7 @@ helm repo add clastix https://clastix.github.io/charts
106106
helm repo update
107107

108108
# Install with custom values
109-
helm install my-cluster clastix/capi-kamaji-vsphere -f my-values.yaml
109+
helm install cluster-name clastix/capi-kamaji-vsphere -f my-values.yaml
110110
```
111111

112112
## Credentials Management
@@ -129,9 +129,9 @@ apiVersion: v1
129129
kind: Secret
130130
metadata:
131131
name: vsphere-secret
132-
namespace: my-cluster
132+
namespace: cluster-namespace
133133
labels:
134-
cluster.x-k8s.io/cluster-name: "my-cluster"
134+
cluster.x-k8s.io/cluster-name: "cluster-name"
135135
stringData:
136136
username: "administrator@vsphere.local"
137137
password: "YOUR_PASSWORD"
@@ -145,9 +145,9 @@ apiVersion: v1
145145
kind: Secret
146146
metadata:
147147
name: vsphere-config-secret
148-
namespace: my-cluster
148+
namespace: cluster-namespace
149149
labels:
150-
cluster.x-k8s.io/cluster-name: "my-cluster"
150+
cluster.x-k8s.io/cluster-name: "cluster-name"
151151
stringData:
152152
vsphere.conf: |
153153
global:
@@ -178,7 +178,7 @@ metadata:
178178
name: vsphere-secret
179179
namespace: capv-system
180180
labels:
181-
cluster.x-k8s.io/cluster-name: "my-cluster"
181+
cluster.x-k8s.io/cluster-name: "cluster-name"
182182
stringData:
183183
username: "administrator@vsphere.local"
184184
password: "YOUR_PASSWORD"
@@ -209,9 +209,9 @@ apiVersion: v1
209209
kind: Secret
210210
metadata:
211211
name: vsphere-config-secret
212-
namespace: my-cluster
212+
namespace: cluster-namespace
213213
labels:
214-
cluster.x-k8s.io/cluster-name: "my-cluster"
214+
cluster.x-k8s.io/cluster-name: "cluster-name"
215215
stringData:
216216
vsphere.conf: |
217217
global:
@@ -234,13 +234,13 @@ EOF
234234

235235
```bash
236236
# Deploy using the chart
237-
helm install my-cluster ./cluster-api-kamaji-vsphere -f values.yaml
237+
helm install cluster-name ./cluster-api-kamaji-vsphere -f values.yaml
238238

239239
# Check status
240240
kubectl get cluster,machines
241241

242242
# Get kubeconfig
243-
clusterctl get kubeconfig my-cluster > my-cluster.kubeconfig
243+
clusterctl get kubeconfig cluster-name > cluster-name.kubeconfig
244244
```
245245

246246
### Upgrading a cluster
@@ -256,7 +256,7 @@ vSphereCloudControllerManager:
256256
version: "v1.32.0"
257257

258258
# Apply upgrade
259-
helm upgrade my-cluster ./cluster-api-kamaji-vsphere -f values.yaml
259+
helm upgrade cluster-name ./cluster-api-kamaji-vsphere -f values.yaml
260260

261261
# Watch the rolling update
262262
kubectl get machines -w
@@ -271,7 +271,7 @@ nodePools:
271271
replicas: 5
272272

273273
# Apply scaling
274-
helm upgrade my-cluster ./cluster-api-kamaji-vsphere -f values.yaml
274+
helm upgrade cluster-name ./cluster-api-kamaji-vsphere -f values.yaml
275275

276276
# Watch the scaling
277277
kubectl get machines -w
@@ -281,7 +281,7 @@ kubectl get machines -w
281281

282282
```bash
283283
# Delete the cluster
284-
helm uninstall my-cluster
284+
helm uninstall cluster-name
285285
```
286286

287287
### Troubleshooting
@@ -290,11 +290,11 @@ If Helm uninstall fails with IP pool deletion errors:
290290

291291
```bash
292292
# Wait for machines to be deleted first
293-
kubectl delete machinedeployment -l cluster.x-k8s.io/cluster-name=my-cluster
294-
kubectl wait --for=delete vspheremachines -l cluster.x-k8s.io/cluster-name=my-cluster
293+
kubectl delete machinedeployment -l cluster.x-k8s.io/cluster-name=cluster-name
294+
kubectl wait --for=delete vspheremachines -l cluster.x-k8s.io/cluster-name=cluster-name
295295

296296
# Retry helm uninstall
297-
helm uninstall my-cluster
297+
helm uninstall cluster-name
298298
```
299299

300300
If nodes taints are not removed:

charts/capi-kamaji-vsphere/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: capi-kamaji-vsphere
2-
version: 0.2.1
2+
version: 0.2.2
33
appVersion: 1.32.0
44
description: A Helm chart for deploying a Kamaji Tenant Cluster on vSphere using Cluster API
55
and Kamaji.

charts/capi-kamaji-vsphere/README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# capi-kamaji-vsphere
22

3-
![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.32.0](https://img.shields.io/badge/AppVersion-1.32.0-informational?style=flat-square)
3+
![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.32.0](https://img.shields.io/badge/AppVersion-1.32.0-informational?style=flat-square)
44

55
A Helm chart for deploying a Kamaji Tenant Cluster on vSphere using Cluster API and Kamaji.
66

@@ -73,7 +73,12 @@ A Helm chart for deploying a Kamaji Tenant Cluster on vSphere using Cluster API
7373
| nodePools[0].staticRoutes | list | `[]` | Static network routes if required |
7474
| nodePools[0].storagePolicyName | string | `""` | VSphere storage policy to use |
7575
| nodePools[0].template | string | `"ubuntu-2204-kube-v1.32.0"` | VSphere template to clone |
76-
| nodePools[0].users | list | `[{"name":"ubuntu","sshAuthorizedKeys":[],"sudo":"ALL=(ALL) NOPASSWD:ALL"}]` | users to create on machines |
76+
| nodePools[0].users | list | `[{"lockPassword":true,"name":"ubuntu","shell":"/bin/bash","sshAuthorizedKeys":[],"sudo":"ALL=(ALL) NOPASSWD:ALL"}]` | users to create on machines |
77+
| nodePools[0].users[0] | object | `{"lockPassword":true,"name":"ubuntu","shell":"/bin/bash","sshAuthorizedKeys":[],"sudo":"ALL=(ALL) NOPASSWD:ALL"}` | username to create |
78+
| nodePools[0].users[0].lockPassword | bool | `true` | Lock login password |
79+
| nodePools[0].users[0].shell | string | `"/bin/bash"` | SSH shell to use |
80+
| nodePools[0].users[0].sshAuthorizedKeys | list | `[]` | SSH public key to add |
81+
| nodePools[0].users[0].sudo | string | `"ALL=(ALL) NOPASSWD:ALL"` | sudoers configuration |
7782
| vSphere.dataCenter | string | `"datacenter"` | Datacenter to use |
7883
| vSphere.identityRef | object | `{"name":"vsphere-secret","type":"Secret"}` | VSphere Identity Management |
7984
| vSphere.identityRef.name | string | `"vsphere-secret"` | Specifies the name of the VSphereClusterIdentity or Secret |

charts/capi-kamaji-vsphere/templates/_kubeadm-config-template.tpl

+1-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@ files:
2626
{{- if .nodePool.users }}
2727
users:
2828
{{- range .nodePool.users }}
29-
- name: {{ .name | quote }}
30-
sshAuthorizedKeys:
31-
{{- range .sshAuthorizedKeys }}
32-
- {{ . | quote }}
33-
{{- end }}
34-
sudo: {{ .sudo | quote }}
29+
- {{- toYaml . | nindent 4 }}
3530
{{- end }}
3631
{{- end }}
3732
{{- end -}}

charts/capi-kamaji-vsphere/values.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,22 @@ nodePools:
169169
# gateway: ""
170170
# -- users to create on machines
171171
users:
172+
# -- username to create
172173
- name: ubuntu
174+
# -- SSH shell to use
175+
shell: /bin/bash
176+
# -- SSH password to use. Use mkpasswd -m sha-512 to generate the password
177+
# passwd: "$6$E0UW ..."
178+
# -- Lock login password
179+
lockPassword: true
180+
# -- SSH public key to add
173181
sshAuthorizedKeys: []
182+
# -- sudoers configuration
174183
sudo: ALL=(ALL) NOPASSWD:ALL
175184
# -- Labels to add to the node pool when joining the cluster
176185
# labels: "node.kubernetes.io/node=foo"
177186
# -- Taints to add to the node pool when joining the cluster
178187
# taints: "node.kubernetes.io/node:NoSchedule"
179-
180188
vSphereCloudControllerManager:
181189
# -- Installs vsphere-cloud-controller-manager on the management cluster
182190
enabled: true

0 commit comments

Comments
 (0)