From 3d38e4ffa66937a6720bd7f101b08280a7830f5b Mon Sep 17 00:00:00 2001 From: florianMalbranque Date: Wed, 4 Sep 2024 16:23:53 +0200 Subject: [PATCH] Fix mutualise resource definition --- charts/trino/templates/_helpers.tpl | 16 ---------- .../templates/configmap-access-control.yaml | 15 +++++++++ .../templates/configmap-coordinator.yaml | 31 ++----------------- charts/trino/templates/configmap-worker.yaml | 13 ++------ 4 files changed, 20 insertions(+), 55 deletions(-) create mode 100644 charts/trino/templates/configmap-access-control.yaml diff --git a/charts/trino/templates/_helpers.tpl b/charts/trino/templates/_helpers.tpl index e1682c8..48b3035 100644 --- a/charts/trino/templates/_helpers.tpl +++ b/charts/trino/templates/_helpers.tpl @@ -141,22 +141,6 @@ Create the name of the file auth secret to use {{- end }} -{{- define "trino.accessControlConfigMap" -}} -{{- if .Values.accessControl }}{{- if eq .Values.accessControl.type "configmap" }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "trino.fullname" . }}-access-control-volume - namespace: {{ .Release.Namespace }} - labels: - {{- include "trino.labels" . | nindent 4 }} -data: - {{- range $key, $val := .Values.accessControl.rules }} - {{ $key }}: {{ $val | quote }} - {{- end }} -{{- end }}{{- end }} -{{- end }} - {{- define "trino.accessControlProperties" -}} {{- if .Values.accessControl }} diff --git a/charts/trino/templates/configmap-access-control.yaml b/charts/trino/templates/configmap-access-control.yaml new file mode 100644 index 0000000..46ef458 --- /dev/null +++ b/charts/trino/templates/configmap-access-control.yaml @@ -0,0 +1,15 @@ +{{- define "trino.accessControlConfigMap" -}} +{{- if .Values.accessControl }}{{- if eq .Values.accessControl.type "configmap" }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "trino.fullname" . }}-access-control-volume + namespace: {{ .Release.Namespace }} + labels: + {{- include "trino.labels" . | nindent 4 }} +data: + {{- range $key, $val := .Values.accessControl.rules }} + {{ $key }}: {{ $val | quote }} + {{- end }} +{{- end }}{{- end }} +{{- end }} diff --git a/charts/trino/templates/configmap-coordinator.yaml b/charts/trino/templates/configmap-coordinator.yaml index 1f21acd..3e67393 100644 --- a/charts/trino/templates/configmap-coordinator.yaml +++ b/charts/trino/templates/configmap-coordinator.yaml @@ -122,41 +122,16 @@ data: {{- end }} {{ end }} -{{- if .Values.accessControl }} - {{ include "trino.accessControlProperties" . }} -{{- end }} -{{- range $fileName, $fileContent := .Values.worker.additionalConfigFiles }} +{{ include "trino.accessControlProperties" . }} + +{{- range $fileName, $fileContent := .Values.coordinator.additionalConfigFiles }} {{ $fileName }}: | {{- $fileContent | nindent 4 }} {{- end }} --- -{{- if .Values.accessControl }} - {{- if eq .Values.accessControl.type "configmap" }} - {{ include "trino.accessControlConfigMap" . }} - {{- end }} -{{- end }} - ---- -{{- if .Values.resourceGroups }} - -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "trino.fullname" . }}-resource-groups-volume-coordinator - namespace: {{ .Release.Namespace }} - labels: - {{- include "trino.labels" . | nindent 4 }} - app.kubernetes.io/component: coordinator -data: - resource-groups.json: |- - {{- .Values.resourceGroups.resourceGroupsConfig | nindent 4 }} -{{- end }} - ---- - apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/trino/templates/configmap-worker.yaml b/charts/trino/templates/configmap-worker.yaml index e5f24da..3e81f37 100644 --- a/charts/trino/templates/configmap-worker.yaml +++ b/charts/trino/templates/configmap-worker.yaml @@ -84,23 +84,14 @@ data: {{ end }} -{{- if .Values.accessControl }} - {{ include "trino.accessControlProperties" . }} -{{- end }} +{{ include "trino.accessControlProperties" . }} + {{- range $fileName, $fileContent := .Values.worker.additionalConfigFiles }} {{ $fileName }}: | {{- $fileContent | nindent 4 }} {{- end }} ---- - -{{- if .Values.accessControl }} - {{- if eq .Values.accessControl.type "configmap" }} - {{ include "trino.accessControlConfigMap" . }} - {{- end }} -{{- end }} - --- apiVersion: v1 kind: ConfigMap