Commit 21e22bc0 authored by Zachary Seguin's avatar Zachary Seguin

Switch to in-cluster postgres and redis

parent 255f4ad5
Pipeline #129 passed with stage
in 25 seconds
dependencies:
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com
version: 0.8.5
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com
version: 1.1.4
digest: sha256:0103535b831d493cd5a1c900a15b7b310d71e6d7ed1f347e0037934bf44a4f5d
generated: 2018-01-07T20:59:41.678017-05:00
dependencies:
- name: postgresql
version: 0.8.5
repository: https://kubernetes-charts.storage.googleapis.com
- name: redis
version: 1.1.4
repository: https://kubernetes-charts.storage.googleapis.com
\ No newline at end of file
......@@ -14,3 +14,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "postgresql.name" -}}
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "redis.name" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-db
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: ExternalName
externalName: {{ .Values.database.externalName }}
......@@ -36,6 +36,10 @@ spec:
- '4'
- -b
- 0.0.0.0:5000
- --access-logfile
- '-'
- --forwarded-allow-ips
- '*'
- pyalertscanada:app
imagePullPolicy: {{ .Values.imagePullPolicy }}
name: {{ template "fullname" . }}-web
......@@ -51,7 +55,7 @@ spec:
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}-secrets
key: ro-database-url
key: database-url
- name: AC_ASSETS_URL_EXPIRE
value: 'False'
- name: AC_ASSETS_AUTO_BUILD
......
......@@ -40,7 +40,7 @@ spec:
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}-secrets
key: rw-database-url
key: database-url
- name: AC_BROKER_URL
valueFrom:
secretKeyRef:
......
{{ if .Values.init.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
......@@ -29,7 +31,7 @@ spec:
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}-secrets
key: admin-database-url
key: database-url
- name: AC_BROKER_URL
valueFrom:
secretKeyRef:
......@@ -45,3 +47,4 @@ spec:
{{ toYaml .Values.imagePullSecrets | indent 10 }}
{{ end }}
restartPolicy: OnFailure
{{ end }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-redis
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: ExternalName
externalName: {{ .Values.redis.externalName }}
......@@ -12,9 +12,7 @@ metadata:
heritage: "{{ .Release.Service }}"
type: Opaque
data:
admin-database-url: {{ printf "%s://%s:%s@%s-db:%.0f/%s" .Values.database.protocol .Values.database.admin.username .Values.database.admin.password $name .Values.database.port .Values.database.database | b64enc | quote }}
rw-database-url: {{ printf "%s://%s:%s@%s-db:%.0f/%s" .Values.database.protocol .Values.database.rw.username .Values.database.rw.password $name .Values.database.port .Values.database.database | b64enc | quote }}
ro-database-url: {{ printf "%s://%s:%s@%s-db:%.0f/%s" .Values.database.protocol .Values.database.ro.username .Values.database.ro.password $name .Values.database.port .Values.database.database | b64enc | quote }}
database-url: {{ print "postgres://" .Values.postgresql.postgresUser ":" .Values.postgresql.postgresPassword "@" (include "postgresql.name" .) ":5432/" .Values.postgresql.postgresDatabase | b64enc | quote }}
flask-secret-key: {{ .Values.flask.secret_key | b64enc | quote }}
broker-url: {{ printf "%s://:%s@%s-redis:%.0f/%.0f" .Values.broker.protocol .Values.broker.password $name .Values.broker.port .Values.broker.database | b64enc | quote }}
redis-url: {{ printf "redis://:%s@%s-redis:%.0f/%.0f" .Values.redis.password $name .Values.redis.port .Values.redis.database | b64enc | quote }}
\ No newline at end of file
broker-url: {{ print "redis://:" .Values.redis.redisPassword "@" (include "redis.name" .) ":6379/1" | b64enc | quote }}
redis-url: {{ print "redis://:" .Values.redis.redisPassword "@" (include "redis.name" .) ":6379/0" | b64enc | quote }}
\ No newline at end of file
......@@ -18,36 +18,29 @@ replicas:
fetcher: 1
beat: 1
init:
enabled: true
ingress:
enabled: false
hosts:
- alerts.zacharyseguin.ca
annotations:
kubernetes.io/ingress.class: nginx
database:
externalName: db.example.com
protocol: postgres
port: 5432
database: alerts_canada
admin:
username: alerts_canada_admin
password: passwd
rw:
username: alerts_canada
password: passwd
ro:
username: alerts_canada_ro
password: passwd
redis:
externalName: redis.example.com
password: passwd
port: 6379
database: 1
broker:
protocol: redis
password: passwd
port: 0
database: 1
kubernetes.io/ingress.class: traefik
flask:
secret_key: ABCD
\ No newline at end of file
secret_key: ABCD
postgresql:
imageTag: 10.1
postgresUser: alerts_canada
postgresPassword: Canada150
postgresDatabase: alerts_canada
persistance:
size: 15Gi
redis:
image: bitnami/redis:4.0
redisPassword: Canada150
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment