[bitnami/clickhouse] allow to set custom configuration for users folder (#17110)

* allow to set custom configuration for users

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>

* bump chart version

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>

---------

Signed-off-by: Emmanuel <emmanuelm41@gmail.com>
This commit is contained in:
Emmanuel
2023-06-28 09:19:31 -03:00
committed by GitHub
parent 52f902ece8
commit 5fc7713e3b
6 changed files with 67 additions and 3 deletions

View File

@@ -28,4 +28,4 @@ maintainers:
name: clickhouse
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/clickhouse
version: 3.4.4
version: 3.5.0

View File

@@ -156,6 +156,9 @@ The command removes all the Kubernetes components associated with the chart and
| `extraOverrides` | Extra configuration overrides (evaluated as a template) apart from the default | `""` |
| `extraOverridesConfigmap` | The name of an existing ConfigMap with extra configuration for ClickHouse | `""` |
| `extraOverridesSecret` | The name of an existing ConfigMap with your custom configuration for ClickHouse | `""` |
| `usersExtraOverrides` | Users extra configuration overrides (evaluated as a template) apart from the default | `""` |
| `usersExtraOverridesConfigmap` | The name of an existing ConfigMap with users extra configuration for ClickHouse | `""` |
| `usersExtraOverridesSecret` | The name of an existing ConfigMap with your custom users configuration for ClickHouse | `""` |
| `initdbScripts` | Dictionary of initdb scripts | `{}` |
| `initdbScriptsSecret` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`) | `""` |
| `startdbScripts` | Dictionary of startdb scripts | `{}` |
@@ -509,4 +512,4 @@ 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.
limitations under the License.

View File

@@ -99,6 +99,18 @@ Get the ClickHouse configuration configmap.
{{- end -}}
{{- end -}}
{{/*
Get the ClickHouse configuration users configmap.
*/}}
{{- define "clickhouse.usersExtraConfigmapName" -}}
{{- if .Values.usersExtraOverridesConfigmap -}}
{{- .Values.usersExtraOverridesConfigmap -}}
{{- else }}
{{- printf "%s-users-extra" (include "common.names.fullname" . ) -}}
{{- end -}}
{{- end -}}
{{/*
Get the Clickhouse password secret name
*/}}
@@ -195,7 +207,7 @@ Compile all warnings into a single message.
{{- if or (and .Values.keeper.enabled .Values.zookeeper.enabled) (and .Values.keeper.enabled .Values.externalZookeeper.servers) (and .Values.zookeeper.enabled .Values.externalZookeeper.servers) -}}
clickhouse: Multiple [Zoo]keeper
You can only use one [zoo]keeper
Please choose use ClickHouse keeper or
Please choose use ClickHouse keeper or
installing a Zookeeper chart (--set zookeeper.enabled=true) or
using an external instance (--set zookeeper.servers )
{{- end -}}

View File

@@ -0,0 +1,18 @@
{{- if and .Values.usersExtraOverrides (not .Values.usersExtraOverridesConfigmap) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-users-extra" (include "common.names.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: clickhouse
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
01_users_extra_overrides.xml: |
{{- include "common.tplvalues.render" (dict "value" .Values.usersExtraOverrides "context" $) | nindent 4 }}
{{- end }}

View File

@@ -33,6 +33,7 @@ spec:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") $ | sha256sum }}
checksum/config-extra: {{ include (print $.Template.BasePath "/configmap-extra.yaml") $ | sha256sum }}
checksum/config-users-extra: {{ include (print $.Template.BasePath "/configmap-users-extra.yaml") $ | sha256sum }}
{{- if $.Values.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" $.Values.podAnnotations "context" $) | nindent 8 }}
{{- end }}
@@ -316,10 +317,18 @@ spec:
- name: extra-config
mountPath: /bitnami/clickhouse/etc/conf.d/extra-configmap
{{- end }}
{{- if or $.Values.usersExtraOverridesConfigmap $.Values.usersExtraOverrides }}
- name: users-extra-config
mountPath: /bitnami/clickhouse/etc/users.d/users-extra-configmap
{{- end }}
{{- if $.Values.extraOverridesSecret }}
- name: extra-secret
mountPath: /bitnami/clickhouse/etc/conf.d/extra-secret
{{- end }}
{{- if $.Values.usersExtraOverridesSecret }}
- name: users-extra-secret
mountPath: /bitnami/clickhouse/etc/users.d/users-extra-secret
{{- end }}
{{- if $.Values.tls.enabled }}
- name: clickhouse-certificates
mountPath: /bitnami/clickhouse/certs
@@ -361,11 +370,21 @@ spec:
configMap:
name: {{ template "clickhouse.extraConfigmapName" $ }}
{{- end }}
{{- if or $.Values.usersExtraOverridesConfigmap $.Values.usersExtraOverrides }}
- name: users-extra-config
configMap:
name: {{ template "clickhouse.usersExtraConfigmapName" $ }}
{{- end }}
{{- if $.Values.extraOverridesSecret }}
- name: extra-secret
secret:
secretName: {{ $.Values.extraOverridesSecret }}
{{- end }}
{{- if $.Values.usersExtraOverridesSecret }}
- name: users-extra-secret
secret:
secretName: {{ $.Values.usersExtraOverridesSecret }}
{{- end }}
{{- if not $.Values.persistence.enabled }}
- name: data
emptyDir: {}

View File

@@ -395,6 +395,18 @@ extraOverridesConfigmap: ""
##
extraOverridesSecret: ""
## @param usersExtraOverrides Users extra configuration overrides (evaluated as a template) apart from the default
##
usersExtraOverrides: ""
## @param usersExtraOverridesConfigmap The name of an existing ConfigMap with users extra configuration for ClickHouse
##
usersExtraOverridesConfigmap: ""
## @param usersExtraOverridesSecret The name of an existing ConfigMap with your custom users configuration for ClickHouse
##
usersExtraOverridesSecret: ""
## @param initdbScripts Dictionary of initdb scripts
## Specify dictionary of scripts to be run at first boot
## Example: