Skip to content
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
2 changes: 1 addition & 1 deletion charts/mint/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 3.4.6-pre3
version: 3.4.6-pre4
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion charts/mint/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MINT

![Version: 3.4.6-pre3](https://img.shields.io/badge/Version-3.4.6--pre3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.3](https://img.shields.io/badge/AppVersion-1.16.3-informational?style=flat-square)
![Version: 3.4.6-pre4](https://img.shields.io/badge/Version-3.4.6--pre4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.3](https://img.shields.io/badge/AppVersion-1.16.3-informational?style=flat-square)

A Helm chart for MINT

Expand Down
171 changes: 108 additions & 63 deletions charts/mint/templates/hasura.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
{{ if .Values.components.hasura.enabled -}}
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -84,6 +83,96 @@ spec:
port: http
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "mint.prefix" . }}-hasura-db
namespace: {{ .Release.Namespace }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
- name: postgresql
port: 5432
targetPort: 5432
protocol: TCP
selector:
app: {{ include "mint.prefix" . }}-hasura-db
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "mint.prefix" . }}-hasura-db
namespace: {{ .Release.Namespace }}
spec:
serviceName: {{ include "mint.prefix" . }}-hasura-db
replicas: 1
selector:
matchLabels:
app: {{ include "mint.prefix" . }}-hasura-db
template:
metadata:
labels:
app: {{ include "mint.prefix" . }}-hasura-db
spec:
containers:
- name: postgresql
{{- if .Values.arm_support }}
{{- with .Values.components.hasura_db }}
image: "{{ .arm_image.repository }}:{{ .arm_image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .arm_image.pullPolicy }}
resources:
{{- toYaml .resources | nindent 12 }}
{{- end }}
{{- else }}
{{- with .Values.components.hasura_db }}
image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .image.pullPolicy }}
resources:
{{- toYaml .resources | nindent 12 }}
{{- end }}
{{- end }}
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: password
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: username
ports:
- containerPort: 5432
name: postgresql
readinessProbe:
exec:
command:
- pg_isready
- -U
- {{ .Values.secrets.database.hasura.username }}
initialDelaySeconds: 100
periodSeconds: 10
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
{{- if .Values.components.hasura_db.persistence.subPath }}
subPath: {{ .Values.components.hasura_db.persistence.subPath }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
{{- if .Values.components.hasura_db.persistence.storageClass }}
storageClassName: {{ .Values.components.hasura_db.persistence.storageClass }}
{{- end }}
resources:
requests:
storage: {{ .Values.components.hasura_db.persistence.size | default "10Gi" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -105,6 +194,18 @@ spec:
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
# Add init container to wait for database
initContainers:
- name: wait-for-db
image: postgres:13-alpine
command: ['sh', '-c',
'until pg_isready -h {{ include "mint.prefix" . }}-hasura-db -U $POSTGRES_USER; do echo waiting for database; sleep 2; done;']
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: username
containers:
- name: hasura
{{- with .Values.components.hasura }}
Expand Down Expand Up @@ -143,7 +244,7 @@ spec:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: admin_secret
- name: DB_HOST
value: {{ include "mint.prefix" $ }}-hasura
value: {{ include "mint.prefix" . }}-hasura-db
ports:
- name: http
containerPort: 8080
Expand All @@ -155,64 +256,8 @@ spec:
readinessProbe:
exec:
command:
- /bin/sh
- -c
- pg_isready -h localhost -p 5432
- name: hasura-db
#if the values.arm_support is true, then use the arm_image, otherwise use the image
{{- if .Values.arm_support }}
{{- with .Values.components.hasura_db }}
image: "{{ .arm_image.repository }}:{{ .arm_image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .arm_image.pullPolicy }}
resources:
{{- toYaml .resources | nindent 12 }}
{{- end }}
{{- else }}
{{- with .Values.components.hasura_db }}
image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .image.pullPolicy }}
resources:
{{- toYaml .resources | nindent 12 }}
{{- end }}
{{- end }}
volumeMounts:
{{ if .Values.components.hasura_db.persistence.subPath }}
- mountPath: /var/lib/postgresql/data
name: hasura-db
subPath: {{ .Values.components.hasura_db.persistence.subPath }}
{{ else }}
- mountPath: /var/lib/postgresql/data
name: hasura-db
{{ end }}
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: password
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: username
readinessProbe:
exec:
command:
- pg_isready
- -U
- {{ .Values.secrets.database.hasura.username }}
initialDelaySeconds: 100
periodSeconds: 10
volumes:
- name: hasura-db
{{- if .Values.components.hasura_db.persistence.enabled }}
persistentVolumeClaim:
{{- if .Values.components.hasura_db.persistence.existingClaim }}
claimName: {{ .Values.components.hasura_db.persistence.existingClaim }}
{{- else }}
claimName: {{ include "mint.prefix" . }}-hasura-db
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{end}}
- pg_isready
- -h
- {{ include "mint.prefix" . }}-hasura-db
- -U
- {{ .Values.secrets.database.hasura.username | default "mint" }}
24 changes: 9 additions & 15 deletions charts/mint/templates/post-install-hasura.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,22 @@ spec:
restartPolicy: Never
initContainers:
- name: wait-for-db
image: busybox
image: postgres:13-alpine
command: ['sh', '-c',
'until pg_isready -h {{ include "mint.prefix" . }}-hasura-db -U $POSTGRES_USER; do echo waiting for database; sleep 2; done;']
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: username
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 110m
memory: 110Mi
command: ['sh', '-c', 'until nc -z ${DB_HOST} 5432; do echo waiting for db; sleep 2; done;']
env:
- name: DB_HOST
value: {{ include "mint.prefix" $ }}-hasura
- name: DB_PORT
value: "5432"
- name: DB_NAME
value: ALL
- name: DB_USER
valueFrom:
secretKeyRef:
name: {{ include "mint.prefix" . }}-hasura-secrets
key: username

containers:
- name: post-install-hasura
command: ["/bin/bash"]
Expand Down
2 changes: 1 addition & 1 deletion charts/mint/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type: Opaque
data:
username: {{ .Values.secrets.database.hasura.username | default "mint" | b64enc }}
password: {{ .Values.secrets.database.hasura.password | default "mint" | b64enc }}
database_url: {{ printf "postgres://%s:%s@localhost/%s" .Values.secrets.database.hasura.username $.Values.secrets.database.hasura.password .Values.secrets.database.hasura.database | b64enc | quote }}
database_url: {{ printf "postgres://%s:%s@%s-hasura-db/%s" .Values.secrets.database.hasura.username .Values.secrets.database.hasura.password (include "mint.prefix" .) .Values.secrets.database.hasura.username | b64enc }}
jwt_secret: {{ .Values.secrets.hasura.jwt_secret | b64enc }}
admin_secret: {{ .Values.secrets.hasura.admin_secret | b64enc }}

Expand Down
Loading