|
1 | 1 | {{- $cloudConfigSecret := include "capi-vsphere.cloudConfigSecret" . -}}
|
2 |
| -apiVersion: infrastructure.cluster.x-k8s.io/{{ .Values.clusterapiVersion }} |
| 2 | +{{ range $index, $template := .Values.controlPlaneTemplates }} |
| 3 | +{{- $object := dict "MachineTemplate" $template "Index" $index "Context" $ -}} |
| 4 | +--- |
| 5 | +apiVersion: infrastructure.cluster.x-k8s.io/{{ $.Values.clusterapiVersion }} |
3 | 6 | kind: VSphereMachineTemplate
|
4 | 7 | metadata:
|
5 |
| - name: {{ include "capi-vsphere.kubeadmControlPlaneName" . }} |
| 8 | + name: {{ include "capi-vsphere.kubeadmControlPlaneTemplateName" $object }} |
6 | 9 | spec:
|
7 | 10 | template:
|
8 | 11 | spec:
|
9 |
| - {{- with .Values.controlPlaneTemplate.cloneMode }} |
| 12 | + {{- with $template.cloneMode }} |
10 | 13 | cloneMode: {{ . }}
|
11 | 14 | {{- end }}
|
12 |
| - {{- with .Values.controlPlaneTemplate.customVMXKeys }} |
| 15 | + {{- with $template.customVMXKeys }} |
13 | 16 | customVMXKeys: {{ toYaml . | nindent 8 }}
|
14 | 17 | {{- end }}
|
15 |
| - datacenter: {{ default .Values.vsphere.cloudProviderConfiguration.workspace.datacenter .Values.controlPlaneTemplate.datacenter }} |
16 |
| - datastore: {{ default .Values.vsphere.cloudProviderConfiguration.workspace.datastore .Values.controlPlaneTemplate.datastore }} |
17 |
| - {{- with .Values.controlPlaneTemplate.diskGiB }} |
| 18 | + datacenter: {{ default $.Values.vsphere.cloudProviderConfiguration.workspace.datacenter $template.datacenter }} |
| 19 | + datastore: {{ default $.Values.vsphere.cloudProviderConfiguration.workspace.datastore $template.datastore }} |
| 20 | + {{- with $template.diskGiB }} |
18 | 21 | diskGiB: {{ . }}
|
19 | 22 | {{- end }}
|
20 |
| - {{- with .Values.controlPlaneTemplate.failureDomain }} |
| 23 | + {{- with $template.failureDomain }} |
21 | 24 | failureDomain: {{ . }}
|
22 | 25 | {{- end }}
|
23 |
| - folder: {{ default .Values.vsphere.cloudProviderConfiguration.workspace.folder .Values.controlPlaneTemplate.folder }} |
24 |
| - {{- with .Values.controlPlaneTemplate.memoryMiB }} |
| 26 | + folder: {{ default $.Values.vsphere.cloudProviderConfiguration.workspace.folder $template.folder }} |
| 27 | + {{- with $template.memoryMiB }} |
25 | 28 | memoryMiB: {{ . }}
|
26 | 29 | {{- end }}
|
27 |
| - network: {{ toYaml (required ".Values.controlPlaneTemplate.network is required" .Values.controlPlaneTemplate.network) | nindent 8 }} |
28 |
| - {{- with .Values.controlPlaneTemplate.numCPUs }} |
| 30 | + network: {{ toYaml (required ".Values.controlPlaneTemplate.network is required" $template.network) | nindent 8 }} |
| 31 | + {{- with $template.numCPUs }} |
29 | 32 | numCPUs: {{ . }}
|
30 | 33 | {{- end }}
|
31 |
| - {{- with .Values.controlPlaneTemplate.numCoresPerSocket }} |
| 34 | + {{- with $template.numCoresPerSocket }} |
32 | 35 | numCoresPerSocket: {{ . }}
|
33 | 36 | {{- end }}
|
34 |
| - {{- with .Values.controlPlaneTemplate.providerID }} |
| 37 | + {{- with $template.providerID }} |
35 | 38 | providerID: {{ . }}
|
36 | 39 | {{- end }}
|
37 |
| - resourcePool: {{ default .Values.vsphere.cloudProviderConfiguration.workspace.resourcePool .Values.controlPlaneTemplate.resourcePool }} |
38 |
| - server: {{ default .Values.vsphere.server .Values.controlPlaneTemplate.server }} |
39 |
| - {{- with .Values.controlPlaneTemplate.snapshot }} |
| 40 | + resourcePool: {{ default $.Values.vsphere.cloudProviderConfiguration.workspace.resourcePool $template.resourcePool }} |
| 41 | + server: {{ default $.Values.vsphere.server $template.server }} |
| 42 | + {{- with $template.snapshot }} |
40 | 43 | snapshot: {{ . }}
|
41 | 44 | {{- end }}
|
42 |
| - {{- with .Values.controlPlaneTemplate.storagePolicyName }} |
| 45 | + {{- with $template.storagePolicyName }} |
43 | 46 | storagePolicyName: {{ . }}
|
44 | 47 | {{- end }}
|
45 |
| - template: {{ required ".Values.controlPlaneTemplate.template is required" .Values.controlPlaneTemplate.template }} |
46 |
| - thumbprint: {{ default .Values.vsphere.thumbprint .Values.controlPlaneTemplate.thumbprint }} |
| 48 | + template: {{ required (printf ".Values.controlPlaneTemplates[%d].template is required" $index) $template.template }} |
| 49 | + thumbprint: {{ default $.Values.vsphere.thumbprint $template.thumbprint }} |
| 50 | +{{ end }} |
47 | 51 | {{ range $index, $template := .Values.machineTemplates }}
|
48 | 52 | {{- $object := dict "MachineTemplate" $template "Index" $index "Context" $ -}}
|
49 | 53 | ---
|
|
0 commit comments