Skip to content

Commit

Permalink
[KYUUBI #4004] [K8S][HELM] Add configuration files support to helm chart
Browse files Browse the repository at this point in the history
### _Why are the changes needed?_
The changes allow to:
1. set Kyuubi configuration files:
    - `kyuubi-env.sh`
    - `kyuubi-defaults.conf`
    - `log4j2.xml`
2. restart (recreate) Kyuubi server pods if configuration files have changed
    - this probably should be revisited after #3983

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #4004 from dnskr/helm_conf_files_support.

Closes #4004

8367825 [dnskr] [K8S][HELM] Add configuration files support to helm chart

Authored-by: dnskr <dnskrv88@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
  • Loading branch information
dnskr authored and pan3793 committed Dec 21, 2022
1 parent be5c3aa commit 9e7a8f2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
39 changes: 15 additions & 24 deletions docker/helm/templates/kyuubi-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,30 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-kyuubi-defaults
name: {{ .Release.Name }}
labels:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
{{- with .Values.server.conf.kyuubiEnv }}
kyuubi-env.sh: |
#!/usr/bin/env bash
{{- tpl . $ | nindent 4 }}
{{- end }}
kyuubi-defaults.conf: |
#
# 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.
#
## Kyuubi Configurations
#
# kyuubi.authentication NONE
#
## Helm chart provided Kyuubi configurations
kyuubi.frontend.bind.host={{ .Values.server.bind.host }}
kyuubi.frontend.bind.port={{ .Values.server.bind.port }}
kyuubi.kubernetes.namespace={{ .Release.Namespace }}
# Details in https://kyuubi.apache.org/docs/latest/deployment/settings.html
## User provided Kyuubi configurations
{{- with .Values.server.conf.kyuubiDefaults }}
{{- tpl . $ | nindent 4 }}
{{- end }}
{{- with .Values.server.conf.log4j2 }}
log4j2.xml: |
{{- tpl . $ | nindent 4 }}
{{- end }}
10 changes: 6 additions & 4 deletions docker/helm/templates/kyuubi-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
checksum/conf: {{ include (print $.Template.BasePath "/kyuubi-configmap.yaml") . | sha256sum }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -79,12 +81,12 @@ spec:
resources: {{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: kyuubi-defaults
mountPath: {{ .Values.server.conf.mountPath }}
- name: conf
mountPath: {{ .Values.server.confDir }}
volumes:
- name: kyuubi-defaults
- name: conf
configMap:
name: {{ .Release.Name }}-kyuubi-defaults
name: {{ .Release.Name }}
{{- with .Values.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
13 changes: 12 additions & 1 deletion docker/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,19 @@ server:
bind:
host: 0.0.0.0
port: 10009
confDir: /opt/kyuubi/conf
conf:
mountPath: /opt/kyuubi/conf
# The value (templated string) is used for kyuubi-env.sh file
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#environments for more details
kyuubiEnv: ~

# The value (templated string) is used for kyuubi-defaults.conf file
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#kyuubi-configurations for more details
kyuubiDefaults: ~

# The value (templated string) is used for log4j2.xml file
# See https://kyuubi.apache.org/docs/latest/deployment/settings.html#logging for more details
log4j2: ~

# Environment variables (templated)
env: []
Expand Down

0 comments on commit 9e7a8f2

Please sign in to comment.