Skip to content

Commit

Permalink
Adds extraEnvVars to api deployment init container for db migrations (#…
Browse files Browse the repository at this point in the history
…2717)

Co-authored-by: Kenza B <[email protected]>
  • Loading branch information
nickzelei and Kenza B authored Sep 18, 2024
1 parent c4d756d commit 11091bf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion backend/charts/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ A Helm chart for the Neosync Backend API
| db.port | int | `5432` | The database port |
| db.username | string | `nil` | The username that will be used for authentication |
| deploymentAnnotations | object | `{}` | Provide a map of deployment annotations that will be attached to the deployment's annotations |
| extraEnvVars | list | `[]` | Provide extra environment variables that will be applied to the deployment. |
| extraEnvVars | list | `[]` | Provide extra environment variables that will be applied to the deployment's user-container. |
| fullnameOverride | string | `nil` | Fully overrides the chart name |
| host | string | `"0.0.0.0"` | Sets the host that the backend will listen on. 0.0.0.0 is common for Kubernetes workloads. |
| image.pullPolicy | string | `nil` | Overrides the default K8s pull policy |
Expand All @@ -58,6 +58,7 @@ A Helm chart for the Neosync Backend API
| migrations.db.port | int | `5432` | The database port |
| migrations.db.schemaDir | string | `"/migrations"` | The directory where the migrations are located. |
| migrations.db.username | string | `nil` | The username that will be used for authentication |
| migrations.extraEnvVars | list | `[]` | Provide extra environment variables that will be applied to the migration init container. |
| nameOverride | string | `nil` | Override the name specified on the Chart, which defaults to .Chart.Name |
| neosyncCloud.enabled | bool | `false` | Whether or not this is NeosyncCloud |
| neosyncCloud.workerApiKeys | list | `[]` | Worker API keys that have been allowlisted to for use |
Expand Down
25 changes: 25 additions & 0 deletions backend/charts/api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,31 @@ spec:
args:
- migrate
- up
env:
{{- with .Values.migrations.extraEnvVars }}
{{- range .}}
- name: {{ .name }}
{{- if .value }}
value: {{ .value | quote }}
{{- else if .valueFrom }}
valueFrom:
{{- if .valueFrom.secretKeyRef }}
secretKeyRef:
name: {{ .valueFrom.secretKeyRef.name }}
key: {{ .valueFrom.secretKeyRef.key }}
{{- end }}
{{- if .valueFrom.configMapKeyRef }}
configMapKeyRef:
name: {{ .valueFrom.configMapKeyRef.name }}
key: {{ .valueFrom.configMapKeyRef.key }}
{{- end }}
{{- if .valueFrom.fieldRef }}
fieldRef:
fieldPath: {{ .valueFrom.fieldRef.fieldPath }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

envFrom:
- secretRef:
Expand Down
4 changes: 3 additions & 1 deletion backend/charts/api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ migrations:
migrationsTableQuoted: false
# -- Extra database options that will be appended to the query string
options:
# -- Provide extra environment variables that will be applied to the migration init container.
extraEnvVars: []

# Set requests and limits on the backend to change its performance
resources:
Expand Down Expand Up @@ -237,7 +239,7 @@ protometrics:
# -- The strategy to use when rolling out new replicas
updateStrategy:

# -- Provide extra environment variables that will be applied to the deployment.
# -- Provide extra environment variables that will be applied to the deployment's user-container.
extraEnvVars: []

# -- Provide sidecars that will be appended directly to the deployment next to the user-container
Expand Down
3 changes: 2 additions & 1 deletion charts/neosync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ A Helm chart for Neosync that contains the api, app, and worker
| api.db.port | int | `5432` | The database port |
| api.db.username | string | `nil` | The username that will be used for authentication |
| api.deploymentAnnotations | object | `{}` | Provide a map of deployment annotations that will be attached to the deployment's annotations |
| api.extraEnvVars | list | `[]` | Provide extra environment variables that will be applied to the deployment. |
| api.extraEnvVars | list | `[]` | Provide extra environment variables that will be applied to the deployment's user-container. |
| api.fullnameOverride | string | `nil` | Fully overrides the chart name |
| api.host | string | `"0.0.0.0"` | Sets the host that the backend will listen on. 0.0.0.0 is common for Kubernetes workloads. |
| api.image.pullPolicy | string | `nil` | Overrides the default K8s pull policy |
Expand All @@ -66,6 +66,7 @@ A Helm chart for Neosync that contains the api, app, and worker
| api.migrations.db.port | int | `5432` | The database port |
| api.migrations.db.schemaDir | string | `"/migrations"` | The directory where the migrations are located. |
| api.migrations.db.username | string | `nil` | The username that will be used for authentication |
| api.migrations.extraEnvVars | list | `[]` | Provide extra environment variables that will be applied to the migration init container. |
| api.nameOverride | string | `nil` | Override the name specified on the Chart, which defaults to .Chart.Name |
| api.neosyncCloud.enabled | bool | `false` | Whether or not this is NeosyncCloud |
| api.neosyncCloud.workerApiKeys | list | `[]` | Worker API keys that have been allowlisted to for use |
Expand Down

0 comments on commit 11091bf

Please sign in to comment.