From b2014bd20f567ef97c2ce07d9fdea5aca0472279 Mon Sep 17 00:00:00 2001 From: Juan Ariza Toledano Date: Mon, 30 Mar 2020 10:28:49 +0200 Subject: [PATCH] [bitnami/cassandra] Stop supporting custom config & init scripts through files directory (#2152) * [bitnami/cassandra] Stop support custom config & init scripts through files directory Signed-off-by: juan131 * [bitnami/cassandra] Update components versions Signed-off-by: Bitnami Containers --- bitnami/cassandra/Chart.yaml | 2 +- bitnami/cassandra/README.md | 37 +++++++++++++------ bitnami/cassandra/files/conf/README.md | 3 -- .../docker-entrypoint-initdb.d/README.md | 3 -- bitnami/cassandra/templates/_helpers.tpl | 22 ----------- .../cassandra/templates/configuration-cm.yaml | 9 ----- .../cassandra/templates/initdb-configmap.yaml | 9 ----- bitnami/cassandra/templates/statefulset.yaml | 12 +++--- bitnami/cassandra/values-production.yaml | 5 ++- bitnami/cassandra/values.yaml | 5 ++- 10 files changed, 39 insertions(+), 68 deletions(-) delete mode 100644 bitnami/cassandra/files/conf/README.md delete mode 100644 bitnami/cassandra/files/docker-entrypoint-initdb.d/README.md delete mode 100644 bitnami/cassandra/templates/configuration-cm.yaml delete mode 100644 bitnami/cassandra/templates/initdb-configmap.yaml diff --git a/bitnami/cassandra/Chart.yaml b/bitnami/cassandra/Chart.yaml index 2109644ce..85546bdac 100644 --- a/bitnami/cassandra/Chart.yaml +++ b/bitnami/cassandra/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: cassandra -version: 5.1.4 +version: 5.2.0 appVersion: 3.11.6 description: Apache Cassandra is a free and open-source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers robust support for clusters spanning multiple datacenters, with asynchronous masterless replication allowing low latency operations for all clients. keywords: diff --git a/bitnami/cassandra/README.md b/bitnami/cassandra/README.md index 9c756f371..5639fefe9 100644 --- a/bitnami/cassandra/README.md +++ b/bitnami/cassandra/README.md @@ -72,7 +72,7 @@ The following tables lists the configurable parameters of the cassandra chart an | `service.type` | Kubernetes Service type | `ClusterIP` | | `service.port` | CQL Port for the Kubernetes service | `9042` | | `service.thriftPort` | Thrift Port for the Kubernetes service | `9160` | -| `service.nodePorts.cql` | Kubernetes CQL node port | `""` | +| `service.nodePorts.cql` | Kubernetes CQL node port | `""` | | `service.nodePorts.rcp` | Kubernetes Thrift node port | `""` | | `service.loadBalancerIP` | LoadBalancerIP if service type is `LoadBalancer` | `nil` | | `service.annotations` | Annotations for the service | {} | @@ -83,7 +83,7 @@ The following tables lists the configurable parameters of the cassandra chart an | `persistence.size` | Persistent Volume Size | `8Gi` | | `tlsEncryptionSecretName` | Secret with keystore, keystore password, truststore and truststore password | `{}` | | `resources` | CPU/Memory resource requests/limits | `{}` | -| `existingConfiguration` | Pointer to a configMap that contains custom Cassandra configuration files. This will override any Cassandra configuration variable set in the chart | `{}` | +| `existingConfiguration` | Pointer to a configMap that contains custom Cassandra configuration files. This will override any Cassandra configuration variable set in the chart | `nil` (evaluated as a template) | | `cluster.name` | Cassandra cluster name | `cassandra` | | `cluster.replicaCount` | Number of Cassandra nodes | `1` | | `cluster.seedCount` | Number of seed nodes (note: must be greater or equal than 1 and less or equal to `cluster.replicaCount`) | `1` | @@ -103,7 +103,7 @@ The following tables lists the configurable parameters of the cassandra chart an | `dbUser.forcePassword` | Force the user to provide a non-empty password for `dbUser.user` | `false` | | `dbUser.password` | Password for `dbUser.user`. Randomly generated if empty | (Random generated) | | `dbUser.existingSecret` | Use an existing secret object for `dbUser.user` password (will ignore `dbUser.password`) | `nil` | -| `initDBConfigMap` | Configmap for initialization CQL commands (done in the first node). Useful for creating keyspaces at startup, for instance | `nil` | +| `initDBConfigMap` | Configmap for initialization CQL commands (done in the first node). Useful for creating keyspaces at startup, for instance | `nil` (evaluated as a template) | | `livenessProbe.enabled` | Turn on and off liveness probe | `true` | | `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | | `livenessProbe.periodSeconds` | How often to perform the probe | `30` | @@ -142,15 +142,15 @@ The above parameters map to the env variables defined in [bitnami/cassandra](htt Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, ```console -$ helm install my-release \ - --set dbUser.user=admin,dbUser.password=password\ +helm install my-release \ + --set dbUser.user=admin,dbUser.password=password\ bitnami/cassandra ``` Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, ```console -$ helm install my-release -f values.yaml bitnami/cassandra +helm install my-release -f values.yaml bitnami/cassandra ``` > **Tip**: You can use the default [values.yaml](values.yaml) @@ -168,6 +168,7 @@ Bitnami will release a new chart updating its containers if a new version of the This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. You can use this file instead of the default one. - Number of Cassandra and seed nodes: + ```diff - master.replicaCount: 1 - master.seedCount: 1 @@ -176,24 +177,28 @@ This chart includes a `values-production.yaml` file where you can find some para ``` - Minimum nuber of instances that must be available in the cluster: + ```diff - cluster.minimumAvailable: 1 + cluster.minimumAvailable: 2 ``` - Force the user to provide a non-empty password for `dbUser.user`: + ```diff - dbUser.forcePassword: false + dbUser.forcePassword: true ``` - Enable NetworkPolicy: + ```diff - networkPolicy.enabled: false + networkPolicy.enabled: true ``` - Start a side-car prometheus exporter: + ```diff - metrics.enabled: false + metrics.enabled: true @@ -203,8 +208,8 @@ This chart includes a `values-production.yaml` file where you can find some para You can enable TLS between client and server and between nodes. In order to do so, you need to set the following values: - * For internode cluster encryption, set `cluster.internodeEncryption` to a value different from `none`. Available values are `all`, `dc` or `rack`. - * For client-server encryption, set `cluster.clientEncryption` to true. +- For internode cluster encryption, set `cluster.internodeEncryption` to a value different from `none`. Available values are `all`, `dc` or `rack`. +- For client-server encryption, set `cluster.clientEncryption` to true. In addition to this, you **must** create a secret containing the *keystore* and *truststore* certificates and their corresponding protection passwords. Then, set the `tlsEncryptionSecretName` when deploying the chart. @@ -216,9 +221,19 @@ cluster.clientEncryption=true tlsEncryptionSecretName=cassandra-tls ``` +### Using custom configuration + +This helm chart supports mounting your custom configuration file(s) for Cassandra. This is done by setting the `existingConfiguration` parameter with the name of a configmap (for example, `cassandra-configuration`) that includes the custom configuration file(s): + +```console +existingConfiguration=cassandra-configuration +``` + +> Note: this will override any other Cassandra configuration variable set in the chart. + ### Initializing the database -The [Bitnami cassandra](https://github.com/bitnami/bitnami-docker-cassandra) image allows having initialization scripts mounted in `/docker-entrypoint.initdb`. This is done in the chart by adding files in the `files/docker-entrypoint-initdb.d` folder (in order to do so, clone this chart) or by setting the `initDBConfigMap` value with a `ConfigMap` (named, for example, `init-db`) that includes the necessary `sh` or `cql` scripts: +The [Bitnami cassandra](https://github.com/bitnami/bitnami-docker-cassandra) image allows having initialization scripts mounted in `/docker-entrypoint.initdb`. This is done in the chart by setting the parameter `initDBConfigMap` with the name of a configmap (for example, `init-db`) that includes the necessary `sh` or `cql` scripts: ```console initDBConfigMap=init-db @@ -247,8 +262,8 @@ You can enable this initContainer by setting `volumePermissions.enabled` to `tru An issue in StatefulSet manifest of the 4.x chart series rendered chart upgrades to be broken. The 5.0.0 series fixes this issue. To upgrade to the 5.x series you need to manually delete the Cassandra StatefulSet before executing the `helm upgrade` command. ```bash -$ kubectl delete sts -l release= -$ helm upgrade ... +kubectl delete sts -l release= +helm upgrade ... ``` ### 4.0.0 diff --git a/bitnami/cassandra/files/conf/README.md b/bitnami/cassandra/files/conf/README.md deleted file mode 100644 index ee1658d3e..000000000 --- a/bitnami/cassandra/files/conf/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Place your Cassandra configuration files here. This will override the values set in any configuration environment variable. This will not be used in case the value *existingConfiguration* is used. - -More information [here](https://github.com/bitnami/bitnami-docker-cassandra#configuration) diff --git a/bitnami/cassandra/files/docker-entrypoint-initdb.d/README.md b/bitnami/cassandra/files/docker-entrypoint-initdb.d/README.md deleted file mode 100644 index fb663dc28..000000000 --- a/bitnami/cassandra/files/docker-entrypoint-initdb.d/README.md +++ /dev/null @@ -1,3 +0,0 @@ -You can copy here your custom `.sh` or `.cql` file so they are executed during the first boot of the image. - -More info in the [bitnami-docker-cassandra](https://github.com/bitnami/bitnami-docker-cassandra#initializing-a-new-instance) repository. diff --git a/bitnami/cassandra/templates/_helpers.tpl b/bitnami/cassandra/templates/_helpers.tpl index 6cbf0cbde..053e2da94 100644 --- a/bitnami/cassandra/templates/_helpers.tpl +++ b/bitnami/cassandra/templates/_helpers.tpl @@ -107,28 +107,6 @@ Also, we can't use a single if because lazy evaluation is not an option {{- end -}} {{- end -}} -{{/* -Get the init db configmap. -*/}} -{{- define "cassandra.initDbCM" -}} -{{- if .Values.initDBConfigMap -}} -{{- printf "%s" .Values.initDBConfigMap -}} -{{- else -}} -{{- printf "%s-init-scripts" (include "cassandra.fullname" .) -}} -{{- end -}} -{{- end -}} - -{{/* -Get the configuration configmap. -*/}} -{{- define "cassandra.configurationCM" -}} -{{- if .Values.existingConfiguration -}} -{{- printf "%s" .Values.existingConfiguration -}} -{{- else -}} -{{- printf "%s-configuration" (include "cassandra.fullname" .) -}} -{{- end -}} -{{- end -}} - {{/* Return the proper Docker Image Registry Secret Names */}} diff --git a/bitnami/cassandra/templates/configuration-cm.yaml b/bitnami/cassandra/templates/configuration-cm.yaml deleted file mode 100644 index edcb34934..000000000 --- a/bitnami/cassandra/templates/configuration-cm.yaml +++ /dev/null @@ -1,9 +0,0 @@ -{{ if and (.Files.Glob "files/conf/*") (not .Values.existingConfiguration) }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "cassandra.fullname" . }}-configuration - labels: {{- include "cassandra.labels" . | nindent 4 }} -data: -{{ (.Files.Glob "files/conf/*").AsConfig | indent 2 }} -{{ end }} diff --git a/bitnami/cassandra/templates/initdb-configmap.yaml b/bitnami/cassandra/templates/initdb-configmap.yaml deleted file mode 100644 index 7ca120919..000000000 --- a/bitnami/cassandra/templates/initdb-configmap.yaml +++ /dev/null @@ -1,9 +0,0 @@ -{{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*") (not .Values.initDBConfigMap) }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "cassandra.fullname" . }}-init-scripts - labels: {{- include "cassandra.labels" . | nindent 4 }} -data: -{{ (.Files.Glob "files/docker-entrypoint-initdb.d/*").AsConfig | indent 2 }} -{{- end }} diff --git a/bitnami/cassandra/templates/statefulset.yaml b/bitnami/cassandra/templates/statefulset.yaml index 5e3b9f2c9..3bd392287 100644 --- a/bitnami/cassandra/templates/statefulset.yaml +++ b/bitnami/cassandra/templates/statefulset.yaml @@ -200,11 +200,11 @@ spec: - name: encryption-secrets mountPath: /bitnami/cassandra/secrets {{- end }} - {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*") (.Values.initDBConfigMap) }} + {{- if .Values.initDBConfigMap }} - name: init-db mountPath: /docker-entrypoint-initdb.d {{- end }} - {{ if or (.Files.Glob "files/conf/*") .Values.existingConfiguration }} + {{ if .Values.existingConfiguration }} - name: configurations mountPath: /bitnami/cassandra/conf {{- end }} @@ -242,15 +242,15 @@ spec: - key: truststore path: truststore {{- end }} - {{- if or (.Files.Glob "files/conf/*") .Values.existingConfiguration }} + {{- if .Values.existingConfiguration }} - name: configurations configMap: - name: {{ include "cassandra.configurationCM" . }} + name: {{ tpl .Values.existingConfiguration $ }} {{- end }} - {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*") (.Values.initDBConfigMap) }} + {{- if .Values.initDBConfigMap }} - name: init-db configMap: - name: {{ include "cassandra.initDbCM" . }} + name: {{ tpl .Values.initDBConfigMap $ }} {{- end }} {{- if not .Values.persistence.enabled }} - name: data diff --git a/bitnami/cassandra/values-production.yaml b/bitnami/cassandra/values-production.yaml index 1689bd699..09feded6b 100644 --- a/bitnami/cassandra/values-production.yaml +++ b/bitnami/cassandra/values-production.yaml @@ -17,7 +17,7 @@ image: ## Bitnami Cassandra image tag ## ref: https://github.com/bitnami/bitnami-docker-cassandra#supported-tags-and-respective-dockerfile-links ## - tag: 3.11.6-debian-10-r41 + tag: 3.11.6-debian-10-r46 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -148,6 +148,7 @@ resources: ## Secret with keystore, keystore password, truststore, truststore password ## # tlsEncryptionSecretName: + ## ConfigMap with custom cassandra configuration files. This overrides any other Cassandra configuration set in the chart ## # existingConfiguration: @@ -282,7 +283,7 @@ metrics: registry: docker.io pullPolicy: IfNotPresent repository: bitnami/cassandra-exporter - tag: 2.3.4-debian-10-r22 + tag: 2.3.4-debian-10-r26 ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ diff --git a/bitnami/cassandra/values.yaml b/bitnami/cassandra/values.yaml index 521ade27a..346360e16 100644 --- a/bitnami/cassandra/values.yaml +++ b/bitnami/cassandra/values.yaml @@ -17,7 +17,7 @@ image: ## Bitnami Cassandra image tag ## ref: https://github.com/bitnami/bitnami-docker-cassandra#supported-tags-and-respective-dockerfile-links ## - tag: 3.11.6-debian-10-r41 + tag: 3.11.6-debian-10-r46 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -148,6 +148,7 @@ resources: ## Secret with keystore, keystore password, truststore, truststore password ## # tlsEncryptionSecretName: + ## ConfigMap with custom cassandra configuration files. This overrides any other Cassandra configuration set in the chart ## # existingConfiguration: @@ -282,7 +283,7 @@ metrics: registry: docker.io pullPolicy: IfNotPresent repository: bitnami/cassandra-exporter - tag: 2.3.4-debian-10-r22 + tag: 2.3.4-debian-10-r26 ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/