Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(helm): database name as an environment variable #76

Merged
merged 19 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/keep/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: keep
version: 0.1.55
version: 0.1.56
description: Keep Helm Chart
type: application
icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75
Expand Down
33 changes: 18 additions & 15 deletions charts/keep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,22 @@ Keep Helm Chart
| backend.enabled | bool | `true` | |
| backend.env[0].name | string | `"DATABASE_CONNECTION_STRING"` | |
| backend.env[0].value | string | `"mysql+pymysql://root@keep-database:3306/keep"` | |
| backend.env[1].name | string | `"SECRET_MANAGER_TYPE"` | |
| backend.env[1].value | string | `"k8s"` | |
| backend.env[2].name | string | `"PORT"` | |
| backend.env[2].value | string | `"8080"` | |
| backend.env[3].name | string | `"PUSHER_APP_ID"` | |
| backend.env[3].value | int | `1` | |
| backend.env[4].name | string | `"PUSHER_APP_KEY"` | |
| backend.env[4].value | string | `"keepappkey"` | |
| backend.env[5].name | string | `"PUSHER_APP_SECRET"` | |
| backend.env[5].value | string | `"keepappsecret"` | |
| backend.env[6].name | string | `"PUSHER_HOST"` | |
| backend.env[6].value | string | `"keep-websocket"` | |
| backend.env[7].name | string | `"PUSHER_PORT"` | |
| backend.env[7].value | int | `6001` | |
| backend.env[1].name | string | `"DATABASE_NAME"` | |
| backend.env[1].value | string | `"keep-database"` | |
| backend.env[2].name | string | `"SECRET_MANAGER_TYPE"` | |
| backend.env[2].value | string | `"k8s"` | |
| backend.env[3].name | string | `"PORT"` | |
| backend.env[3].value | string | `"8080"` | |
| backend.env[4].name | string | `"PUSHER_APP_ID"` | |
| backend.env[4].value | int | `1` | |
| backend.env[5].name | string | `"PUSHER_APP_KEY"` | |
| backend.env[5].value | string | `"keepappkey"` | |
| backend.env[6].name | string | `"PUSHER_APP_SECRET"` | |
| backend.env[6].value | string | `"keepappsecret"` | |
| backend.env[7].name | string | `"PUSHER_HOST"` | |
| backend.env[7].value | string | `"keep-websocket"` | |
| backend.env[8].name | string | `"PUSHER_PORT"` | |
| backend.env[8].value | int | `6001` | |
| backend.extraInitContainers | list | `[]` | |
| backend.extraVolumeMounts | list | `[]` | |
| backend.extraVolumes | list | `[]` | |
Expand Down Expand Up @@ -82,7 +84,8 @@ Keep Helm Chart
| backend.service.port | int | `8080` | |
| backend.service.type | string | `"ClusterIP"` | |
| backend.tolerations | list | `[]` | |
| backend.waitForDatabase | bool | `true` | |
| backend.waitForDatabase.enabled | bool | `true` | |
| backend.waitForDatabase.port | int | `3306` | |
| database.affinity | object | `{}` | |
| database.autoscaling.enabled | bool | `false` | |
| database.enabled | bool | `true` | |
Expand Down
4 changes: 2 additions & 2 deletions charts/keep/templates/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ spec:
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
initContainers:
{{- if .Values.backend.waitForDatabase }}
{{- if .Values.backend.waitForDatabase.enabled }}
- name: wait-for-database
image: busybox
command: ['sh', '-c', 'until nc -z {{ include "keep.findEnvVar" (list "DATABASE_NAME" .) | default "keep-database" }} 3306; do sleep 1; done;']
command: ['sh', '-c', 'until nc -z {{ include "keep.findEnvVar" (list "DATABASE_NAME" .) | default "keep-database" }} {{ .Values.backend.waitForDatabase.port }}; do sleep 1; done;']
{{- end }}
{{- range .Values.backend.extraInitContainers }}
- name: {{ .name }}
Expand Down
6 changes: 5 additions & 1 deletion charts/keep/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ backend:
enabled: true
# if true, wait for the database to be ready before starting the API
# if you use external database, you can set this to false
waitForDatabase: true
waitForDatabase:
enabled: true
port: 3306
# if true, the database connection string will be read from a secret
# if it is false, the DATABASE_CONNECTION_STRING value can be set directly
databaseConnectionStringFromSecret:
Expand All @@ -59,6 +61,8 @@ backend:
env:
- name: DATABASE_CONNECTION_STRING
value: mysql+pymysql://root@keep-database:3306/keep
- name: DATABASE_NAME
value: keep-database
- name: SECRET_MANAGER_TYPE
value: k8s
- name: PORT
Expand Down
Loading