Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions charts/kyuubi/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ In order to check the release status, use:
************************
******* Services *******
************************
{{- range $name, $frontend := .Values.server }}
{{- range $name, $frontend := .Values.api }}
{{- if $frontend.enabled }}
{{ $name | snakecase | upper }}:
- To access {{ $.Release.Name }}-{{ $name | kebabcase }} service within the cluster, use the following URL:
{{ $.Release.Name }}-{{ $name | kebabcase }}.{{ $.Release.Namespace }}.svc.cluster.local
{{- if $.Values.kyuubiConf.kyuubiDefaults }}
{{- if regexMatch "(^|\\s)kyuubi.frontend.bind.host\\s*=?\\s*(localhost|127\\.0\\.0\\.1)($|\\s)" $.Values.kyuubiConf.kyuubiDefaults }}
{{- if $.Values.server.conf.kyuubiDefaults }}
{{- if regexMatch "(^|\\s)kyuubi.frontend.bind.host\\s*=?\\s*(localhost|127\\.0\\.0\\.1)($|\\s)" $.Values.server.conf.kyuubiDefaults }}
- To access {{ $.Release.Name }}-{{ $name | kebabcase }} service from outside the cluster for debugging, run the following command:
kubectl port-forward svc/{{ $.Release.Name }}-{{ $name | kebabcase }} {{ tpl $frontend.service.port $ }}:{{ tpl $frontend.service.port $ }} -n {{ $.Release.Namespace }}
and use 127.0.0.1:{{ tpl $frontend.service.port $ }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kyuubi/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For details, see 'kyuubi.frontend.protocols': https://kyuubi.readthedocs.io/en/m
*/}}
{{- define "kyuubi.frontend.protocols" -}}
{{- $protocols := list }}
{{- range $name, $frontend := .Values.server }}
{{- range $name, $frontend := .Values.api }}
{{- if $frontend.enabled }}
{{- $protocols = $name | snakecase | upper | append $protocols }}
{{- end }}
Expand Down
19 changes: 10 additions & 9 deletions charts/kyuubi/templates/kyuubi-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,30 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
labels: {{- include "kyuubi.labels" . | nindent 4 }}
data:
{{- with .Values.kyuubiConf.kyuubiEnv }}
{{- with .Values.server.conf.kyuubiEnv }}
kyuubi-env.sh: |
#!/usr/bin/env bash
{{- tpl . $ | nindent 4 }}
{{- end }}

kyuubi-defaults.conf: |
## Helm chart provided Kyuubi configurations
kyuubi.kubernetes.namespace={{ .Release.Namespace }}
kyuubi.frontend.connection.url.use.hostname=false
kyuubi.frontend.thrift.binary.bind.port={{ .Values.server.thriftBinary.port }}
kyuubi.frontend.thrift.http.bind.port={{ .Values.server.thriftHttp.port }}
kyuubi.frontend.rest.bind.port={{ .Values.server.rest.port }}
kyuubi.frontend.mysql.bind.port={{ .Values.server.mysql.port }}
kyuubi.frontend.thrift.binary.bind.port={{ .Values.api.thriftBinary.port }}
kyuubi.frontend.thrift.http.bind.port={{ .Values.api.thriftHttp.port }}
kyuubi.frontend.rest.bind.port={{ .Values.api.rest.port }}
kyuubi.frontend.mysql.bind.port={{ .Values.api.mysql.port }}
kyuubi.frontend.protocols={{ include "kyuubi.frontend.protocols" . }}

## User provided Kyuubi configurations
{{- with .Values.kyuubiConf.kyuubiDefaults }}
{{- with .Values.server.conf.kyuubiDefaults }}
{{- tpl . $ | nindent 4 }}
{{- end }}
{{- with .Values.kyuubiConf.log4j2 }}

{{- with .Values.server.conf.log4j2 }}
log4j2.xml: |
{{- tpl . $ | nindent 4 }}
{{- end }}
70 changes: 36 additions & 34 deletions charts/kyuubi/templates/kyuubi-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
labels: {{- include "kyuubi.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.server.replicas }}
selector:
matchLabels:
{{- include "kyuubi.selectorLabels" . | nindent 6 }}
matchLabels: {{- include "kyuubi.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "kyuubi.selectorLabels" . | nindent 8 }}
labels: {{- include "kyuubi.selectorLabels" . | nindent 8 }}
annotations:
checksum/conf: {{ include (print $.Template.BasePath "/kyuubi-configmap.yaml") . | sha256sum }}
spec:
Expand All @@ -39,80 +36,85 @@ spec:
{{- if or .Values.serviceAccount.name .Values.serviceAccount.create }}
serviceAccountName: {{ .Values.serviceAccount.name | default .Release.Name }}
{{- end }}
{{- with .Values.initContainers }}
{{- with .Values.server.initContainers }}
initContainers: {{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
containers:
- name: kyuubi-server
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.command }}
{{- with .Values.server.command }}
command: {{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
{{- with .Values.args }}
{{- with .Values.server.args }}
args: {{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
{{- with .Values.env }}
{{- with .Values.server.env }}
env: {{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
{{- with .Values.envFrom }}
{{- with .Values.server.envFrom }}
envFrom: {{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
ports:
{{- range $name, $frontend := .Values.server }}
{{- range $name, $frontend := .Values.api }}
{{- if $frontend.enabled }}
- name: {{ $name | kebabcase }}
containerPort: {{ $frontend.port }}
{{- end }}
{{- end }}
{{- if .Values.probe.liveness.enabled }}
{{- if .Values.server.livenessProbe.enabled }}
livenessProbe:
exec:
command: ["/bin/bash", "-c", "bin/kyuubi status"]
initialDelaySeconds: {{ .Values.probe.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.probe.liveness.periodSeconds }}
timeoutSeconds: {{ .Values.probe.liveness.timeoutSeconds }}
failureThreshold: {{ .Values.probe.liveness.failureThreshold }}
successThreshold: {{ .Values.probe.liveness.successThreshold }}
initialDelaySeconds: {{ .Values.server.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.server.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.server.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.server.livenessProbe.failureThreshold }}
successThreshold: {{ .Values.server.livenessProbe.successThreshold }}
{{- end }}
{{- if .Values.probe.readiness.enabled }}
{{- if .Values.server.readinessProbe.enabled }}
readinessProbe:
exec:
command: ["/bin/bash", "-c", "$KYUUBI_HOME/bin/kyuubi status"]
initialDelaySeconds: {{ .Values.probe.readiness.initialDelaySeconds }}
periodSeconds: {{ .Values.probe.readiness.periodSeconds }}
timeoutSeconds: {{ .Values.probe.readiness.timeoutSeconds }}
failureThreshold: {{ .Values.probe.readiness.failureThreshold }}
successThreshold: {{ .Values.probe.readiness.successThreshold }}
initialDelaySeconds: {{ .Values.server.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.server.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.server.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.server.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.server.readinessProbe.successThreshold }}
{{- end }}
{{- with .Values.resources }}
{{- with .Values.server.resources }}
resources: {{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: conf
mountPath: {{ .Values.kyuubiConfDir }}
{{- with .Values.volumeMounts }}
mountPath: {{ .Values.server.confDir }}
- name: conf-spark
mountPath: {{ .Values.engine.spark.confDir }}
{{- with .Values.server.volumeMounts }}
{{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
{{- with .Values.containers }}
{{- with .Values.server.containers }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
volumes:
- name: conf
configMap:
name: {{ .Release.Name }}
{{- with .Values.volumes }}
- name: conf-spark
configMap:
name: {{ .Release.Name }}-spark
{{- with .Values.server.volumes }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
{{- with .Values.server.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
{{- with .Values.server.affinity }}
affinity: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
{{- with .Values.server.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.securityContext }}
{{- with .Values.server.securityContext }}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
3 changes: 1 addition & 2 deletions charts/kyuubi/templates/kyuubi-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Release.Name }}
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
labels: {{- include "kyuubi.labels" . | nindent 4 }}
rules: {{- toYaml .Values.rbac.rules | nindent 2 }}
{{- end }}
3 changes: 1 addition & 2 deletions charts/kyuubi/templates/kyuubi-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
labels: {{- include "kyuubi.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.name | default .Release.Name }}
Expand Down
5 changes: 2 additions & 3 deletions charts/kyuubi/templates/kyuubi-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
limitations under the License.
*/}}

{{- range $name, $frontend := .Values.server }}
{{- range $name, $frontend := .Values.api }}
{{- if $frontend.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ $.Release.Name }}-{{ $name | kebabcase }}
labels:
{{- include "kyuubi.labels" $ | nindent 4 }}
labels: {{- include "kyuubi.labels" $ | nindent 4 }}
{{- with $frontend.service.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
3 changes: 1 addition & 2 deletions charts/kyuubi/templates/kyuubi-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount.name | default .Release.Name }}
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
labels: {{- include "kyuubi.labels" . | nindent 4 }}
{{- end }}
91 changes: 91 additions & 0 deletions charts/kyuubi/templates/spark-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-spark
labels: {{- include "kyuubi.labels" . | nindent 4 }}
data:
{{- with .Values.engine.spark.conf.sparkEnv }}
spark-env.sh: |
#!/usr/bin/env bash
{{- tpl . $ | nindent 4 }}
{{- end }}

spark-defaults.conf: |
## Helm chart provided Spark configurations
spark.submit.deployMode=cluster

spark.master={{ .Values.engine.spark.master }}
spark.kubernetes.namespace={{ .Values.engine.spark.namespace | default .Release.Namespace }}

spark.kubernetes.authenticate.driver.serviceAccountName={{ .Values.engine.spark.serviceAccount.name | default (printf "%s-spark" .Release.Name) }}
spark.kubernetes.authenticate.executor.serviceAccountName={{ .Values.engine.spark.serviceAccount.name | default (printf "%s-spark" .Release.Name) }}

### Image properties
spark.kubernetes.container.image={{ .Values.engine.spark.image.repository }}:{{ .Values.engine.spark.image.tag }}
spark.kubernetes.container.image.pullPolicy={{ .Values.engine.spark.image.pullPolicy }}
spark.kubernetes.container.image.pullSecrets={{ range .Values.imagePullSecrets }}{{ print .name "," }}{{ end }}

### Driver resources
Copy link
Member

@pan3793 pan3793 Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is kind of over-engineering stuff.

One advantage of Kyuubi is, it almost transparently supports all Spark features, users who are familiar w/ Spark, should easy to understand how Kyuubi works and how to configure the Spark engine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we can put everything in spark-defaults.conf to values.yaml's sparkDefaults block, in Spark native configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it is over-engineered implementation and it might confuse users about what to configure and where.
I would like to find some balance between convenient basic configuration and flexibility, but obviously it is not the best implementation.

spark.driver.cores={{ .Values.engine.spark.driver.resources.cores }}
{{- with .Values.engine.spark.driver.resources.coresRequest }}
spark.kubernetes.driver.request.cores={{ . }}
{{- end }}
{{- with .Values.engine.spark.driver.resources.coresLimit }}
spark.kubernetes.driver.limit.cores={{ . }}
{{- end }}
spark.driver.memory={{ .Values.engine.spark.driver.resources.memory }}
{{- with .Values.engine.spark.driver.resources.memoryOverhead }}
spark.driver.memoryOverhead={{ . }}
{{- end }}
{{- with .Values.engine.spark.driver.resources.memoryOverheadFactor }}
spark.driver.memoryOverheadFactor={{ . }}
{{- end }}

### Executor resources
spark.executor.instances={{ .Values.engine.spark.executor.instances }}
spark.executor.cores={{ .Values.engine.spark.executor.resources.cores }}
{{- with .Values.engine.spark.executor.resources.coresRequest }}
spark.kubernetes.executor.request.cores={{ . }}
{{- end }}
{{- with .Values.engine.spark.executor.resources.coresLimit }}
spark.kubernetes.executor.limit.cores={{ . }}
{{- end }}
spark.executor.memory={{ .Values.engine.spark.executor.resources.memory }}
{{- with .Values.engine.spark.executor.resources.memoryOverhead }}
spark.executor.memoryOverhead={{ . }}
{{- end }}
{{- with .Values.engine.spark.executor.resources.memoryOverheadFactor }}
spark.executor.memoryOverheadFactor={{ . }}
{{- end }}

## User provided Spark configurations
{{- with .Values.engine.spark.conf.sparkDefaults }}
{{- tpl . $ | nindent 4 }}
{{- end }}

{{- with .Values.engine.spark.conf.driverPodTemplate }}
driver-pod-template.yaml: |
{{- tpl . $ | nindent 4 }}
{{- end }}

{{- with .Values.engine.spark.conf.executorPodTemplate }}
executor-pod-template.yaml: |
{{- tpl . $ | nindent 4 }}
{{- end }}
31 changes: 31 additions & 0 deletions charts/kyuubi/templates/spark-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}

{{- if .Values.engine.spark.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Release.Name }}-spark
{{- if .Values.engine.spark.namespace }}
namespace: {{ .Values.engine.spark.namespace }}
{{- end }}
labels: {{- include "kyuubi.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["configmaps", "pods", "services"]
verbs: ["list", "create", "get", "watch", "delete"]
{{- end }}
Loading