Skip to content

Commit

Permalink
fix(eck-operator): make automountServiceAccountToken configurable
Browse files Browse the repository at this point in the history
Keeps the default behaviour of having automountServiceAccountToken
set to true for ServiceAccount/Statefulset

Signed-off-by: Stefan Caraiman <stefanc.caraiman@gmail.com>
  • Loading branch information
stefan-caraiman committed Apr 6, 2024
1 parent 9a78526 commit 05a23bf
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
29 changes: 29 additions & 0 deletions deploy/eck-operator/profile-disable-automounting-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
automountServiceAccountToken: false

serviceAccount:
automountServiceAccountToken: false

volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: serviceaccount-token
readOnly: true

volumes:
- name: serviceaccount-token
projected:
defaultMode: 0444
sources:
- serviceAccountToken:
expirationSeconds: 3607
path: token
- configMap:
name: kube-root-ca.crt
items:
- key: ca.crt
path: ca.crt
- downwardAPI:
items:
- path: namespace
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
1 change: 1 addition & 0 deletions deploy/eck-operator/templates/service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
---
apiVersion: v1
kind: ServiceAccount
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
metadata:
name: {{ include "eck-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
Expand Down
14 changes: 10 additions & 4 deletions deploy/eck-operator/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
spec:
terminationGracePeriodSeconds: 10
serviceAccountName: {{ include "eck-operator.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
{{- with .Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
Expand Down Expand Up @@ -121,11 +122,16 @@ spec:
- "--tls-cert-file=/tls/tls.crt"
- "--tls-private-key-file=/tls/tls.key"
{{- end }}
{{- if .Values.config.metrics.secureMode.tls.certificateSecret }}
{{- if or .Values.config.metrics.secureMode.tls.certificateSecret .Values.config.metrics.secureMode.volumeMounts }}
volumeMounts:
- mountPath: "/tls"
name: tls-certificate
readOnly: true
{{- with .Values.config.metrics.secureMode.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.config.metrics.secureMode.tls.certificateSecret }}
- mountPath: "/tls"
name: tls-certificate
readOnly: true
{{- end }}
{{- end }}
ports:
- containerPort: {{ $metricsPort }}
Expand Down
7 changes: 7 additions & 0 deletions deploy/eck-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,14 @@ volumes: []
# createClusterScopedResources determines whether cluster-scoped resources (ClusterRoles, ClusterRoleBindings) should be created.
createClusterScopedResources: true

# Automount API credentials for the Service Account into the pod.
automountServiceAccountToken: true

serviceAccount:
# create specifies whether a service account should be created for the operator.
create: true
# Specifies whether a service account should automount API-Credentials
automountServiceAccountToken: true
# annotations to add to the service account
annotations: {}
# name of the service account to use. If not set and create is true, a name is generated using the fullname template.
Expand Down Expand Up @@ -188,6 +193,8 @@ config:
# serviceMonitorNamespaceSelector: {}
# serviceMonitorSelectorNilUsesHelmValues: false
enabled: false
# additional volume mounts for the kube-rbac-proxy container.
volumeMounts: []
tls:
# certificateSecret is the name of the tls secret containing the custom TLS certificate and key for the secure metrics endpoint.
#
Expand Down

0 comments on commit 05a23bf

Please sign in to comment.