From b8ef7a09e54a98b87e3efc5d9d42d3fb556c6834 Mon Sep 17 00:00:00 2001 From: ubuntu Date: Thu, 29 Apr 2021 16:48:08 +0200 Subject: [PATCH 1/5] Add ingress and catalog configmap iterator --- templates/_helpers.tpl | 4 +++ templates/configmap-catalog.yaml | 16 +++++++++ templates/configmap-coordinator.yaml | 3 ++ templates/deployment-coordinator.yaml | 5 +++ templates/deployment-worker.yaml | 5 +++ templates/ingress.yaml | 32 ++++++++++++++++++ values.yaml | 47 +++++++++++++++++++++++++-- 7 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 templates/configmap-catalog.yaml create mode 100644 templates/ingress.yaml diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index ea0a1da5..1b189135 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -38,3 +38,7 @@ Create chart name and version as used by the chart label. {{- define "trino.worker" -}} {{ template "trino.fullname" . }}-worker {{- end -}} + +{{- define "trino.catalog" -}} +{{ template "trino.fullname" . }}-catalog +{{- end -}} \ No newline at end of file diff --git a/templates/configmap-catalog.yaml b/templates/configmap-catalog.yaml new file mode 100644 index 00000000..6c40f5c1 --- /dev/null +++ b/templates/configmap-catalog.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "trino.catalog" . }} + labels: + app: {{ template "trino.name" . }} + chart: {{ template "trino.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: catalog +data: +{{- range $key, $val := .Values.server.catalogs }} + {{ $key }}: | {{ $val | nindent 4 }} +{{- end }} + +--- \ No newline at end of file diff --git a/templates/configmap-coordinator.yaml b/templates/configmap-coordinator.yaml index 92c05bca..eb8074ac 100644 --- a/templates/configmap-coordinator.yaml +++ b/templates/configmap-coordinator.yaml @@ -37,6 +37,9 @@ data: query.max-memory-per-node={{ .Values.server.config.query.maxMemoryPerNode }} discovery-server.enabled=true discovery.uri=http://localhost:{{ .Values.service.port }} +{{- if .Values.oauth.enabled }} +{{- .Values.oauth.config | nindent 4 }} +{{- end }} log.properties: | io.trinosql={{ .Values.server.log.trino.level }} diff --git a/templates/deployment-coordinator.yaml b/templates/deployment-coordinator.yaml index f35f0e47..530a903d 100644 --- a/templates/deployment-coordinator.yaml +++ b/templates/deployment-coordinator.yaml @@ -30,6 +30,9 @@ spec: - name: config-volume configMap: name: {{ template "trino.coordinator" . }} + - name: catalog-volume + configMap: + name: {{ template "trino.catalog" . }} containers: - name: {{ .Chart.Name }}-coordinator image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -37,6 +40,8 @@ spec: volumeMounts: - mountPath: {{ .Values.server.config.path }} name: config-volume + - mountPath: {{ .Values.server.config.path }}/catalog + name: catalog-volume ports: - name: http containerPort: {{ .Values.service.port }} diff --git a/templates/deployment-worker.yaml b/templates/deployment-worker.yaml index 1ea38e9c..70d96e4c 100644 --- a/templates/deployment-worker.yaml +++ b/templates/deployment-worker.yaml @@ -27,6 +27,9 @@ spec: - name: config-volume configMap: name: {{ template "trino.worker" . }} + - name: catalog-volume + configMap: + name: {{ template "trino.catalog" . }} containers: - name: {{ .Chart.Name }}-worker image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -34,6 +37,8 @@ spec: volumeMounts: - mountPath: {{ .Values.server.config.path }} name: config-volume + - mountPath: {{ .Values.server.config.path }}/catalog + name: catalog-volume ports: - name: http containerPort: {{ .Values.service.port }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml new file mode 100644 index 00000000..058428b0 --- /dev/null +++ b/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled }} +{{- $serviceName := printf "%s" ( include "trino.name" .) }} +{{- $servicePort := .Values.service.port }} +{{- $ingressPath := .Values.ingress.path }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "trino.fullname" . }} + labels: + app: {{ template "trino.name" . }} + chart: {{ template "trino.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . | quote }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: {{ toYaml .Values.ingress.tls | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index 7895f990..c8d280b6 100644 --- a/values.yaml +++ b/values.yaml @@ -31,14 +31,55 @@ server: g1: heapRegionSize: "32M" -securityContext: - runAsUser: 1000 - runAsGroup: 1000 + catalogs: + datalake.properties: | + connector.name=hive-hadoop2 + hive.metastore=file + hive.s3-file-system-type=TRINO + hive.metastore.catalog.dir=s3:/// + hive.s3.aws-access-key= + hive.s3.aws-secret-key=secretKey + hive.s3.endpoint= + hive.s3.path-style-access=true + hive.s3select-pushdown.enabled=true + hive.s3.ssl.enabled=false + +oauth: + enabled: false + config: | + http-server.authentication.type=oauth2 + http-server.authentication.oauth2.auth-url= + http-server.authentication.oauth2.token-url= + http-server.authentication.oauth2.jwks-url= + http-server.authentication.oauth2.client-id= + http-server.authentication.oauth2.client-secret= + http-server.authentication.oauth2.scopes= + web-ui.authentication.type=oauth2 + +ingress: + ## Set to true to enable ingress record generation + enabled: true + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + labels: {} + path: / + pathType: Prefix + hosts: + - host.example.com + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local service: type: ClusterIP port: 8080 +securityContext: + runAsUser: 1000 + runAsGroup: 1000 + resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little From 78fdc5a3b1828b741ab71a5a5829f3447a82693e Mon Sep 17 00:00:00 2001 From: ubuntu Date: Thu, 29 Apr 2021 16:50:36 +0200 Subject: [PATCH 2/5] Add newline --- templates/_helpers.tpl | 2 +- templates/configmap-catalog.yaml | 2 -- templates/ingress.yaml | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 1b189135..b52077b3 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -41,4 +41,4 @@ Create chart name and version as used by the chart label. {{- define "trino.catalog" -}} {{ template "trino.fullname" . }}-catalog -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/templates/configmap-catalog.yaml b/templates/configmap-catalog.yaml index 6c40f5c1..70c270bc 100644 --- a/templates/configmap-catalog.yaml +++ b/templates/configmap-catalog.yaml @@ -12,5 +12,3 @@ data: {{- range $key, $val := .Values.server.catalogs }} {{ $key }}: | {{ $val | nindent 4 }} {{- end }} - ---- \ No newline at end of file diff --git a/templates/ingress.yaml b/templates/ingress.yaml index 058428b0..bcd08aff 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -29,4 +29,4 @@ spec: {{- if .Values.ingress.tls }} tls: {{ toYaml .Values.ingress.tls | nindent 4 }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} From 9000077ce78761da7789446f5a22e39677aeb6d9 Mon Sep 17 00:00:00 2001 From: ubuntu Date: Thu, 29 Apr 2021 16:52:06 +0200 Subject: [PATCH 3/5] Set ingress default to false --- values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/values.yaml b/values.yaml index c8d280b6..0c8372e3 100644 --- a/values.yaml +++ b/values.yaml @@ -58,7 +58,7 @@ oauth: ingress: ## Set to true to enable ingress record generation - enabled: true + enabled: false annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" @@ -66,7 +66,7 @@ ingress: path: / pathType: Prefix hosts: - - host.example.com + - chart-example.local tls: [] # - secretName: chart-example-tls # hosts: From 6494c8b9a6914deedc0b11f082850952ef770c21 Mon Sep 17 00:00:00 2001 From: ubuntu Date: Thu, 29 Apr 2021 17:50:17 +0200 Subject: [PATCH 4/5] Add enabled boolean to catalogs --- templates/configmap-catalog.yaml | 4 +++- values.yaml | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/templates/configmap-catalog.yaml b/templates/configmap-catalog.yaml index 70c270bc..73103348 100644 --- a/templates/configmap-catalog.yaml +++ b/templates/configmap-catalog.yaml @@ -1,3 +1,4 @@ +{{-if .Values.server.catalogs.enabled }} apiVersion: v1 kind: ConfigMap metadata: @@ -9,6 +10,7 @@ metadata: heritage: {{ .Release.Service }} component: catalog data: -{{- range $key, $val := .Values.server.catalogs }} +{{- range $key, $val := .Values.server.catalogs.configs }} {{ $key }}: | {{ $val | nindent 4 }} {{- end }} +{{- end }} diff --git a/values.yaml b/values.yaml index 0c8372e3..e45bb039 100644 --- a/values.yaml +++ b/values.yaml @@ -32,17 +32,19 @@ server: heapRegionSize: "32M" catalogs: - datalake.properties: | - connector.name=hive-hadoop2 - hive.metastore=file - hive.s3-file-system-type=TRINO - hive.metastore.catalog.dir=s3:/// - hive.s3.aws-access-key= - hive.s3.aws-secret-key=secretKey - hive.s3.endpoint= - hive.s3.path-style-access=true - hive.s3select-pushdown.enabled=true - hive.s3.ssl.enabled=false + enabled: false + configs: + datalake.properties: | + connector.name=hive-hadoop2 + hive.metastore=file + hive.s3-file-system-type=TRINO + hive.metastore.catalog.dir=s3:/// + hive.s3.aws-access-key= + hive.s3.aws-secret-key=secretKey + hive.s3.endpoint= + hive.s3.path-style-access=true + hive.s3select-pushdown.enabled=true + hive.s3.ssl.enabled=false oauth: enabled: false From 25205fa99a8e2d8368597ea8152da5d01e3aadef Mon Sep 17 00:00:00 2001 From: Adrian Rico Date: Fri, 30 Apr 2021 13:21:59 +0200 Subject: [PATCH 5/5] Add missing space to if statement --- templates/configmap-catalog.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/configmap-catalog.yaml b/templates/configmap-catalog.yaml index 73103348..9df08995 100644 --- a/templates/configmap-catalog.yaml +++ b/templates/configmap-catalog.yaml @@ -1,4 +1,4 @@ -{{-if .Values.server.catalogs.enabled }} +{{- if .Values.server.catalogs.enabled }} apiVersion: v1 kind: ConfigMap metadata: