Skip to content

Commit ff13953

Browse files
authored
Merge pull request #33 from clastix/isses/32
add pre/post kubeadm commands
2 parents 1657bc1 + 5ac0362 commit ff13953

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

charts/capi-kamaji-vsphere/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: capi-kamaji-vsphere
2-
version: 0.2.7
2+
version: 0.2.8
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# capi-kamaji-vsphere
22

3-
![Version: 0.2.7](https://img.shields.io/badge/Version-0.2.7-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.8](https://img.shields.io/badge/Version-0.2.8-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

@@ -70,6 +70,8 @@ A Helm chart for deploying a Kamaji Tenant Cluster on vSphere using Cluster API
7070
| nodePools[0].nameServers | list | `["8.8.8.8"]` | Nameservers for VMs DNS resolution if required |
7171
| nodePools[0].network | string | `"network"` | VSphere network for VMs and CSI |
7272
| nodePools[0].numCPUs | int | `2` | Number of vCPUs to allocate to worker instances |
73+
| nodePools[0].postKubeadmCommands | list | `[]` | Post kubeadm commands to run on the machines |
74+
| nodePools[0].preKubeadmCommands | list | `["hostnamectl set-hostname \"{{ ds.meta_data.hostname }}\"","echo \"::1 ipv6-localhost ipv6-loopback localhost6 localhost6.localdomain6\" >/etc/hosts","echo \"127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\" >>/etc/hosts"]` | Pre kubeadm commands to run on the machines |
7375
| nodePools[0].replicas | int | `3` | Number of worker VMs instances |
7476
| nodePools[0].resourcePool | string | `"*/Resources"` | VSphere resource pool to use |
7577
| nodePools[0].staticRoutes | list | `[]` | Static network routes if required |

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ joinConfiguration:
1212
register-with-taints: {{ .nodePool.taints | quote }}
1313
{{- end }}
1414
name: "{{`{{ local_hostname }}`}}"
15+
{{- if .nodePool.preKubeadmCommands }}
1516
preKubeadmCommands:
16-
- hostnamectl set-hostname "{{`{{ ds.meta_data.hostname }}`}}"
17-
- echo "::1 ipv6-localhost ipv6-loopback localhost6 localhost6.localdomain6" >/etc/hosts
18-
- echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" >>/etc/hosts
17+
{{- range .nodePool.preKubeadmCommands }}
18+
- {{- toYaml . | nindent 4 }}
19+
{{- end }}
20+
{{- end }}
21+
{{- if .nodePool.postKubeadmCommands }}
22+
postKubeadmCommands:
23+
{{- range .nodePool.postKubeadmCommands }}
24+
- {{- toYaml . | nindent 4 }}
25+
{{- end }}
26+
{{- end }}
1927
{{- if .nodePool.additionalCloudInitFiles }}
2028
files:
2129
- path: "/etc/cloud/cloud.cfg.d/99-custom.cfg"

charts/capi-kamaji-vsphere/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ nodePools:
194194
# labels: "node.kubernetes.io/node=foo"
195195
# -- Taints to add to the node pool when joining the cluster
196196
# taints: "node.kubernetes.io/node:NoSchedule"
197+
# -- Pre kubeadm commands to run on the machines
198+
preKubeadmCommands:
199+
- hostnamectl set-hostname "{{ ds.meta_data.hostname }}"
200+
- echo "::1 ipv6-localhost ipv6-loopback localhost6 localhost6.localdomain6" >/etc/hosts
201+
- echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" >>/etc/hosts
202+
# - echo "vm.max_map_count=262144" >> /etc/sysctl.conf
203+
# - sysctl -p
204+
# -- Post kubeadm commands to run on the machines
205+
postKubeadmCommands: []
206+
# - echo "node joined" >> /var/log/cloud-init.log
197207
vSphereCloudControllerManager:
198208
# -- Labels for toplogy regions and zones
199209
topology:

0 commit comments

Comments
 (0)