kyuubi icon indicating copy to clipboard operation
kyuubi copied to clipboard

[K8S][HELM] Implement new configuration approach

Open dnskr opened this issue 1 year ago โ€ข 3 comments

:mag: Description

Issue References ๐Ÿ”—

This pull request changes Helm chart configuration approach as discussed in https://github.com/apache/kyuubi/issues/6123

Describe Your Solution ๐Ÿ”ง

Suggested implementation makes chart configuration more general and more flexible. It allows to configure Kyuubi (and its engines) by setting configuration file contents to chart properties or by providing configuration files through existing ConfigMaps and Secrets. Also users are not limited by predefined number of files and can put any files to configuration directories.

Types of changes :bookmark:

  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to change)

Test Plan ๐Ÿงช

Test suite "Kyuubi configuration"

Property file values-kyuubi-files.yaml

kyuubiConf:
  dir: /opt/kyuubi/conf
  files:
    'kyuubi-env.sh': |
      #!/usr/bin/env bash
      export KYUUBI_TEST=true
    'kyuubi-custom.properties': |
      kyuubi.custom=true
  filesFrom:
    - configMap:
        name: kyuubi-configs

ConfigMap kyuubi-configs from configmap-kyuubi-configs.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: kyuubi-configs
data:
  'kyuubi-test.properties': |
    kyuubi.config.test=true

Rendered templates are correct

$ helm template charts/kyuubi -f values-kyuubi-files.yaml -s templates/kyuubi-configmap.yaml -s templates/kyuubi-statefulset.yaml

Configuration files are in place

$ kubectl create -f configmap-kyuubi-configs.yaml
$ helm install kyuubi charts/kyuubi -f values-kyuubi-files.yaml
$ kubectl exec kyuubi-0 -- ls conf
kyuubi-custom.properties
kyuubi-defaults.conf
kyuubi-env.sh
kyuubi-test.properties

Test suite "Spark configuration"

Property file values-spark-files.yaml

sparkConf:
  dir: /opt/spark/conf
  files:
    'spark-env.sh': |
      #!/usr/bin/env bash
      export SPARK_TEST=true
    'spark-custom.properties': |
      spark.custom=true
  filesFrom:
    - configMap:
        name: spark-configs

ConfigMap spark-configs from configmap-spark-configs.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: spark-configs
data:
  'spark-test.properties': |
    spark.config.test=true

Rendered templates are correct

$ helm template charts/kyuubi -f values-spark-files.yaml -s templates/kyuubi-spark-configmap.yaml -s templates/kyuubi-statefulset.yaml

Configuration files are in place

$ kubectl create -f configmap-spark-configs.yaml
$ helm install kyuubi charts/kyuubi -f values-spark-files.yaml
$ kubectl exec kyuubi-0 -- ls ../spark/conf
spark-custom.properties
spark-env.sh
spark-test.properties

Test suite "Custom kyuubi-defaults.conf from existing ConfigMap"

Property file values-kyuubi-defaults.yaml

kyuubiConf:
  dir: /opt/kyuubi/conf
  filesFrom:
    - configMap:
        name: kyuubi-defaults-config

ConfigMap kyuubi-defaults-config from configmap-kyuubi-defaults.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: kyuubi-defaults-config
data:
  'kyuubi-defaults.conf': |
    custom.from.configmap=true

Rendered templates are correct

$ helm template charts/kyuubi -f values-kyuubi-defaults.yaml -s templates/kyuubi-configmap.yaml -s templates/kyuubi-statefulset.yaml

Content of kyuubi-defaults.conf comes from ConfigMap

$ kubectl create -f configmap-kyuubi-defaults.yaml
$ helm install kyuubi charts/kyuubi -f values-kyuubi-defaults.yaml
$ kubectl exec kyuubi-0 -- ls conf
kyuubi-defaults.conf
$ kubectl exec kyuubi-0 -- cat conf/kyuubi-defaults.conf
custom.from.configmap=true

Checklist ๐Ÿ“

Be nice. Be informative.

dnskr avatar Jul 02 '24 16:07 dnskr

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 0.00%. Comparing base (ad53eef) to head (452dca3). Report is 12 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #6521   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         687     687           
  Lines       42442   42442           
  Branches     5793    5793           
======================================
  Misses      42442   42442           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


๐Ÿšจ Try these New Features:

codecov-commenter avatar Jul 02 '24 17:07 codecov-commenter

It allows to configure Kyuubi (and its engines) by setting configuration file contents to chart properties or by providing configuration files through existing ConfigMaps and Secrets. Also users are not limited by predefined number of files and can put any files to configuration directories.

That sounds amazing. Sorry a little busy these days, will take a detailed look later (hopefully next week)

pan3793 avatar Jul 04 '24 15:07 pan3793

Also cc @zwangsheng and @zhaohehuhu who also deploy Kyuubi on K8s using Helm chart.

pan3793 avatar Jul 04 '24 15:07 pan3793

Merged to master

yaooqinn avatar Nov 22 '24 09:11 yaooqinn