Skip to content

Commit

Permalink
Add support for projected volume kubeconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
timuthy committed Aug 14, 2023
1 parent 6a22ae8 commit 3032b48
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ spec:
{{- if .Values.global.kubeconfig }}
- --kubeconfig=/etc/gardener-extension-validator-vsphere/kubeconfig/kubeconfig
{{- end }}
{{- if .Values.global.projectedKubeconfig }}
- --kubeconfig={{ required ".Values.global.projectedKubeconfig.baseMountPath is required" .Values.global.projectedKubeconfig.baseMountPath }}/kubeconfig
{{- end }}
{{- if .Values.global.metricsPort }}
- --metrics-bind-address=:{{ .Values.global.metricsPort }}
{{- end }}
Expand Down Expand Up @@ -84,6 +87,11 @@ spec:
mountPath: /var/run/secrets/projected/serviceaccount
readOnly: true
{{- end }}
{{- if .Values.global.projectedKubeconfig }}
- name: kubeconfig
mountPath: {{ required ".Values.global.projectedKubeconfig.baseMountPath is required" .Values.global.projectedKubeconfig.baseMountPath }}
readOnly: true
{{- end }}
volumes:
- name: gardener-extension-validator-vsphere-cert
secret:
Expand All @@ -106,3 +114,21 @@ spec:
audience: {{ .Values.global.serviceAccountTokenVolumeProjection.audience }}
{{- end }}
{{- end }}
{{- if .Values.global.projectedKubeconfig }}
- name: kubeconfig
projected:
defaultMode: 420
sources:
- secret:
items:
- key: kubeconfig
path: kubeconfig
name: {{ required ".Values.global.projectedKubeconfig.genericKubeconfigSecretName is required" .Values.global.projectedKubeconfig.genericKubeconfigSecretName }}
optional: false
- secret:
items:
- key: token
path: token
name: {{ required ".Values.global.projectedKubeconfig.tokenSecretName is required" .Values.global.projectedKubeconfig.tokenSecretName }}
optional: false
{{- end }}
5 changes: 5 additions & 0 deletions charts/gardener-extension-validator-vsphere/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ global:
# Kubeconfig to the target cluster. In-cluster configuration will be used if not specified.
kubeconfig:

# projectedKubeconfig:
# baseMountPath: /var/run/secrets/gardener.cloud
# genericKubeconfigSecretName: generic-token-kubeconfig
# tokenSecretName: access-vsphere-admission

serviceAccountTokenVolumeProjection:
enabled: false
expirationSeconds: 43200
Expand Down

0 comments on commit 3032b48

Please sign in to comment.