From 2c85afc95fc51f913ab40825cd8c8449e1191124 Mon Sep 17 00:00:00 2001 From: Pablo Date: Tue, 13 Apr 2021 12:59:45 -0600 Subject: [PATCH 1/2] WIP Initial refactoring of deployments --- templates/default/deployment.yaml | 7 +++++++ templates/frontend/deployment.yaml | 7 +++++++ templates/hooks/database_pre_install.yaml | 7 +++++++ values.yaml | 4 ++++ 4 files changed, 25 insertions(+) diff --git a/templates/default/deployment.yaml b/templates/default/deployment.yaml index cd59d29..ed73e16 100644 --- a/templates/default/deployment.yaml +++ b/templates/default/deployment.yaml @@ -15,8 +15,10 @@ spec: labels: app: diffgram-default spec: + {{ if eq .Values.diffgramEdition "enterprise"}} imagePullSecrets: - name: diffgramsecret + {{ end }} volumes: - name: service-account-credentials-volume secret: @@ -39,7 +41,12 @@ spec: command: ['sh', '-c', 'until pg_isready -h postgres-azure-service -p 5432; do echo waiting for database; sleep 2; done;'] {{ end }} containers: + {{ if eq .Values.diffgramEdition "enterprise"}} - image: gcr.io/diffgram-enterprise/default:{{ .Values.diffgramVersion }} + {{ end }} + {{ if eq .Values.diffgramEdition "opencore"}} + - image: gcr.io/diffgram-open-core/default:{{ .Values.diffgramVersion }} + {{ end }} imagePullPolicy: Always name: diffgram-default ports: diff --git a/templates/frontend/deployment.yaml b/templates/frontend/deployment.yaml index e707201..92ac2c5 100644 --- a/templates/frontend/deployment.yaml +++ b/templates/frontend/deployment.yaml @@ -15,10 +15,17 @@ spec: labels: app: frontend spec: + {{ if eq .Values.diffgramEdition "enterprise"}} imagePullSecrets: - name: diffgramsecret + {{ end }} containers: + {{ if eq .Values.diffgramEdition "enterprise"}} - image: gcr.io/diffgram-enterprise/frontend:{{ .Values.diffgramVersion }} + {{ end }} + {{ if eq .Values.diffgramEdition "opencore"}} + - image: gcr.io/diffgram-open-core/frontend:{{ .Values.diffgramVersion }} + {{ end }} imagePullPolicy: Always name: frontend resources: diff --git a/templates/hooks/database_pre_install.yaml b/templates/hooks/database_pre_install.yaml index 5048166..20e8637 100644 --- a/templates/hooks/database_pre_install.yaml +++ b/templates/hooks/database_pre_install.yaml @@ -23,8 +23,10 @@ spec: helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" spec: restartPolicy: Never + {{ if eq .Values.diffgramEdition "enterprise"}} imagePullSecrets: - name: db-migrations-pull-secret + { {end }} volumes: - name: service-account-credentials-volume-hook secret: @@ -33,7 +35,12 @@ spec: - key: sa_json path: sa_credentials.json containers: + {{ if eq .Values.diffgramEdition "enterprise"}} - image: gcr.io/diffgram-enterprise/default:{{ .Values.diffgramVersion }} + {{ end }} + {{ if eq .Values.diffgramEdition "opencore"}} + - image: gcr.io/diffgram-open-core/default:{{ .Values.diffgramVersion }} + {{ end }} imagePullPolicy: Always name: pre-upgrade-alembic-hook volumeMounts: diff --git a/values.yaml b/values.yaml index 5fbb952..3f6febb 100644 --- a/values.yaml +++ b/values.yaml @@ -5,6 +5,10 @@ # The Diffgram Version. Whenever a new update arrives, this will be changed. diffgramVersion: latest +# Either 'opencore' or 'enterprise'. Please note that selecting 'enterprise' +# requires that you also set imagePullCredentials.gcrCredentials. +diffgramEdition: opencore + # Set this to your public domain where you want diffgram to be. diffgramDomain: example.com From 67745a91b8ef2af33bd98a3c394bac2322c40fc5 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 10 May 2021 12:47:21 -0600 Subject: [PATCH 2/2] Added opencore support --- README.md | 11 +++++++++-- templates/hooks/database_pre_install.yaml | 4 ++-- templates/hooks/database_pre_upgrade.yaml | 9 ++++++++- templates/walrus/deployment.yaml | 7 +++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 63c713a..9ae7d31 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,16 @@ Helm Chart for DIffgram # Pre-requisites -### Setting Up the Docker Registry Key: +### Opencore or Enterprise -To install the helm chart you will need to receive a GCR key with the permissions from +Make sure you set the value of `diffgramEdition` in the `values.yaml` to either `opencore` +or `enterprise`. + +If you set the `diffgramEdition` to `enterprise` you will have to provide the GCR credentials +Key (Provided by the Diffgram Team). And set the value on `imagePullCredentials.gcrCredentials` value inside the `values.yaml` file. +### Setting Up the Docker Registry Key (Enterprise Only): + +To install the helm chart with the Enterprise Edition of Diffgram you will need to receive a GCR key with the permissions from the Diffgram team to fetch our images. Please Contact us if you want to get one here: https://diffgram.com/contact diff --git a/templates/hooks/database_pre_install.yaml b/templates/hooks/database_pre_install.yaml index 20e8637..5b3f508 100644 --- a/templates/hooks/database_pre_install.yaml +++ b/templates/hooks/database_pre_install.yaml @@ -26,7 +26,7 @@ spec: {{ if eq .Values.diffgramEdition "enterprise"}} imagePullSecrets: - name: db-migrations-pull-secret - { {end }} + {{ end }} volumes: - name: service-account-credentials-volume-hook secret: @@ -53,4 +53,4 @@ spec: - secretRef: name: db-migrations-secret # The actual migrations command - command: ["sh","-c", "cd shared; export PYTHONPATH=/app; pip install sqlalchemy-utils==0.36.6;python /app/testing_and_other/create_database.py; alembic upgrade head"] + command: ["sh","-c", "cd shared; export PYTHONPATH=/app; pip install sqlalchemy-utils==0.36.6;python /app/play_and_scripts/scripts/create_database.py; alembic upgrade head"] diff --git a/templates/hooks/database_pre_upgrade.yaml b/templates/hooks/database_pre_upgrade.yaml index 0877894..6251f01 100644 --- a/templates/hooks/database_pre_upgrade.yaml +++ b/templates/hooks/database_pre_upgrade.yaml @@ -23,8 +23,10 @@ spec: helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" spec: restartPolicy: Never + {{ if eq .Values.diffgramEdition "enterprise"}} imagePullSecrets: - name: diffgramsecret + {{ end }} volumes: - name: service-account-credentials-volume-hook secret: @@ -33,7 +35,12 @@ spec: - key: sa_json path: sa_credentials.json containers: + {{ if eq .Values.diffgramEdition "enterprise"}} - image: gcr.io/diffgram-enterprise/default:{{ .Values.diffgramVersion }} + {{ end }} + {{ if eq .Values.diffgramEdition "opencore"}} + - image: gcr.io/diffgram-open-core/default:{{ .Values.diffgramVersion }} + {{ end }} imagePullPolicy: Always name: pre-upgrade-alembic-hook volumeMounts: @@ -46,4 +53,4 @@ spec: - secretRef: name: db-migrations-secret # The actual migrations command - command: ["sh","-c", "cd shared; export PYTHONPATH=/app; pip install sqlalchemy-utils==0.36.6;python /app/testing_and_other/create_database.py;"] \ No newline at end of file + command: ["sh","-c", "cd shared; export PYTHONPATH=/app; pip install sqlalchemy-utils==0.36.6;python /app/play_and_scripts/scripts/create_database.py;"] \ No newline at end of file diff --git a/templates/walrus/deployment.yaml b/templates/walrus/deployment.yaml index ae02322..0a19a22 100644 --- a/templates/walrus/deployment.yaml +++ b/templates/walrus/deployment.yaml @@ -15,8 +15,10 @@ spec: labels: app: diffgram-walrus spec: + {{ if eq .Values.diffgramEdition "enterprise"}} imagePullSecrets: - name: diffgramsecret + {{ end }} volumes: - name: service-account-credentials-volume secret: @@ -45,7 +47,12 @@ spec: do echo waiting for database; sleep 2; done;'] {{ end }} containers: + {{ if eq .Values.diffgramEdition "enterprise"}} - image: gcr.io/diffgram-enterprise/walrus:{{ .Values.diffgramVersion }} + {{ end }} + {{ if eq .Values.diffgramEdition "opencore"}} + - image: gcr.io/diffgram-open-core/walrus:{{ .Values.diffgramVersion }} + {{ end }} imagePullPolicy: Always name: diffgram-walrus ports: