Skip to content
Snippets Groups Projects
Verified Commit eaedf409 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

remove postgresql from requirements and make it an external requirement

parent 1fbae687
No related branches found
No related tags found
1 merge request!73Remove postgres, add DB migrations
Pipeline #10780 passed with stages
in 32 seconds
# Helm chart
# Single Sign-on Helm chart
Single sign-on adds an Authentication server to your k8s cluster, that can be used by
applications within your cluster and by external applications to log in your users.
......@@ -13,6 +13,10 @@ new users, assign roles to users and grant users access to applications.
* helm 2.14.3+
* ORY helm chart repository installed
* `helm repo add ory https://k8s.ory.sh/helm/charts && helm repo update`
* A PostgreSQL database with 3 users and 3 databases called
- `stackspin`
- `hydra`
- `kratos`
## Configuration
......
......@@ -5,7 +5,7 @@ metadata:
labels:
{{ include "single-sign-on.labels" . | indent 4 }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
spec:
......@@ -31,6 +31,9 @@ spec:
value: http://{{ .Release.Name }}-kratos-public:80
command: ["/bin/bash", "-c"]
args:
- flask user create $SETUP_USER;
flask user setpassword $SETUP_USER $SETUP_PASSWORD ;
- flask db upgrade;
{{- if .Release.IsInstall }}
flask user create $SETUP_USER;
flask user setpassword $SETUP_USER $SETUP_PASSWORD;
{{- end }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "single-sign-on.fullname" . }}-hydra-automigrate
{{- if .Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
{{ include "single-sign-on.labels" . | indent 4 }}a
{{- with .Values.hydra.deployment.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.hydra.job.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
helm.sh/hook-weight: "1"
{{- if not .Release.IsInstall }}
helm.sh/hook: "pre-upgrade"
{{- end }}
helm.sh/hook-delete-policy: "before-hook-creation,hook-succeeded"
spec:
template:
{{- with .Values.hydra.job.annotations }}
metadata:
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: {{ .Values.hydra.automountServiceAccountToken }}
containers:
- name: {{ .Chart.Name }}-hydra-automigrate
image: "{{ .Values.hydra.image.repository }}:{{ .Values.hydra.image.tag }}"
imagePullPolicy: {{ .Values.hydra.image.pullPolicy }}
command: ["hydra"]
args: ["migrate", "sql", "-e", "--yes"]
env:
- name: DSN
valueFrom:
secretKeyRef:
name: "single-sign-on-hydra"
key: dsn
securityContext:
{{- toYaml .Values.hydra.securityContext | nindent 10 }}
{{- if .Values.hydra.deployment.extraVolumeMounts }}
volumeMounts:
{{ toYaml .Values.hydra.deployment.extraVolumeMounts | indent 10 }}
{{- end }}
restartPolicy: Never
{{- if .Values.hydra.deployment.extraInitContainers }}
initContainers:
{{ tpl .Values.hydra.deployment.extraInitContainers . | indent 8 }}
{{- end }}
{{- if .Values.hydra.deployment.extraVolumes }}
volumes:
{{ toYaml .Values.hydra.deployment.extraVolumes | indent 8 }}
{{- end }}
backoffLimit: 10
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "single-sign-on.fullname" . }}-kratos-automigrate
{{- if .Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
{{ include "single-sign-on.labels" . | indent 4 }}
annotations:
{{- with .Values.kratos.job.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if not .Release.IsInstall }}
helm.sh/hook: "pre-upgrade"
{{- end }}
helm.sh/hook-weight: "1"
helm.sh/hook-delete-policy: "before-hook-creation,hook-succeeded"
spec:
template:
{{- with .Values.kratos.job.annotations }}
metadata:
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: {{ .Values.kratos.automountServiceAccountToken }}
containers:
- name: {{ .Chart.Name }}-kratos-automigrate
image: {{ include "kratos-migration-job.image" . }}
imagePullPolicy: {{ include "kratos-migration-job.imagePullPolicy" . }}
command: ["kratos"]
args: ["migrate", "sql", "-e", "--yes"]
env:
- name: DSN
valueFrom:
secretKeyRef:
name: "single-sign-on-kratos"
# name: {{ include "kratos-migration-job.secretname" . }}
key: dsn
securityContext:
{{- toYaml .Values.kratos.securityContext | nindent 10 }}
{{- if .Values.kratos.deployment.extraVolumeMounts }}
volumeMounts:
{{ toYaml .Values.kratos.deployment.extraVolumeMounts | indent 10 }}
{{- end }}
restartPolicy: Never
{{- if .Values.kratos.deployment.extraInitContainers }}
initContainers:
{{ tpl .Values.kratos.deployment.extraInitContainers . | indent 8 }}
{{- end }}
{{- if .Values.kratos.deployment.extraVolumes }}
volumes:
{{ toYaml .Values.kratos.deployment.extraVolumes | indent 8 }}
{{- end }}
backoffLimit: 10
......@@ -91,7 +91,7 @@ kratos:
# We included our own (forked) template to handle this job
autoMigrate: false
autoMigrate: true
config:
......@@ -155,7 +155,7 @@ hydra:
dangerousForceHttp: true
# We included our own (forked) template to handle this job
autoMigrate: false
autoMigrate: true
config:
dsn: postgres://hydra:hydra@single-sign-on-postgresql:5432/hydra
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment