Helm: add support for external application config in yaml format (#2020)

* support yamlConfigMap

* add support of external config map

* remove test config

* update helm version and readme

* pass kafka-ui.yaml directly as helm chart value

* fix configmap metadata name

* update readme

Co-authored-by: Azat Safin <azsafin@provectus.com>
Co-authored-by: Roman Zabaluev <rzabaluev@provectus.com>
This commit is contained in:
azatsafin 2022-06-07 00:46:01 +03:00 committed by GitHub
parent e6f3157508
commit f98c26e4fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 96 additions and 22 deletions

View file

@ -2,6 +2,6 @@ apiVersion: v2
name: kafka-ui
description: A Helm chart for kafka-UI
type: application
version: 0.0.3
version: 0.0.4
appVersion: latest
icon: https://github.com/provectus/kafka-ui/raw/master/documentation/images/kafka-ui-logo.png

View file

@ -7,16 +7,19 @@ Most of the Helm charts parameters are common, follow table describe unique para
### Kafka-UI parameters
| Parameter | Description | Default |
|---|---|---|
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `existingConfigMap` | Name of the existing ConfigMap with Kafka-UI environment variables | `nil` |
| `existingSecret` | Name of the existing Secret with Kafka-UI environment variables | `nil` |
| `envs.secret` | Set of the sensitive environment variables to pass to Kafka-UI | `{}` |
| `envs.config` | Set of the environment variables to pass to Kafka-UI | `{}` |
| `yamlApplicationConfigConfigMap` | Map with name and keyName keys, name refers to the existing ConfigMap, keyName refers to the ConfigMap key with Kafka-UI config in Yaml format | `{}` |
| `yamlApplicationConfig` | Kafka-UI config in Yaml format | `{}` |
| `networkPolicy.enabled` | Enable network policies | `false` |
| `networkPolicy.egressRules.customRules` | Custom network egress policy rules | `[]` |
| `networkPolicy.ingressRules.customRules` | Custom network ingress policy rules | `[]` |
| `podLabels` | Extra labels for Kafka-UI pod | `{}` |
## Example
To install Kafka-UI need to execute follow:

View file

@ -1,3 +1,4 @@
{{- if .Values.envs.config -}}
apiVersion: v1
kind: ConfigMap
metadata:
@ -6,3 +7,4 @@ metadata:
{{- include "kafka-ui.labels" . | nindent 4 }}
data:
{{- toYaml .Values.envs.config | nindent 2 }}
{{- end -}}

View file

@ -0,0 +1,11 @@
{{- if .Values.yamlApplicationConfig -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "kafka-ui.fullname" . }}-fromvalues
labels:
{{- include "kafka-ui.labels" . | nindent 4 }}
data:
config.yml:
{{- toYaml .Values.yamlApplicationConfig | nindent 4}}
{{ end }}

View file

@ -42,23 +42,37 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.env }}
{{- if or .Values.env .Values.yamlApplicationConfig .Values.yamlApplicationConfigConfigMap}}
env:
{{- with .Values.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if or .Values.yamlApplicationConfig .Values.yamlApplicationConfigConfigMap}}
- name: SPRING_CONFIG_LOCATION
{{- if .Values.yamlApplicationConfig }}
value: /kafka-ui/config.yml
{{- else if .Values.yamlApplicationConfigConfigMap }}
value: /kafka-ui/{{ .Values.yamlApplicationConfigConfigMap.keyName | default "config.yml" }}
{{- end }}
{{- end }}
{{- end }}
envFrom:
{{- if .Values.existingConfigMap }}
- configMapRef:
name: {{ .Values.existingConfigMap }}
{{- end }}
{{- if .Values.envs.config }}
- configMapRef:
name: {{ include "kafka-ui.fullname" . }}
{{- end }}
{{- if .Values.existingSecret }}
- secretRef:
name: {{ .Values.existingSecret }}
{{- end }}
{{- if .Values.envs.secret}}
- secretRef:
name: {{ include "kafka-ui.fullname" . }}
{{- end}}
ports:
- name: http
containerPort: 8080
@ -81,14 +95,36 @@ spec:
timeoutSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
{{- if or .Values.yamlApplicationConfig .Values.volumeMounts .Values.yamlApplicationConfigConfigMap}}
volumeMounts:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
{{- if .Values.yamlApplicationConfig }}
- name: kafka-ui-yaml-conf
mountPath: /kafka-ui/
{{- end }}
{{- if .Values.yamlApplicationConfigConfigMap}}
- name: kafka-ui-yaml-conf-configmap
mountPath: /kafka-ui/
{{- end }}
{{- end }}
{{- if or .Values.yamlApplicationConfig .Values.volumes .Values.yamlApplicationConfigConfigMap}}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.yamlApplicationConfig }}
- name: kafka-ui-yaml-conf
configMap:
name: {{ include "kafka-ui.fullname" . }}-fromvalues
{{- end }}
{{- if .Values.yamlApplicationConfigConfigMap}}
- name: kafka-ui-yaml-conf-configmap
configMap:
name: {{ .Values.yamlApplicationConfigConfigMap.name }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}

View file

@ -21,6 +21,25 @@ serviceAccount:
name: ""
existingConfigMap: ""
yamlApplicationConfig:
{}
# kafka:
# clusters:
# - name: yaml
# bootstrapServers: kafka-service:9092
# spring:
# security:
# oauth2:
# auth:
# type: disabled
# management:
# health:
# ldap:
# enabled: false
yamlApplicationConfigConfigMap:
{}
# keyName: config.yml
# name: configMapName
existingSecret: ""
envs:
secret: {}
@ -50,10 +69,12 @@ networkPolicy:
podAnnotations: {}
podLabels: {}
podSecurityContext: {}
podSecurityContext:
{}
# fsGroup: 2000
securityContext: {}
securityContext:
{}
# capabilities:
# drop:
# - ALL
@ -97,7 +118,8 @@ ingress:
# Http paths to add to the Ingress after the default path
succeedingPaths: []
resources: {}
resources:
{}
# limits:
# cpu: 200m
# memory: 512Mi