From ac06447706864150af2ee0252394984223eefa07 Mon Sep 17 00:00:00 2001 From: Emile M <85408372+EBMBA@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:18:50 +0100 Subject: [PATCH] fix: add conditional logic for datastore (#386) * feat: Add conditional logic for datastore * bump helm chart version * chore: update helm chart documentation --- charts/kamaji/Chart.yaml | 2 +- charts/kamaji/README.md | 5 +++-- charts/kamaji/templates/_helpers_datastore.tpl | 4 ++++ charts/kamaji/templates/datastore.yaml | 2 ++ charts/kamaji/values.yaml | 4 +++- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/charts/kamaji/Chart.yaml b/charts/kamaji/Chart.yaml index e373ca3f..f9ded56d 100644 --- a/charts/kamaji/Chart.yaml +++ b/charts/kamaji/Chart.yaml @@ -15,7 +15,7 @@ name: kamaji sources: - https://github.com/clastix/kamaji type: application -version: 0.12.8 +version: 0.12.9 annotations: catalog.cattle.io/certified: partner catalog.cattle.io/release-name: kamaji diff --git a/charts/kamaji/README.md b/charts/kamaji/README.md index 6fb50c00..909d6a17 100644 --- a/charts/kamaji/README.md +++ b/charts/kamaji/README.md @@ -1,6 +1,6 @@ # kamaji -![Version: 0.12.8](https://img.shields.io/badge/Version-0.12.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.3.5](https://img.shields.io/badge/AppVersion-v0.3.5-informational?style=flat-square) +![Version: 0.12.9](https://img.shields.io/badge/Version-0.12.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.3.5](https://img.shields.io/badge/AppVersion-v0.3.5-informational?style=flat-square) Kamaji is a Kubernetes Control Plane Manager. @@ -73,8 +73,9 @@ Here the values you can override: | datastore.basicAuth.usernameSecret.name | string | `nil` | The name of the Secret containing the username used to connect to the relational database. | | datastore.basicAuth.usernameSecret.namespace | string | `nil` | The namespace of the Secret containing the username used to connect to the relational database. | | datastore.driver | string | `"etcd"` | (string) The Kamaji Datastore driver, supported: etcd, MySQL, PostgreSQL (defaults=etcd). | +| datastore.enabled | bool | `true` | (bool) Enable the Kamaji Datastore creation (default=true) | | datastore.endpoints | list | `[]` | (array) List of endpoints of the selected Datastore. When letting the Chart install the etcd datastore, this field is populated automatically. | -| datastore.nameOverride | string | `nil` | The Datastore name override, if empty defaults to `default` | +| datastore.nameOverride | string | `nil` | The Datastore name override, if empty and enabled=true defaults to `default`, if enabled=false, this is the name of the Datastore to connect to. | | datastore.tlsConfig.certificateAuthority.certificate.keyPath | string | `nil` | Key of the Secret which contains the content of the certificate. | | datastore.tlsConfig.certificateAuthority.certificate.name | string | `nil` | Name of the Secret containing the CA required to establish the mandatory SSL/TLS connection to the datastore. | | datastore.tlsConfig.certificateAuthority.certificate.namespace | string | `nil` | Namespace of the Secret containing the CA required to establish the mandatory SSL/TLS connection to the datastore. | diff --git a/charts/kamaji/templates/_helpers_datastore.tpl b/charts/kamaji/templates/_helpers_datastore.tpl index b7b4698b..3ed2c16e 100644 --- a/charts/kamaji/templates/_helpers_datastore.tpl +++ b/charts/kamaji/templates/_helpers_datastore.tpl @@ -2,7 +2,11 @@ Create a default fully qualified datastore name. */}} {{- define "datastore.fullname" -}} +{{- if .Values.datastore.enabled }} {{- default "default" .Values.datastore.nameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- required "A valid .Values.datastore.nameOverride required!" .Values.datastore.nameOverride }} +{{- end }} {{- end }} {{/* diff --git a/charts/kamaji/templates/datastore.yaml b/charts/kamaji/templates/datastore.yaml index 60a84ffe..b54ef99a 100644 --- a/charts/kamaji/templates/datastore.yaml +++ b/charts/kamaji/templates/datastore.yaml @@ -1,3 +1,4 @@ +{{- if .Values.datastore.enabled}} apiVersion: kamaji.clastix.io/v1alpha1 kind: DataStore metadata: @@ -24,3 +25,4 @@ spec: {{- include "datastore.certificateAuthority" . | indent 6 }} clientCertificate: {{- include "datastore.clientCertificate" . | indent 6 }} +{{- end}} diff --git a/charts/kamaji/values.yaml b/charts/kamaji/values.yaml index d8aec6b4..092b3fdd 100644 --- a/charts/kamaji/values.yaml +++ b/charts/kamaji/values.yaml @@ -157,7 +157,9 @@ loggingDevel: enable: false datastore: - # -- (string) The Datastore name override, if empty defaults to `default` + # -- (bool) Enable the Kamaji Datastore creation (default=true) + enabled: true + # -- (string) The Datastore name override, if empty and enabled=true defaults to `default`, if enabled=false, this is the name of the Datastore to connect to. nameOverride: # -- (string) The Kamaji Datastore driver, supported: etcd, MySQL, PostgreSQL (defaults=etcd). driver: etcd