diff --git a/charts/keep/README.md b/charts/keep/README.md index 958431b..47bc607 100644 --- a/charts/keep/README.md +++ b/charts/keep/README.md @@ -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 | `[]` | | @@ -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` | | diff --git a/charts/keep/templates/backend.yaml b/charts/keep/templates/backend.yaml index 50f9ea3..ee4194d 100644 --- a/charts/keep/templates/backend.yaml +++ b/charts/keep/templates/backend.yaml @@ -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 }} diff --git a/charts/keep/values.yaml b/charts/keep/values.yaml index 7b67b0d..d8f2a1e 100644 --- a/charts/keep/values.yaml +++ b/charts/keep/values.yaml @@ -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: @@ -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