Skip to content

Commit

Permalink
Merge pull request #63 from farodin91/free-set-config-location-for-cs…
Browse files Browse the repository at this point in the history
…i-and-cpi

use existing config for cpi
  • Loading branch information
MaxRink committed Jun 6, 2023
2 parents 61162ae + 6892522 commit b8a3f85
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/vsphere-cpi/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ maintainers:
email: myles@vmware.com
name: vsphere-cpi
sources:
version: 1.4.0
version: 1.5.0
2 changes: 1 addition & 1 deletion charts/vsphere-cpi/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.global.config.secretsInline }}
{{- if not (or .Values.global.config.secretsInline .Values.global.config.existingConfig.enabled) }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
12 changes: 12 additions & 0 deletions charts/vsphere-cpi/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ spec:
template:
metadata:
annotations:
{{- if not .Values.global.config.existingConfig.enabled }}
{{- if not .Values.global.config.secretsInline }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.vSphereCPI.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.vSphereCPI.podAnnotations "context" $) | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -137,13 +139,23 @@ spec:
{{- end }}
volumes:
- name: vsphere-config-volume
{{- if not .Values.global.config.existingConfig.enabled }}
{{- if not .Values.global.config.secretsInline }}
configMap:
name: {{ template "common.names.fullname" . }}
{{- else }}
secret:
secretName: {{ template "common.names.fullname" . }}
{{- end }}
{{- else }}
{{- if eq .Values.global.config.existingConfig.type "Secret" }}
secret:
secretName: {{ .Values.global.config.existingConfig.name }}
{{- else }}
configMap:
name: {{ .Values.global.config.existingConfig.name }}
{{- end }}
{{- end }}
{{- if .Values.global.config.externalKubeconfig.enabled }}
- name: kubeconfig-volume
secret:
Expand Down
2 changes: 2 additions & 0 deletions charts/vsphere-cpi/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.global.config.existingConfig.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand Down Expand Up @@ -43,3 +44,4 @@ stringData:
{{- include "common.tplvalues.render" ( dict "value" .Values.global.config.labels "context" $ ) | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/vsphere-cpi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ global:
enabled: false
secretName: ""
keyName: "value"
existingConfig:
enabled: false
type: Secret # or ConfigMap
name: vsphere-cpi
secretsInline: true
# Global properties in this section will be used for all specified vCenters unless overriden in VirtualCenter section.
# global:
Expand Down

0 comments on commit b8a3f85

Please sign in to comment.