diff --git a/charts/dev/livebook/Chart.yaml b/charts/dev/livebook/Chart.yaml index 7e4bceb2f54..2a1eed52f9f 100644 --- a/charts/dev/livebook/Chart.yaml +++ b/charts/dev/livebook/Chart.yaml @@ -1,7 +1,7 @@ kubeVersion: ">=1.24.0-0" apiVersion: v2 name: livebook -version: 3.0.13 +version: 3.1.0 appVersion: latest description: Livebook is a web application for writing interactive and collaborative code notebooks for Elixir home: https://truecharts.org/charts/incubator/livebook diff --git a/charts/dev/livebook/questions.yaml b/charts/dev/livebook/questions.yaml index 9dc1d00e9c8..675cde7e542 100644 --- a/charts/dev/livebook/questions.yaml +++ b/charts/dev/livebook/questions.yaml @@ -16,11 +16,24 @@ questions: type: dict attrs: - variable: LIVEBOOK_PASSWORD - label: "LIVEBOOK_PASSWORD" + label: "Password (LIVEBOOK_PASSWORD)" description: "Password needed to access livebook (must be at least 12 characters)" schema: type: string - default: "livebookiscool" + required: true + private: true + - variable: LIVEBOOK_DEBUG + label: "Debug Logging (LIVEBOOK_DEBUG)" + description: > + enables verbose logging, when set to "true". Disabled by default. + schema: + type: boolean + - variable: LIVEBOOK_UPDATE_INSTRUCTIONS_URL + label: "Update instruction URL (LIVEBOOK_UPDATE_INSTRUCTIONS_URL)" + description: > + sets the URL to direct the user to for updating Livebook when a new version becomes available. + schema: + type: string # Include{serviceRoot} - variable: main label: "Main Service" diff --git a/charts/dev/livebook/templates/_secrets.tpl b/charts/dev/livebook/templates/_secrets.tpl new file mode 100644 index 00000000000..205e77ddbd9 --- /dev/null +++ b/charts/dev/livebook/templates/_secrets.tpl @@ -0,0 +1,15 @@ +{{/* Define the secrets */}} +{{- define "livebook.secrets" -}} +{{- $secretName := (printf "%s-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }} +{{/* Base64 encoding is intended, application expects a b64 formatted value */}} +{{- $secretKeyBase := randAlphaNum 48 | b64enc -}} +{{- $cookie := randAlphaNum 20 -}} +{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}} + {{- $secretKeyBase = index .data "LIVEBOOK_SECRET_KEY_BASE" | b64dec -}} + {{- $cookie = index .data "LIVEBOOK_COOKIE" | b64dec -}} +{{- end }} +enabled: true +data: + LIVEBOOK_SECRET_KEY_BASE: {{ $secretKeyBase }} + LIVEBOOK_COOKIE: {{ $cookie }} +{{- end -}} diff --git a/charts/dev/livebook/templates/common.yaml b/charts/dev/livebook/templates/common.yaml index 78d963fb168..28fd652b7e0 100644 --- a/charts/dev/livebook/templates/common.yaml +++ b/charts/dev/livebook/templates/common.yaml @@ -1,2 +1,13 @@ {{/* Render the templates */}} -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . }} + +{{/* Render secrets for livebook */}} +{{- $secrets := include "livebook.secrets" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "secrets" $secrets -}} +{{- end -}} + +{{/* Render the templates */}} +{{ include "tc.v1.common.loader.apply" . }} + diff --git a/charts/dev/livebook/values.yaml b/charts/dev/livebook/values.yaml index f1d0ef1c2ae..cf90783411f 100644 --- a/charts/dev/livebook/values.yaml +++ b/charts/dev/livebook/values.yaml @@ -1,7 +1,7 @@ image: pullPolicy: IfNotPresent - repository: livebook/livebook - tag: latest@sha256:99c321de38ad781df509cfd3e452805f04627589a435645faa889a963bd7d1f5 + repository: ghcr.io/livebook-dev/livebook + tag: 0.12.1@sha256:11c5691efc8e35bf0eee9c336ff029e674bcf4146ec39021b1ef75c1b17fb775 persistence: data: enabled: true @@ -19,12 +19,34 @@ service: ports: main: port: 8787 - protocol: tcp - targetPort: 8080 + headless: + enabled: true + primary: false + clusterIP: None + ports: + headless: + enabled: true + port: "{{ .Values.service.main.ports.main.port }}" workload: main: podSpec: containers: main: env: - LIVEBOOK_PASSWORD: livebookiscool + # A_ because these variables are sorted alphabetically and this one needs to come first. + A_POD_IP: + fieldRef: + fieldPath: status.podIP + LIVEBOOK_CLUSTER: '{{ printf "dns:%s-headless" (include "tc.v1.common.lib.chart.names.fullname" .) }}' + LIVEBOOK_DISTRIBUTION: name + LIVEBOOK_NODE: livebook@$(A_POD_IP) + LIVEBOOK_PORT: "{{ .Values.service.main.ports.main.port }}" + LIVEBOOK_HOME: "{{ .Values.persistence.data.mountPath }}" + LIVEBOOK_SECRET_KEY_BASE: + secretKeyRef: + name: secrets + key: LIVEBOOK_SECRET_KEY_BASE + LIVEBOOK_COOKIE: + secretKeyRef: + name: secrets + key: LIVEBOOK_COOKIE