Skip to content

Commit

Permalink
Add support for projected volume kubeconfig (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
ialidzhikov authored Oct 18, 2023
1 parent e016eb3 commit 0d8dbbc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions charts/admission/charts/runtime/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ spec:
{{- if .Values.global.kubeconfig }}
- --kubeconfig=/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 @@ -88,6 +91,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: tls
secret:
Expand All @@ -110,3 +118,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 }}
4 changes: 4 additions & 0 deletions charts/admission/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ global:
useObjectSelector: true
# 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-registry-cache-admission
serviceAccountTokenVolumeProjection:
enabled: false
expirationSeconds: 43200
Expand Down

0 comments on commit 0d8dbbc

Please sign in to comment.