From d74176cf4a22f03fb60734d620d7564ee837dafe Mon Sep 17 00:00:00 2001 From: Shreyas Date: Wed, 20 Nov 2024 23:13:55 +0530 Subject: [PATCH] feat: support atlas migration, issueref #56 --- .../templates/graphql-server-deployment.yaml | 12 +++++++++++ charts/guac/values.yaml | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/charts/guac/templates/graphql-server-deployment.yaml b/charts/guac/templates/graphql-server-deployment.yaml index 79afa20..1a51e9e 100644 --- a/charts/guac/templates/graphql-server-deployment.yaml +++ b/charts/guac/templates/graphql-server-deployment.yaml @@ -29,6 +29,18 @@ spec: app.kubernetes.io/component: {{ .Values.guac.graphqlServer.name }} spec: serviceAccountName: {{ .Values.guac.graphqlServer.name }} +{{- if .Values.atlas.enabled }} + initContainers: + - name: {{ .Values.atlas.name }} + {{- if .Values.atlas.image.digest }} + image: "{{ .Values.image.repository | default .Values.guac.guacImage.repository }}@{{ .Values.atlas.image.digest }}" + {{- else }} + image: "{{ .Values.atlas.image.repository | default .Values.guac.guacImage.repository }}:{{ .Values.atlas.image.tag | default .Values.guac.guacImage.tag | default .Chart.AppVersion}}" + {{- end }} + imagePullPolicy: "{{ .Values.atlas.image.pullPolicy }}" + command: +{{ toYaml .Values.atlas.command | indent 10 }} +{{- end }} containers: - name: {{ .Values.guac.graphqlServer.name }} {{- if .Values.guac.guacImage.digest }} diff --git a/charts/guac/values.yaml b/charts/guac/values.yaml index b47e6a3..878af77 100644 --- a/charts/guac/values.yaml +++ b/charts/guac/values.yaml @@ -522,3 +522,24 @@ minio: - accessKey: accessKey secretKey: secretKey policy: readwrite + +atlas: + enabled: true + image: + repository: ghcr.io/guacsec/guac + # if not set appVersion field from Chart.yaml is used + # tag: + # When digest is set to a non-empty value, images will be pulled by digest (regardless of tag value). + digest: "" + pullPolicy: IfNotPresent + + dbAddress: "" + name: atlas-migration + command: + [ + "atlas", + "migrate", + "apply", + "--dir file:///app/migrations", + "--url 'postgress://host:port/dbname?sslmode=false'", + ]