Skip to content

Commit f9a910a

Browse files
authored
Merge pull request #1322 from FutureMatt/extra-volume-mounts
Added the ability to apply extra volumes, volume mounts and host aliases to the daemonset
2 parents 41e82a9 + c7d9cc4 commit f9a910a

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

charts/vsphere-cpi/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,16 @@ The following table lists the configurable parameters of the vSphere CPI chart a
118118
| `daemonset.cmdline.logging` | Logging level | 2 |
119119
| `daemonset.cmdline.cloudConfig.dir` | vSphere conf directory | /etc/cloud |
120120
| `daemonset.cmdline.cloudConfig.file` | vSphere conf filename | vsphere.conf |
121-
| `daemonset.replicaCount` | Node resources | `[]` |
121+
| `daemonset.replicaCount` | Node resources | 1 |
122122
| `daemonset.resources` | Node resources | `[]` |
123123
| `daemonset.podAnnotations` | Annotations for CPI pod | nil |
124124
| `daemonset.podLabels` | Labels for CPI pod | nil |
125125
| `daemonset.nodeSelector` | User-defined node selectors | nil |
126126
| `daemonset.tolerations` | User-defined tolerations | nil |
127+
| `daemonset.affinity` | User-defined affinities | nil |
128+
| `daemonset.extraVolumes` | User-defined volumes | `[]` |
129+
| `daemonset.extraVolumeMounts` | User-defined volume mounts | `[]` |
130+
| `daemonset.hostAliases` | User-defined host aliases | `[]` |
127131

128132
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install` using Helm v3.X. For example,
129133

charts/vsphere-cpi/templates/configmap.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ data:
2121
port: 443
2222
{{- if $config.thumbprint }}
2323
thumbprint: {{ $config.thumbprint }}
24+
{{- else if $config.caFile }}
25+
ca-file: {{ $config.caFile }}
2426
{{- else }}
2527
# set insecure-flag to true if the vCenter uses a self-signed cert
2628
insecureFlag: true

charts/vsphere-cpi/templates/daemonset.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ spec:
4747
{{- if .Values.daemonset.affinity }}
4848
affinity:
4949
{{- toYaml .Values.daemonset.affinity | nindent 8 }}
50+
{{- end }}
51+
{{- if .Values.daemonset.hostAliases }}
52+
hostAliases:
53+
{{- toYaml .Values.daemonset.hostAliases | nindent 8 }}
5054
{{- end }}
5155
{{- if .Values.securityContext.enabled }}
5256
securityContext:
@@ -72,6 +76,9 @@ spec:
7276
- mountPath: {{ .Values.daemonset.cmdline.cloudConfig.dir }}
7377
name: vsphere-config-volume
7478
readOnly: true
79+
{{- if .Values.daemonset.extraVolumeMounts }}
80+
{{- toYaml .Values.daemonset.extraVolumeMounts | nindent 10 }}
81+
{{- end }}
7582
{{- if .Values.daemonset.resources }}
7683
resources:
7784
{{- toYaml .Values.daemonset.resources | nindent 10 }}
@@ -80,3 +87,6 @@ spec:
8087
- name: vsphere-config-volume
8188
configMap:
8289
name: {{ if $config.enabled }}{{- $config.name }}{{- else }}cloud-config{{- end }}
90+
{{- if .Values.daemonset.extraVolumes }}
91+
{{- toYaml .Values.daemonset.extraVolumes | nindent 8 }}
92+
{{- end }}

charts/vsphere-cpi/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ config:
1212
region: "k8s-region"
1313
zone: "k8s-zone"
1414
thumbprint: ""
15+
caFile: "" # Path to the ca-file if it has been mounted into the pod.
1516
secret:
1617
# Specifies whether Secret should be created from config values
1718
create: true
@@ -93,3 +94,6 @@ daemonset:
9394
- matchExpressions:
9495
- key: node-role.kubernetes.io/control-plane
9596
operator: Exists
97+
extraVolumes: []
98+
extraVolumesMounts: []
99+
hostAliases: []

0 commit comments

Comments
 (0)