From b87e1d9c6c949f8dbf7542c9ebc258a2dd1993f1 Mon Sep 17 00:00:00 2001 From: Maksim Zhylinski Date: Mon, 10 Jul 2023 16:18:52 +0200 Subject: [PATCH] Add support to set common labels --- charts/trino/README.md | 1 + charts/trino/templates/autoscaler.yaml | 4 ++++ charts/trino/templates/configmap-catalog.yaml | 3 +++ charts/trino/templates/configmap-coordinator.yaml | 3 +++ charts/trino/templates/configmap-worker.yaml | 3 +++ charts/trino/templates/deployment-coordinator.yaml | 3 +++ charts/trino/templates/deployment-worker.yaml | 3 +++ charts/trino/values.yaml | 2 ++ 8 files changed, 22 insertions(+) diff --git a/charts/trino/README.md b/charts/trino/README.md index 4019da42..0b1f0a46 100644 --- a/charts/trino/README.md +++ b/charts/trino/README.md @@ -87,6 +87,7 @@ The following table lists the configurable parameters of the Trino chart and the | `worker.labels` | | `{}` | | `kafka.mountPath` | | `"/etc/trino/schemas"` | | `kafka.tableDescriptions` | | `{}` | +| `commonLabels` | Labels that get applied to every resource's metadata | `{}` | diff --git a/charts/trino/templates/autoscaler.yaml b/charts/trino/templates/autoscaler.yaml index 7907d1d1..258c165b 100644 --- a/charts/trino/templates/autoscaler.yaml +++ b/charts/trino/templates/autoscaler.yaml @@ -3,6 +3,10 @@ apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: {{ template "trino.worker" . }} + {{- if .Values.commonLabels }} + labels: + {{- tpl (toYaml .Values.commonLabels) . | nindent 4 }} + {{- end }} spec: maxReplicas: {{ .Values.server.autoscaling.maxReplicas }} minReplicas: {{ .Values.server.workers }} diff --git a/charts/trino/templates/configmap-catalog.yaml b/charts/trino/templates/configmap-catalog.yaml index b3255698..9c1fea67 100644 --- a/charts/trino/templates/configmap-catalog.yaml +++ b/charts/trino/templates/configmap-catalog.yaml @@ -8,6 +8,9 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} role: catalogs + {{- if .Values.commonLabels }} + {{- tpl (toYaml .Values.commonLabels) . | nindent 4 }} + {{- end }} data: tpch.properties: | connector.name=tpch diff --git a/charts/trino/templates/configmap-coordinator.yaml b/charts/trino/templates/configmap-coordinator.yaml index adddfc50..fe9244d3 100644 --- a/charts/trino/templates/configmap-coordinator.yaml +++ b/charts/trino/templates/configmap-coordinator.yaml @@ -8,6 +8,9 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} component: coordinator + {{- if .Values.commonLabels }} + {{- tpl (toYaml .Values.commonLabels) . | nindent 4 }} + {{- end }} data: node.properties: | node.environment={{ .Values.server.node.environment }} diff --git a/charts/trino/templates/configmap-worker.yaml b/charts/trino/templates/configmap-worker.yaml index d68570a7..36fc1511 100644 --- a/charts/trino/templates/configmap-worker.yaml +++ b/charts/trino/templates/configmap-worker.yaml @@ -9,6 +9,9 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} component: worker + {{- if .Values.commonLabels }} + {{- tpl (toYaml .Values.commonLabels) . | nindent 4 }} + {{- end }} data: node.properties: | node.environment={{ .Values.server.node.environment }} diff --git a/charts/trino/templates/deployment-coordinator.yaml b/charts/trino/templates/deployment-coordinator.yaml index cd9c1100..12ec8f36 100644 --- a/charts/trino/templates/deployment-coordinator.yaml +++ b/charts/trino/templates/deployment-coordinator.yaml @@ -8,6 +8,9 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} component: coordinator + {{- if .Values.commonLabels }} + {{- tpl (toYaml .Values.commonLabels) . | nindent 4 }} + {{- end }} spec: selector: matchLabels: diff --git a/charts/trino/templates/deployment-worker.yaml b/charts/trino/templates/deployment-worker.yaml index 70eb2abc..10b54942 100644 --- a/charts/trino/templates/deployment-worker.yaml +++ b/charts/trino/templates/deployment-worker.yaml @@ -9,6 +9,9 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} component: worker + {{- if .Values.commonLabels }} + {{- tpl (toYaml .Values.commonLabels) . | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.server.workers }} selector: diff --git a/charts/trino/values.yaml b/charts/trino/values.yaml index 1b638d21..834891fd 100644 --- a/charts/trino/values.yaml +++ b/charts/trino/values.yaml @@ -294,3 +294,5 @@ kafka: # ] # } # } + +commonLabels: {} # Labels that get applied to every resource's metadata