Skip to content

Commit

Permalink
Helm chart: add support for MariaDB and MySQL backends
Browse files Browse the repository at this point in the history
  • Loading branch information
adutra committed May 21, 2024
1 parent a9ebc42 commit 0151e5c
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ as necessary. Empty sections will not end in the release notes.
`nessie.version.store.persist.jdbc.datasource=postgresql`;
2. Migrate any property under `quarkus.datasource.*` to `quarkus.datasource.postgresql.*`. Support
for the old `quarkus.datasource.*` properties will be removed in a future release.
- For the same reason, the Nessie Helm chart has been updated. The old `postgres` section is now
called `jdbc`. Existing Helm chart configurations should be updated accordingly, e.g.
`postgres.jdbcUrl` now becomes `jdbc.jdbcUrl`. Although the old `postgres` section is still
honored, it won't be supported in future releases. The right datasource will be chosen based on
the `jdbcUrl` contents.

### Breaking changes

Expand Down
16 changes: 16 additions & 0 deletions helm/nessie/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,19 @@ Convert a dict into a string formed by a comma-separated list of key-value pairs
{{ end -}}
{{- end -}}
{{- end -}}

{{/*
Determine the datasource kind based on the jdbcUrl. This relies on the fact that datasource
names should coincide with jdbc schemes in connection URIs.
*/}}
{{- define "nessie.dbKind" -}}
{{- $v := . | split ":" -}}
{{ $v._1 }}
{{- end }}

{{/*
Determine the datasource config prefix based on the db kind.
*/}}
{{- define "nessie.datasourceConfigPrefix" -}}
QUARKUS_DATASOURCE_{{- upper . -}}_
{{- end }}
29 changes: 20 additions & 9 deletions helm/nessie/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,31 @@ spec:
{{- end }}

{{- if or (eq .Values.versionStoreType "JDBC") (eq .Values.versionStoreType "TRANSACTIONAL") }}
- name: QUARKUS_DATASOURCE_USERNAME
{{- $oldConfig := .Values.postgres | default dict }}
{{- $newConfig := .Values.jdbc | default dict }}
{{- $jdbcUrl := coalesce $oldConfig.jdbcUrl $newConfig.jdbcUrl }}
{{- $oldSecret := $oldConfig.secret | default dict }}
{{- $newSecret := $newConfig.secret | default dict }}
{{- $secretName := coalesce $oldSecret.name $newSecret.name }}
{{- $secretUsername := coalesce $oldSecret.username $newSecret.username }}
{{- $secretPassword := coalesce $oldSecret.password $newSecret.password }}
{{- $dbKind := include "nessie.dbKind" $jdbcUrl }}
{{- $dataSourceConfigPrefix := include "nessie.datasourceConfigPrefix" $dbKind }}
- name: NESSIE_VERSION_STORE_PERSIST_JDBC_DATASOURCE
value: {{ $dbKind }}
- name: {{ $dataSourceConfigPrefix }}USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.postgres.secret.name }}
key: {{ .Values.postgres.secret.username }}
- name: QUARKUS_DATASOURCE_PASSWORD
name: {{ $secretName }}
key: {{ $secretUsername }}
- name: {{ $dataSourceConfigPrefix }}PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.postgres.secret.name }}
key: {{ .Values.postgres.secret.password }}
- name: QUARKUS_DATASOURCE_JDBC_URL
value: {{ .Values.postgres.jdbcUrl }}
name: {{ $secretName }}
key: {{ $secretPassword }}
- name: {{ $dataSourceConfigPrefix }}JDBC_URL
value: {{ $jdbcUrl }}
{{- end }}

{{- if eq .Values.versionStoreType "BIGTABLE" }}
- name: QUARKUS_GOOGLE_CLOUD_PROJECT_ID
value: {{ .Values.bigtable.projectId }}
Expand Down
19 changes: 10 additions & 9 deletions helm/nessie/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,18 @@ mongodb:
# -- The secret key storing the MongoDB password.
password: mongodb_password

# Postgres settings. Only required when using JDBC version store type; ignored otherwise.
postgres:
# -- The Postgres JDBC connection string.
# JDBC datasource settings. Only required when using JDBC version store type; ignored otherwise.
jdbc:
# -- The JDBC connection string. If you are using Nessie OSS images, then only
# PostgreSQL and MariaDB are supported.
jdbcUrl: jdbc:postgresql://localhost:5432/my_database
secret:
# -- The secret name to pull Postgres credentials from.
name: postgres-creds
# -- The secret key storing the Postgres username.
username: postgres_username
# -- The secret key storing the Postgres password.
password: postgres_password
# -- The secret name to pull datasource credentials from.
name: datasource-creds
# -- The secret key storing the datasource username.
username: username
# -- The secret key storing the datasource password.
password: password

# BigTable settings. Only required when using BIGTABLE version store type; ignored otherwise.
bigtable:
Expand Down
2 changes: 1 addition & 1 deletion site/docs/guides/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ database credentials from the secret that was created previously. We can do this

```yaml
versionStoreType: JDBC
postgres:
jdbc:
jdbcUrl: jdbc:postgresql://postgres:5432/nessie
secret:
name: postgres-creds
Expand Down

0 comments on commit 0151e5c

Please sign in to comment.