Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

charts/operator: allow disabling automatic token mount #1858

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/victoria-metrics-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Next release

- updated common dependency 0.0.32 -> 0.0.33
- add an option to mount `ServiceAccount` token manually for security hardening reasons.

## 0.39.1

Expand Down
30 changes: 30 additions & 0 deletions charts/victoria-metrics-operator/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,36 @@ admissionWebhooks:

{{ include "chart.helmDocs" . }}

## Disabling automatic ServiceAccount token mount

There are cases when it is required to disable automatic ServiceAccount token mount due to hardening reasons. To disable it, set the following values:
```
serviceAccount:
automountServiceAccountToken: false

extraVolumes:
- name: operator
projected:
sources:
- downwardAPI:
items:
- fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
- configMap:
name: kube-root-ca.crt
- serviceAccountToken:
expirationSeconds: 7200
path: token

extraVolumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: operator
```

This configuration disables the automatic ServiceAccount token mount and mounts the token explicitly.

## Parameters

The following tables lists the configurable parameters of the chart and their default values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
{{- $_ := unset $ctx "extraLabels" }}
spec:
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- if .Values.podSecurityContext.enabled }}
securityContext: {{ include "vm.securityContext" (dict "securityContext" .Values.podSecurityContext "helm" .) | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ metadata:
{{- with .Values.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end }}
{{- if and .Values.crds.enabled .Values.crds.cleanup.enabled }}
---
Expand Down
3 changes: 3 additions & 0 deletions charts/victoria-metrics-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ serviceAccount:
# -- The name of the service account to use. If not set and create is true, a name is generated using the fullname template
name: ""

# -- Whether to automount the service account token. Note that token needs to be mounted manually if this is disabled.
automountServiceAccountToken: true

service:
# -- Service annotations
annotations: {}
Expand Down
Loading