From 619552ed1fa0eccabda32a77b208413766a8c74b Mon Sep 17 00:00:00 2001 From: Maximiliano Osorio Date: Wed, 4 Sep 2024 15:46:36 -0400 Subject: [PATCH 1/3] fix: improve tests hasura --- charts/mint/Chart.yaml | 2 +- charts/mint/templates/hasura.yaml | 10 +++++++--- charts/mint/templates/post-install-hasura.yaml | 18 +++++++++++++++++- charts/mint/values.yaml | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/charts/mint/Chart.yaml b/charts/mint/Chart.yaml index 65bc43c..3d62d42 100644 --- a/charts/mint/Chart.yaml +++ b/charts/mint/Chart.yaml @@ -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.3.1-alpha.0 +version: 3.3.1-alpha.1 # 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. diff --git a/charts/mint/templates/hasura.yaml b/charts/mint/templates/hasura.yaml index 584d88c..1e84752 100644 --- a/charts/mint/templates/hasura.yaml +++ b/charts/mint/templates/hasura.yaml @@ -75,6 +75,8 @@ spec: secretKeyRef: name: {{ include "mint.prefix" . }}-hasura-secrets key: jwt_secret + - name: DB_HOST + value: {{ include "mint.prefix" $ }}-hasura ports: - name: http containerPort: 8080 @@ -84,9 +86,11 @@ spec: path: / port: http readinessProbe: - httpGet: - path: / - port: http + 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 }} diff --git a/charts/mint/templates/post-install-hasura.yaml b/charts/mint/templates/post-install-hasura.yaml index ac0c5d7..97cb0db 100644 --- a/charts/mint/templates/post-install-hasura.yaml +++ b/charts/mint/templates/post-install-hasura.yaml @@ -20,10 +20,26 @@ spec: helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" spec: restartPolicy: Never + initContainers: + - name: wait-for-db + image: busybox + 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"] - args: ["-c", "env && hasura migrate apply && hasura metadata apply && hasura seeds apply"] + args: ["-c", "env && pushd /hasura && hasura migrate apply && hasura metadata apply && hasura seeds apply"] {{- with .Values.components.hasura }} image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}" resources: diff --git a/charts/mint/values.yaml b/charts/mint/values.yaml index 80ee5b3..2b3f9a6 100644 --- a/charts/mint/values.yaml +++ b/charts/mint/values.yaml @@ -158,7 +158,7 @@ components: enabled: true image: repository: mintproject/graphql-engine - tag: 0fc7ce2a5098d2e86f1280f6fa70acfc816a531d + tag: 305c0dbeba1878eafe348f21fc300fbfc017d9dc pullPolicy: IfNotPresent resources: {} environment: From b0cd3836accbf8a8a10d99b14be7b1263debcd83 Mon Sep 17 00:00:00 2001 From: Maximiliano Osorio Date: Wed, 4 Sep 2024 15:49:39 -0400 Subject: [PATCH 2/3] missing space --- charts/mint/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/mint/values.yaml b/charts/mint/values.yaml index 2b3f9a6..46f817d 100644 --- a/charts/mint/values.yaml +++ b/charts/mint/values.yaml @@ -293,7 +293,7 @@ components: wings_storage: "" wings_dot_path: "" wings_ont_url: "" - #tapis properties + # tapis properties username: "" basePath: "" From 013811babbca9dbb7a6513c5e6c74ec0e7c1caa1 Mon Sep 17 00:00:00 2001 From: Maximiliano Osorio Date: Wed, 4 Sep 2024 16:01:07 -0400 Subject: [PATCH 3/3] add: resources limits --- charts/mint/templates/post-install-hasura.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/charts/mint/templates/post-install-hasura.yaml b/charts/mint/templates/post-install-hasura.yaml index 97cb0db..b79a687 100644 --- a/charts/mint/templates/post-install-hasura.yaml +++ b/charts/mint/templates/post-install-hasura.yaml @@ -23,6 +23,13 @@ spec: initContainers: - name: wait-for-db image: busybox + 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 @@ -36,6 +43,7 @@ spec: secretKeyRef: name: {{ include "mint.prefix" . }}-hasura-secrets key: username + containers: - name: post-install-hasura command: ["/bin/bash"]