Skip to content

Commit 35ea158

Browse files
committed
Added azure support
1 parent a61b2af commit 35ea158

11 files changed

Lines changed: 124 additions & 12 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11

22
.idea/
3-
.charts/
3+
.charts/
4+
values_testing.yaml
5+
values_testing_*

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
Helm Chart for DIffgram
33

44
# Pre-requisites
5+
### Setting Up the Docker Registry Key:
6+
7+
To install the helm chart you will need to receive a GCR key with the permissions from
8+
the Diffgram team to fetch our images.
9+
10+
Please Contact us if you want to get one here: https://diffgram.com/contact
11+
12+
Once you have your GCR Key please set it in the `values.yaml` file, specifically inside the
13+
key `imagePullCredentials.gcrCredentials`.
14+
15+
16+
```
17+
imagePullCredentials:
18+
# The service account with permissions to pull from the GCR Repository. [Should be Provided by Diffgram Team.]
19+
gcrCredentials: <YOUR KEY GOES HERE>
20+
```
21+
22+
523

624
### TLS Ceritificates
725
1. If you want to have TLS connections, please make sure you have a domain available and access to the name servers so you can modify the records to point to the IP addresses of the ingress.
@@ -33,16 +51,20 @@ Future versions will provide a repo to download the chart without cloning from g
3351
When deploying this chart there are 5 main components to be aware of:
3452

3553
**1. default-service:** This is the service in charge for most of the API calls and data management. Both for the SDK and for the Frontend UI.
54+
3655
**2. walrus-service:** This is a long running service for CPU intensive processing. Things like video, splitting, huge files copying and other maintainance tasks are performed on this service
56+
3757
**3. frontend-service:** Static VueJS frontend for accessing Diffgram.
58+
3859
**4. db-service:** A PostgresSQL database, we usually recommend linking an external managed cloud service like AWS RDS, GCP SQL Service, or Azure Managed SQL Service.
60+
3961
**5. ingress:** A Nginx ingress controller for accessing all the services. This is the entry point and router to all the above services.
4062

4163

4264
# Configurations:
4365
The following are some of the most important configurations of the values.yaml in the helm chart. Please feel free to contact us if you have any questions on any of the configurations.
4466
## 4.1 Database Settings
45-
**1. dbSettings.dbProvider:** Set this to “rds”
67+
**1. dbSettings.dbProvider:** Set this to “rds”, "azure", or "local" depending on your DB managed service.
4668

4769
**2. dbSettings.rdsEndpoint:** Set this to your RDS instance endpoint, so diffgram can use it as the database.
4870

templates/default/deployment.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,21 @@ spec:
3535
{{ if eq .Values.dbSettings.dbProvider "rds"}}
3636
command: ['sh', '-c', 'until pg_isready -h postgres-rds-service -p 5432; do echo waiting for database; sleep 2; done;']
3737
{{ end }}
38+
{{ if eq .Values.dbSettings.dbProvider "azure"}}
39+
command: ['sh', '-c', 'until pg_isready -h postgres-azure-service -p 5432; do echo waiting for database; sleep 2; done;']
40+
{{ end }}
3841
- name: run-migrations
3942
imagePullPolicy: Always
40-
image: gcr.io/diffgram-001/default:{{ .Values.diffgramVersion }}
43+
image: gcr.io/diffgram-enterprise/default:{{ .Values.diffgramVersion }}
4144
envFrom:
4245
- configMapRef:
4346
name: diffgram-default-configmap
4447
- secretRef:
4548
name: diffgram-default-secrets
4649
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"]
50+
4751
containers:
48-
- image: gcr.io/diffgram-001/default:{{ .Values.diffgramVersion }}
52+
- image: gcr.io/diffgram-enterprise/default:{{ .Values.diffgramVersion }}
4953
imagePullPolicy: Always
5054
name: diffgram-default
5155
ports:

templates/default/secrets.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ stringData:
1717
{{ if eq .Values.dbSettings.dbProvider "rds"}}
1818
DATABASE_URL: "postgresql+psycopg2://{{ .Values.dbSettings.dbUser }}:{{ .Values.dbSettings.dbPassword }}@postgres-rds-service/{{ .Values.dbSettings.dbName }}"
1919
{{ end }}
20+
{{ if eq .Values.dbSettings.dbProvider "azure"}}
21+
DATABASE_URL: "postgresql+psycopg2://{{ .Values.dbSettings.dbUser }}:{{ .Values.dbSettings.dbPassword }}@postgres-azure-service/{{ .Values.dbSettings.dbName }}"
22+
{{ end }}
2023
USER_PASSWORDS_SECRET: {{ .Values.diffgramSecrets.USER_PASSWORDS_SECRET }}

templates/frontend/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
imagePullSecrets:
1919
- name: diffgramsecret
2020
containers:
21-
- image: gcr.io/diffgram-001/frontend:{{ .Values.diffgramVersion }}
21+
- image: gcr.io/diffgram-enterprise/frontend:{{ .Values.diffgramVersion }}
2222
imagePullPolicy: Always
2323
name: frontend
2424
resources:
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: "{{ .Release.Name }}"
5+
labels:
6+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
7+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
8+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
9+
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
10+
annotations:
11+
# This is what defines this resource as a hook. Without this line, the
12+
# job is considered part of the release.
13+
"helm.sh/hook": pre-upgrade
14+
"helm.sh/hook-weight": "-5"
15+
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
16+
spec:
17+
template:
18+
metadata:
19+
name: "{{ .Release.Name }}"
20+
labels:
21+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
22+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
23+
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
24+
spec:
25+
restartPolicy: Never
26+
imagePullSecrets:
27+
- name: diffgramsecret
28+
volumes:
29+
- name: service-account-credentials-volume
30+
secret:
31+
secretName: gcp-service-account-credentials
32+
items:
33+
- key: sa_json
34+
path: sa_credentials.json
35+
containers:
36+
- image: gcr.io/diffgram-enterprise/default:{{ .Values.diffgramVersion }}
37+
imagePullPolicy: Always
38+
name: pre-upgrade-alembic-hook
39+
volumeMounts:
40+
- name: service-account-credentials-volume
41+
mountPath: /etc/gcp
42+
readOnly: true
43+
envFrom:
44+
- configMapRef:
45+
name: diffgram-default-configmap
46+
- secretRef:
47+
name: diffgram-default-secrets
48+
initContainers:
49+
- name: check-db-ready
50+
image: postgres:9.6.5
51+
{{ if eq .Values.dbSettings.dbProvider "local"}}
52+
command: ['sh', '-c',
53+
'until pg_isready -h diffgram-postgres -p 5432;
54+
do echo waiting for database; sleep 2; done;']
55+
{{ end }}
56+
{{ if eq .Values.dbSettings.dbProvider "rds"}}
57+
command: ['sh', '-c', 'until pg_isready -h postgres-rds-service -p 5432; do echo waiting for database; sleep 2; done;']
58+
{{ end }}
59+
{{ if eq .Values.dbSettings.dbProvider "azure"}}
60+
command: ['sh', '-c', 'until pg_isready -h postgres-azure-service -p 5432; do echo waiting for database; sleep 2; done;']
61+
{{ end }}
62+
# The actual migrations command
63+
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"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{ if eq .Values.dbSettings.dbProvider "azure"}}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
app: postgres-azure-service
7+
name: postgres-azure-service
8+
spec:
9+
externalName: {{ .Values.dbSettings.azureSqlEndpoint }}
10+
selector:
11+
app: postgres-azure-service
12+
type: ExternalName
13+
status:
14+
loadBalancer: {}
15+
{{ end }}

templates/secret-gcr.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ data:
33
.dockerconfigjson: {{ .Values.imagePullCredentials.gcrCredentials }}
44
kind: Secret
55
metadata:
6-
creationTimestamp: "2021-01-20T22:54:29Z"
76
managedFields:
87
- apiVersion: v1
98
fieldsType: FieldsV1
@@ -14,9 +13,6 @@ metadata:
1413
f:type: {}
1514
manager: kubectl
1615
operation: Update
17-
time: "2021-01-20T22:54:29Z"
1816
name: diffgramsecret
1917
namespace: default
20-
resourceVersion: "2073"
21-
uid: 7c99cb08-5576-4fa3-b6f9-d8d11d76d32c
2218
type: kubernetes.io/dockerconfigjson

templates/walrus/deployment.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ spec:
3939
'until pg_isready -h postgres-rds-service -p 5432;
4040
do echo waiting for database; sleep 2; done;']
4141
{{ end }}
42+
{{ if eq .Values.dbSettings.dbProvider "azure"}}
43+
command: ['sh', '-c',
44+
'until pg_isready -h postgres-azure-service -p 5432;
45+
do echo waiting for database; sleep 2; done;']
46+
{{ end }}
4247
containers:
43-
- image: gcr.io/diffgram-001/walrus:{{ .Values.diffgramVersion }}
48+
- image: gcr.io/diffgram-enterprise/walrus:{{ .Values.diffgramVersion }}
4449
imagePullPolicy: Always
4550
name: diffgram-walrus
4651
ports:
@@ -49,8 +54,6 @@ spec:
4954
- name: service-account-credentials-volume
5055
mountPath: /etc/gcp
5156
readOnly: true
52-
- name: empty-dir
53-
mountPath: /
5457

5558
envFrom:
5659
- configMapRef:

templates/walrus/secrets.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ stringData:
1717
{{ if eq .Values.dbSettings.dbProvider "rds"}}
1818
DATABASE_URL: "postgresql+psycopg2://{{ .Values.dbSettings.dbUser }}:{{ .Values.dbSettings.dbPassword }}@postgres-rds-service/{{ .Values.dbSettings.dbName }}"
1919
{{ end }}
20+
{{ if eq .Values.dbSettings.dbProvider "azure"}}
21+
DATABASE_URL: "postgresql+psycopg2://{{ .Values.dbSettings.dbUser }}:{{ .Values.dbSettings.dbPassword }}@postgres-azure-service/{{ .Values.dbSettings.dbName }}"
22+
{{ end }}
2023
USER_PASSWORDS_SECRET: {{ .Values.diffgramSecrets.USER_PASSWORDS_SECRET }}

0 commit comments

Comments
 (0)