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

Add option to create a Kubernetes secret containing the databaseUrl #90

Merged
merged 3 commits into from
Jan 30, 2025
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ enterprise:
| windmill.baseProtocol | string | `"http"` | protocol as shown in browser, change to https etc based on your endpoint/ingress configuration, this variable and `baseDomain` are used as part of the BASE_URL environment variable in app and worker container |
| windmill.cookieDomain | string | `""` | domain to use for the cookies. Use it if windmill is hosted on a subdomain and you need to share the cookies with the hub for instance |
| windmill.databaseUrl | string | `"postgres://postgres:windmill@windmill-postgresql/windmill?sslmode=disable"` | Postgres URI, pods will crashloop if database is unreachable, sets DATABASE_URL environment variable in app and worker container |
| windmill.databaseSecret | bool | `false` | Whether to create a secret containing the value of databaseUrl
| windmill.databaseUrlSecretName | string | `""` | name of the secret storing the database URI, take precedence over databaseUrl. The key of the url is 'url' |
| windmill.denoExtraImportMap | string | `""` | custom deno extra import maps (syntax: `key1=value1,key2=value2`) |
| windmill.exposeHostDocker | bool | `false` | mount the docker socket inside the container to be able to run docker command as docker client to the host docker daemon |
Expand Down
2 changes: 2 additions & 0 deletions charts/windmill/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Windmill - Turn scripts into endpoints, workflows and UIs in minutes
| hub.baseDomain | string | `"hub.windmill"` | you also need to set the cookieDomain to the root domain in the app configuration |
| hub.baseProtocol | string | `"http"` | protocol as shown in browser, change to https etc based on your endpoint/ingress configuration, this variable and `baseDomain` are used as part of the BASE_URL environment variable in app and worker container |
| hub.containerSecurityContext | object | `{}` | |
| hub.databaseSecret | bool | `false` | Whether to create a secret containing the value of databaseUrl |
| hub.databaseUrl | string | `"postgres://postgres:windmill@windmill-hub-postgresql/windmillhub?sslmode=disable"` | Postgres URI, pods will crashloop if database is unreachable, sets DATABASE_URL environment variable in app and worker container |
| hub.databaseUrlSecretKey | string | `"url"` | name of the key in secret storing the database URI. The default key of the url is 'url' |
| hub.databaseUrlSecretName | string | `""` | name of the secret storing the database URI, take precedence over databaseUrl. |
Expand Down Expand Up @@ -111,6 +112,7 @@ Windmill - Turn scripts into endpoints, workflows and UIs in minutes
| windmill.baseDomain | string | `"windmill"` | domain as shown in browser. url of ths service is at: {baseProtocol}://{baseDomain} |
| windmill.baseProtocol | string | `"http"` | protocol as shown in browser, change to https etc based on your endpoint/ingress configuration, this variable and `baseDomain` are used as part of the BASE_URL environment variable in app and worker container |
| windmill.cookieDomain | string | `""` | domain to use for the cookies. Use it if windmill is hosted on a subdomain and you need to share the cookies with the hub for instance |
| windmill.databaseSecret | bool | `false` | Whether to create a secret containing the value of databaseUrl |
| windmill.databaseUrl | string | `"postgres://postgres:windmill@windmill-postgresql/windmill?sslmode=disable"` | Postgres URI, pods will crashloop if database is unreachable, sets DATABASE_URL environment variable in app and worker container |
| windmill.databaseUrlSecretKey | string | `"url"` | name of the key in secret storing the database URI. The default key of the url is 'url' |
| windmill.databaseUrlSecretName | string | `""` | name of the secret storing the database URI, take precedence over databaseUrl. |
Expand Down
8 changes: 7 additions & 1 deletion charts/windmill/templates/hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ spec:
{{- with .Values.hub.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{ if .Values.hub.databaseUrlSecretName }}
{{ if .Values.hub.databaseSecret }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a user of those values but I assumed that it would also be needed here for consistency

- name: "DATABASE_URL"
valueFrom:
secretKeyRef:
name: "windmill-database"
key: "url"
{{ else if .Values.hub.databaseUrlSecretName }}
- name: "DATABASE_URL"
valueFrom:
secretKeyRef:
Expand Down
8 changes: 7 additions & 1 deletion charts/windmill/templates/indexer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ spec:
- name : "METRICS_ADDR"
value: "true"
{{ end }}
{{ if .Values.windmill.databaseUrlSecretName }}
{{ if .Values.windmill.databaseSecret }}
- name: "DATABASE_URL"
valueFrom:
secretKeyRef:
name: "windmill-database"
key: "url"
{{ else if .Values.windmill.databaseUrlSecretName }}
- name: "DATABASE_URL"
valueFrom:
secretKeyRef:
Expand Down
15 changes: 15 additions & 0 deletions charts/windmill/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if and .Values.windmill.databaseSecret .Values.windmill.databaseUrl -}}
apiVersion: v1
kind: Secret
metadata:
name: windmill-database
labels:
app: windmill-database
app.kubernetes.io/name: windmill-database
chart: {{ template "windmill.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
url: {{ .Values.windmill.databaseUrl | b64enc | quote }}
{{- end -}}
8 changes: 6 additions & 2 deletions charts/windmill/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ windmill:
lspReplicas: 2
# -- replicas for the multiplayer containers used by the app (ee only and ignored if enterprise not enabled)
multiplayerReplicas: 1
# -- name of the secret storing the database URI, take precedence over databaseUrl.
# -- name of the existing secret storing the database URI, take precedence over databaseUrl.
databaseUrlSecretName: ""
# -- name of the key in secret storing the database URI. The default key of the url is 'url'
# -- name of the key in existing secret storing the database URI. The default key of the url is 'url'
databaseUrlSecretKey: url
# -- Postgres URI, pods will crashloop if database is unreachable, sets DATABASE_URL environment variable in app and worker container
databaseUrl: postgres://postgres:windmill@windmill-postgresql/windmill?sslmode=disable
# -- whether to create a secret containing the value of databaseUrl
databaseSecret: false
# -- domain as shown in browser. url of ths service is at: {baseProtocol}://{baseDomain}
baseDomain: windmill
# -- protocol as shown in browser, change to https etc based on your endpoint/ingress configuration, this variable and `baseDomain` are used as part of the BASE_URL environment variable in app and worker container
Expand Down Expand Up @@ -482,6 +484,8 @@ hub:
databaseUrlSecretKey: url
# -- Postgres URI, pods will crashloop if database is unreachable, sets DATABASE_URL environment variable in app and worker container
databaseUrl: postgres://postgres:windmill@windmill-hub-postgresql/windmillhub?sslmode=disable
# -- whether to create a secret containing the value of databaseUrl
databaseSecret: false
# -- domain as shown in browser. url of ths service is at: {baseProtocol}://{baseDomain}
# -- should be a subdomain of the app domain so that cookies can be shared
# -- you also need to set the cookieDomain to the root domain in the app configuration
Expand Down