Skip to content

Commit

Permalink
Add support for projected volume kubeconfig (#791)
Browse files Browse the repository at this point in the history
* Add support for projected volume kubeconfig
  • Loading branch information
timuthy authored Aug 14, 2023
1 parent b3ede08 commit 70f95e6
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-aws/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 @@ -87,6 +90,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-aws-cert
secret:
Expand All @@ -109,3 +117,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-aws/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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-aws-admission

serviceAccountTokenVolumeProjection:
enabled: false
expirationSeconds: 43200
Expand Down

0 comments on commit 70f95e6

Please sign in to comment.