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

pod SA, disable automount SA tokens #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions charts/frontend/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,12 @@ imagePullSecrets:
- name: {{ .Release.Name }}-registry
{{- end }}
{{- end }}
{{- end }}

{{- define "frontend.serviceAccountName" }}
{{- if .Values.serviceAccount.name }}
{{- .Values.serviceAccount.name }}
{{- else }}
{{- .Release.Name }}-sa
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions charts/frontend/templates/backup-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ spec:
{{- end }}
{{- end }}
restartPolicy: Never
serviceAccountName: {{ include "frontend.serviceAccountName" . }}
volumes:
- name: shared-data
emptyDir:
Expand Down
2 changes: 1 addition & 1 deletion charts/frontend/templates/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
resources:
{{- .Values.signalsciences.resources | toYaml | nindent 10 }}
{{- end }}

serviceAccountName: {{ include "frontend.serviceAccountName" . }}
volumes:
- name: nginx-conf
configMap:
Expand Down
8 changes: 8 additions & 0 deletions charts/frontend/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Release.Name }}-sa
labels:
{{- include "frontend.release_labels" . | nindent 4 }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- include "frontend.imagePullSecrets" . }}
1 change: 1 addition & 0 deletions charts/frontend/templates/services-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ spec:
{{- $.Values.serviceDefaults.resources | toYaml | nindent 14 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "frontend.serviceAccountName" $ }}
volumes:
{{- if $service.mounts }}
{{- range $index, $mountName := $service.mounts -}}
Expand Down
1 change: 1 addition & 0 deletions charts/frontend/templates/services-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ spec:
{{ else -}}
{{ $.Values.serviceDefaults.resources | toYaml | nindent 10 }}
{{- end }}
serviceAccountName: {{ include "frontend.serviceAccountName" $ }}
volumes:
{{ if $service.mounts }}
{{- range $index, $mountName := $service.mounts -}}
Expand Down
1 change: 1 addition & 0 deletions charts/frontend/templates/varnish-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ spec:
mountPath: "/etc/varnish/secret"
subPath: control_key
readOnly: true
serviceAccountName: {{ include "frontend.serviceAccountName" . }}
volumes:
- name: varnish-vcl
configMap:
Expand Down
8 changes: 8 additions & 0 deletions charts/frontend/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
"branchName": { "type": "string" },
"imagePullSecrets": { "type": "array" },
"imagePullSecret": { "type": "string" },
"serviceAccount": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"automountServiceAccountToken": { "type": "boolean" }
}
},
"app": { "type": "string" },
"exposeDomains": {
"type": "object",
Expand Down
23 changes: 22 additions & 1 deletion charts/frontend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ imagePullSecrets: []
# Custom imagePullSecret for the containers. Base64 encoded. This will create a secret and append it to the imagePullSecrets.
imagePullSecret: ""

serviceAccount:
# Default value: [Release.Name]-sa
name: ""
# Mount service account token to the containers.
automountServiceAccountToken: false

# The app label added to our Kubernetes resources.
app: frontend

Expand Down Expand Up @@ -400,6 +406,8 @@ mariadb:
operator: NotIn
values:
- static-ip
serviceAccount:
create: true
enableServiceLinks: false

varnish:
Expand Down Expand Up @@ -466,10 +474,17 @@ elasticsearch:
- name: xpack.security.enabled
value: "false"

# Disable service links that cause a slow startup.
enableServiceLinks: false

rbac:
create: true
automountToken: false

# This value should be slightly less than 50% of the requested memory.
esJavaOpts: -Xmx220m -Xms220m
xpack:
enabled: false
elasticenabled: false
volumeClaimTemplate:
resources:
requests:
Expand Down Expand Up @@ -517,7 +532,11 @@ postgresql:
# Use a low default to prevent unnecessary storage use.
persistence:
size: 1Gi
serviceAccount:
create: true
automountServiceAccountToken: false

# https://github.com/wunderio/charts/blob/master/rabbitmq/values.yaml
rabbitmq:
enabled: false

Expand Down Expand Up @@ -582,4 +601,6 @@ redis:
requests:
cpu: 50m
memory: 256Mi
serviceAccount:
automountServiceAccountToken: false