Skip to content

Commit

Permalink
Fixing Helm Chart and consistency (supertokens#20)
Browse files Browse the repository at this point in the history
* Remove empty line output in Service

* Secret requires base64 encoding, or use `stringData` and let K8s handle that.

* Use `with` to change scope

* Don't render environments with no defaults at all.

* Consistent indention of with blocks.
  • Loading branch information
LukasKnuth authored Apr 27, 2023
1 parent 3158fae commit d67aa65
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
34 changes: 19 additions & 15 deletions helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,42 @@ spec:
{{- include "supertokens.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- if .Values.podAnnotations }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "supertokens.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.imagePullSecrets }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "supertokens.serviceAccountName" . }}
{{- if .Values.podSecurityContext }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.securityContext }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- toYaml . | nindent 12 }}
# {{ else }}
# securityContext:
# readOnlyRootFilesystem: true
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if .Values.database.schema }}
- name: "POSTGRESQL_TABLE_SCHEMA"
value: {{ quote .Values.database.schema }}
{{- end }}
{{- if .Values.database.connectionPoolSize }}
- name: "POSTGRESQL_CONNECTION_POOL_SIZE"
value: {{ quote .Values.database.connectionPoolSize }}
{{- end }}
- name: "SUPERTOKENS_PORT"
value: {{ quote .Values.service.port }}
- name: "ACCESS_TOKEN_VALIDITY"
Expand Down Expand Up @@ -80,19 +84,19 @@ spec:
protocol: TCP
livenessProbe: {{ .Values.livenessProbe | toYaml | nindent 12 }}
readinessProbe: {{ .Values.readinessProbe | toYaml | nindent 12 }}
{{ if .Values.resources }}
{{- with .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- end -}}
{{- if .Values.nodeSelector }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end -}}
{{- if .Values.affinity }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end -}}
{{- if .Values.tolerations }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end -}}
{{- end }}
2 changes: 1 addition & 1 deletion helm-chart/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
{{ include "supertokens.labels" . | indent 4}}
type: Opaque
data:
stringData:
POSTGRESQL_DATABASE_NAME: {{ quote .Values.database.name }}
POSTGRESQL_PORT: {{ quote .Values.database.port }}
POSTGRESQL_HOST: {{ quote .Values.database.host }}
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
{{ if .Values.service.nodePort -}}
{{- if .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
protocol: TCP
Expand Down

0 comments on commit d67aa65

Please sign in to comment.