Skip to content

Commit

Permalink
feat(ci): make chart standalone runnable
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Pinsel <dominik.pinsel@mercedes-benz.com>
  • Loading branch information
DominikPinsel committed Aug 9, 2023
1 parent ae807e3 commit be182e9
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 178 deletions.
9 changes: 6 additions & 3 deletions charts/managed-identity-wallet/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ dependencies:
version: 15.1.6
- name: common
repository: https://charts.bitnami.com/bitnami
version: 2.6.0
digest: sha256:0513338c0e9b39ffac3ae31802f3122e62eb2e1c457159e8445f3c4f40ff1fb9
generated: "2023-07-14T13:56:04.369372589+02:00"
version: 2.8.0
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 11.9.13
digest: sha256:27875e671c8f4b84ec45dc253d23ad42161422f96417aa4b257599575410ceda
generated: "2023-08-09T16:17:43.65852891+02:00"
56 changes: 0 additions & 56 deletions charts/managed-identity-wallet/templates/backup/cronjob.yaml

This file was deleted.

This file was deleted.

36 changes: 35 additions & 1 deletion charts/managed-identity-wallet/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,42 @@ spec:
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: APP_LOG_LEVEL
value: {{ .Values.miw.logging.level }}
- name: MIW_HOST_NAME
value: {{ tpl .Values.miw.host . }}
- name: ENCRYPTION_KEY
value: {{ .Values.miw.database.encryptionKey }}
- name: AUTHORITY_WALLET_BPN
value: {{ tpl .Values.miw.authorityWallet.bpn . }}
- name: AUTHORITY_WALLET_DID
value: {{ tpl .Values.miw.authorityWallet.did . }}
- name: ENFORCE_HTTPS_IN_DID_RESOLUTION
value: {{ .Values.miw.ssi.enforceHttpsInDidWebResolution | quote }}
- name: APPLICATION_ENVIRONMENT
value: {{ .Values.miw.environment }}
- name: KEYCLOAK_REALM
value: {{ tpl .Values.miw.keycloak.realm . }}
- name: KEYCLOAK_CLIENT_ID
value: {{ .Values.miw.keycloak.clientId }}
- name: AUTH_SERVER_URL
value: {{ tpl .Values.miw.keycloak.url . }}
- name: USE_SSL
value: {{ .Values.miw.database.useSSL | quote }}
- name: DB_HOST
value: {{ tpl .Values.miw.database.host . }}
- name: DB_PORT
value: {{ .Values.miw.database.port | quote }}
- name: DB_NAME
value: {{ tpl .Values.miw.database.database . }}
- name: DB_USER_NAME
value: {{ .Values.miw.database.user }}
- name: DB_PASSWORD
value: {{ .Values.miw.database.password }}
- name: APPLICATION_PORT
value: "8080"
- name: VC_EXPIRY_DATE
value: {{ .Values.miw.ssi.vcExpiryDate | quote }}
{{- if or .Values.envs .Values.secrets }}
{{- range $key, $val := .Values.envs }}
- name: {{ $key }}
Expand Down Expand Up @@ -89,7 +123,7 @@ spec:
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
initialDelaySeconds: 30
initialDelaySeconds: 60
resources:
{{- toYaml .Values.resources | nindent 12 }}

Expand Down
43 changes: 43 additions & 0 deletions charts/managed-identity-wallet/templates/job-keycloak-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if .Values.keycloak.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-job-create-db-keycloak
spec:
template:
spec:
containers:
- name: create-db
image: postgres:13
env:
- name: USER
value: {{ tpl ( .Values.keycloak.externalDatabase.user | quote ) . }}
- name: PGPASSWORD
value: {{ tpl ( .Values.keycloak.externalDatabase.password | quote ) . }}
- name: HOST
value: {{ tpl ( .Values.keycloak.externalDatabase.host | quote ) . }}
- name: PORT
value: {{ tpl ( .Values.keycloak.externalDatabase.port | quote ) . }}
- name: DATABASE
value: {{ tpl ( .Values.keycloak.externalDatabase.database | quote ) . }}
command: [ "bash", "-c", "--" ]
args:
- |
echo "Postgres user: $USER"
echo "Postgres host: $HOST"
echo "Postgres port: $PORT"
echo "Postgres database: $DATABASE"
echo "Waiting for postgres to start"
while ! psql -h $HOST -p $PORT -U $USER -d postgres -c "select 1" > /dev/null 2>&1; do
sleep 1
done
echo "Creating database $DATABASE"
psql -h $HOST -p $PORT -U $USER -d postgres -c "CREATE DATABASE $DATABASE" > /dev/null 2>&1 || echo "Skip creation as database $DATABASE already exists"
securityContext: {{ .Values.jobSecurityContext | toYaml | nindent 12 }}
restartPolicy: Never
backoffLimit: 0
---
{{- end}} # end if .Values.keycloak.enabled
40 changes: 40 additions & 0 deletions charts/managed-identity-wallet/templates/job-miw-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-job-create-db-miw
spec:
template:
spec:
containers:
- name: create-db
image: postgres:13
env:
- name: USER
value: {{ tpl ( .Values.miw.database.user | quote ) . }}
- name: PGPASSWORD
value: {{ tpl ( .Values.miw.database.password | quote ) . }}
- name: HOST
value: {{ tpl ( .Values.miw.database.host | quote ) . }}
- name: PORT
value: {{ tpl ( .Values.miw.database.port | quote ) . }}
- name: DATABASE
value: {{ tpl ( .Values.miw.database.database | quote ) . }}
command: [ "bash", "-c", "--" ]
args:
- |
echo "Postgres user: $USER"
echo "Postgres host: $HOST"
echo "Postgres port: $PORT"
echo "Postgres database: $DATABASE"
echo "Waiting for postgres to start"
while ! psql -h $HOST -p $PORT -U $USER -d postgres -c "select 1" > /dev/null 2>&1; do
sleep 1
done
echo "Creating database $DATABASE"
psql -h $HOST -p $PORT -U $USER -d postgres -c "CREATE DATABASE $DATABASE" > /dev/null 2>&1 || echo "Skip creation as database $DATABASE already exists"
securityContext: {{ .Values.jobSecurityContext | toYaml | nindent 12 }}
restartPolicy: Never
backoffLimit: 0
Loading

0 comments on commit be182e9

Please sign in to comment.