Skip to content

Commit 1828c7e

Browse files
d4ddi0joshua-clayton
authored andcommitted
Hawkbit: include an initContainer to intialize the database
This is optional in the docker compose version, but in kubernetes, the addition of an init container make the startup more stable by ensuring the databases are up and updated before running the main hawkbit container.
1 parent 3201fae commit 1828c7e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

charts/hawkbit/templates/deployment.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@ spec:
2525
{{- toYaml . | nindent 8 }}
2626
{{- end }}
2727
spec:
28+
initContainers:
29+
- name: hawkbit-init
30+
image: "{{ .Values.image.initContainer }}:{{ .Values.image.tag }}"
31+
imagePullPolicy: {{ .Values.image.pullPolicy }}
32+
env:
33+
- name: HAWKBIT_DB_MODE
34+
value: "migrate"
35+
- name: "SPRING_DATASOURCE_URL"
36+
{{- if and .Values.env .Values.env.springDatasourceUrl }}
37+
value: "{{ .Values.env.springDatasourceUrl }}"
38+
{{- else }}
39+
value: "jdbc:mariadb://{{ .Release.Name }}-mysql:3306/{{ .Values.mysql.auth.database }}"
40+
{{- end }}
41+
- name: SPRING_DATASOURCE_USERNAME
42+
value: "{{ .Values.mysql.auth.username }}"
43+
- name: SPRING_DATASOURCE_PASSWORD
44+
valueFrom:
45+
secretKeyRef:
46+
name: {{ include "mysql.secretName" .Subcharts.mysql }}
47+
key: mysql-password
48+
- name: AND_THEN
49+
value: "true"
2850
{{- with .Values.image.pullSecrets }}
2951
imagePullSecrets:
3052
{{- toYaml . | nindent 8 }}
@@ -36,6 +58,8 @@ spec:
3658
env:
3759
- name: PROFILES
3860
value: "{{ .Values.spring.profiles }}"
61+
- name: SPRING_FLYWAY_ENABLED
62+
value: "false"
3963
- name: SPRING_DATASOURCE_USERNAME
4064
value: "{{ .Values.mysql.auth.username }}"
4165
- name: SPRING_DATASOURCE_PASSWORD

charts/hawkbit/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ image:
1717
repository: "hawkbit/hawkbit-update-server"
1818
tag: '0.9.0'
1919
pullPolicy: IfNotPresent
20+
initContainer: "hawkbit/hawkbit-repository-jpa-init"
2021

2122
# auth configuration
2223
auth:

0 commit comments

Comments
 (0)