Skip to content

Instantly share code, notes, and snippets.

@bgarcial
Created October 29, 2021 14:00
Show Gist options
  • Save bgarcial/22ac1722a778cc17cc57f05a20e46ad1 to your computer and use it in GitHub Desktop.
Save bgarcial/22ac1722a778cc17cc57f05a20e46ad1 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "postfacto.fullname" . }}
labels:
{{- include "postfacto.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "postfacto.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "postfacto.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "postfacto.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
# initContainers:
# - name: psql-wait
# image: postgres
# env:
# - name: POSTGRESQL_PASSWORD
# valueFrom:
# secretKeyRef:
# name: "{{ .Release.Name }}-postgresql"
# key: postgresql-password
# command: ["sh", "-c", "for i in {1..33}; do sleep 3; if PGPASSWORD=$POSTGRESQL_PASSWORD psql -h {{ .Release.Name }}-postgresql -U {{ .Values.postgresql.postgresqlUsername }}; then exit 0; fi; done; exit 1"]
containers:
- name: {{ .Chart.Name }}
env:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postfacto-ext-postgresql
key: host
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postfacto-ext-postgresql
key: database
- name: POSTGRES_USERNAME
valueFrom:
secretKeyRef:
name: postfacto-ext-postgresql
key: username
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: postfacto-ext-postgresql
key: password
- name: DATABASE_URL
# value: "postgres://{{ .Values.postgresql.postgresqlUsername }}:$(POSTGRESQL_PASSWORD)@{{ .Release.Name }}-postgresql"
value: "postgres://nmbrs@postgresql-nmb-psfc-stag:$(POSTGRESQL_PASSWORD)@postgresql-nmb-psfc-stag.postgres.database.azure.com/postfacto-staging-db"
- name: SECRET_KEY_BASE
value: {{ include "postfacto.secretKey" . }}
- name: DISABLE_SSL_REDIRECT
value: "{{ .Values.disableSSLRedirect }}"
# - name: REDIS_PASSWORD
# valueFrom:
# secretKeyRef:
# name: "{{ .Release.Name }}-redis"
# key: redis-password
# - name: REDIS_URL
# value: "redis://:$(REDIS_PASSWORD)@{{ .Release.Name }}-redis-master"
- name: GOOGLE_OAUTH_CLIENT_ID
value: "{{ .Values.googleOAuthClientId }}"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 3000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment