Skip to content

Commit

Permalink
Merge pull request #289 from timuthy/enhancement.validator-kubeconfig
Browse files Browse the repository at this point in the history
Add support for projected volume kubeconfig
  • Loading branch information
ScheererJ authored Aug 16, 2023
2 parents 92c55b6 + aa839dd commit 13d7454
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 @@ -49,6 +49,9 @@ spec:
{{- if .Values.global.kubeconfig }}
- --kubeconfig=/etc/gardener-extension-admission-calico/kubeconfig/kubeconfig
{{- end }}
{{- if .Values.global.projectedKubeconfig }}
- --kubeconfig={{ required ".Values.global.projectedKubeconfig.baseMountPath is required" .Values.global.projectedKubeconfig.baseMountPath }}/kubeconfig
{{- end }}
- --health-bind-address=:{{ .Values.global.healthPort }}
ports:
- name: webhook-server
Expand Down Expand Up @@ -85,6 +88,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-admission-calico-cert
secret:
Expand All @@ -107,3 +115,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-admission-calico/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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-calico-admission

serviceAccountTokenVolumeProjection:
enabled: false
expirationSeconds: 43200
Expand Down

0 comments on commit 13d7454

Please sign in to comment.