From 6a93457081b1a8df30d740b43c6c8e8185e7c3fa Mon Sep 17 00:00:00 2001 From: Sebastian Daberdaku Date: Thu, 26 Sep 2024 17:54:03 +0200 Subject: [PATCH] Optional catalogs and related configmap --- charts/trino/README.md | 4 ++-- charts/trino/templates/configmap-catalog.yaml | 10 +++------- charts/trino/templates/deployment-coordinator.yaml | 6 ++++++ charts/trino/templates/deployment-worker.yaml | 6 ++++++ charts/trino/values.yaml | 13 +++++++++---- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/charts/trino/README.md b/charts/trino/README.md index d7995c25..3c1aa3d0 100644 --- a/charts/trino/README.md +++ b/charts/trino/README.md @@ -268,9 +268,9 @@ Fast distributed SQL query engine for big data analytics that helps you explore - custom-property1=custom-value1 - custom-property2=custom-value2 ``` -* `additionalCatalogs` - object, default: `{}` +* `catalogs` - object, default: `{"tpcds":"connector.name=tpcds\ntpcds.splits-per-node=4\n","tpch":"connector.name=tpch\ntpch.splits-per-node=4\n"}` - Configure additional [catalogs](https://trino.io/docs/current/installation/deployment.html#catalog-properties). The TPCH and TPCDS catalogs are always enabled by default, with 4 splits per node. + Configure [catalogs](https://trino.io/docs/current/installation/deployment.html#catalog-properties). The TPCH and TPCDS catalogs are included by default, with 4 splits per node. Example: ```yaml objectstore: | diff --git a/charts/trino/templates/configmap-catalog.yaml b/charts/trino/templates/configmap-catalog.yaml index 52de3403..4bd011cc 100644 --- a/charts/trino/templates/configmap-catalog.yaml +++ b/charts/trino/templates/configmap-catalog.yaml @@ -1,3 +1,4 @@ +{{- if .Values.catalogs }} apiVersion: v1 kind: ConfigMap metadata: @@ -7,13 +8,8 @@ metadata: {{- include "trino.labels" . | nindent 4 }} app.kubernetes.io/component: catalogs data: - tpch.properties: | - connector.name=tpch - tpch.splits-per-node=4 - tpcds.properties: | - connector.name=tpcds - tpcds.splits-per-node=4 -{{- range $catalogName, $catalogProperties := .Values.additionalCatalogs }} +{{- range $catalogName, $catalogProperties := .Values.catalogs }} {{ $catalogName }}.properties: | {{- $catalogProperties | nindent 4 }} {{- end }} +{{- end }} diff --git a/charts/trino/templates/deployment-coordinator.yaml b/charts/trino/templates/deployment-coordinator.yaml index ee28f32d..7f2abbfe 100644 --- a/charts/trino/templates/deployment-coordinator.yaml +++ b/charts/trino/templates/deployment-coordinator.yaml @@ -20,7 +20,9 @@ spec: {{- if and (eq .Values.accessControl.type "configmap") (not .Values.accessControl.refreshPeriod) }} checksum/access-control-config: {{ include (print $.Template.BasePath "/configmap-access-control.yaml") . | sha256sum }} {{- end }} + {{- if .Values.catalogs }} checksum/catalog-config: {{ include (print $.Template.BasePath "/configmap-catalog.yaml") . | sha256sum }} + {{- end }} checksum/coordinator-config: {{ include (print $.Template.BasePath "/configmap-coordinator.yaml") . | sha256sum }} {{- if .Values.coordinator.annotations }} {{- tpl (toYaml .Values.coordinator.annotations) . | nindent 8 }} @@ -45,9 +47,11 @@ spec: - name: config-volume configMap: name: {{ template "trino.coordinator" . }} + {{- if .Values.catalogs }} - name: catalog-volume configMap: name: {{ template "trino.catalog" . }} + {{- end }} - name: schemas-volume configMap: name: {{ template "trino.fullname" . }}-schemas-volume-coordinator @@ -123,8 +127,10 @@ spec: volumeMounts: - mountPath: {{ .Values.server.config.path }} name: config-volume + {{- if .Values.catalogs }} - mountPath: {{ .Values.server.config.path }}/catalog name: catalog-volume + {{- end }} - mountPath: {{ .Values.kafka.mountPath }} name: schemas-volume {{- if eq .Values.accessControl.type "configmap" }} diff --git a/charts/trino/templates/deployment-worker.yaml b/charts/trino/templates/deployment-worker.yaml index 521e7990..e5a0e5f7 100644 --- a/charts/trino/templates/deployment-worker.yaml +++ b/charts/trino/templates/deployment-worker.yaml @@ -21,7 +21,9 @@ spec: template: metadata: annotations: + {{- if .Values.catalogs }} checksum/catalog-config: {{ include (print $.Template.BasePath "/configmap-catalog.yaml") . | sha256sum }} + {{- end }} checksum/worker-config: {{ include (print $.Template.BasePath "/configmap-worker.yaml") . | sha256sum }} {{- if .Values.worker.annotations }} {{- tpl (toYaml .Values.worker.annotations) . | nindent 8 }} @@ -45,9 +47,11 @@ spec: - name: config-volume configMap: name: {{ template "trino.worker" . }} + {{- if .Values.catalogs }} - name: catalog-volume configMap: name: {{ template "trino.catalog" . }} + {{- end }} - name: schemas-volume configMap: name: {{ template "trino.fullname" . }}-schemas-volume-worker @@ -94,8 +98,10 @@ spec: volumeMounts: - mountPath: {{ .Values.server.config.path }} name: config-volume + {{- if .Values.catalogs }} - mountPath: {{ .Values.server.config.path }}/catalog name: catalog-volume + {{- end }} - mountPath: {{ .Values.kafka.mountPath }} name: schemas-volume {{- range .Values.configMounts }} diff --git a/charts/trino/values.yaml b/charts/trino/values.yaml index 8892ca74..08e10e74 100644 --- a/charts/trino/values.yaml +++ b/charts/trino/values.yaml @@ -291,11 +291,16 @@ eventListenerProperties: [] # - custom-property2=custom-value2 # ``` -additionalCatalogs: {} -# additionalCatalogs -- Configure additional +catalogs: + tpch: | + connector.name=tpch + tpch.splits-per-node=4 + tpcds: | + connector.name=tpcds + tpcds.splits-per-node=4 +# catalogs -- Configure # [catalogs](https://trino.io/docs/current/installation/deployment.html#catalog-properties). -# The TPCH and TPCDS catalogs are always enabled by default, with 4 splits per -# node. +# The TPCH and TPCDS catalogs are included by default, with 4 splits per node. # @raw # Example: # ```yaml