Skip to content

Commit

Permalink
[bitnami/cassandra] feat: ✨ Allow setting initdb scripts in values (#…
Browse files Browse the repository at this point in the history
…29172)

* [bitnami/cassandra] feat: ✨ Allow setting initdb scripts in values

Signed-off-by: Javier J. Salmerón García <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <[email protected]>

* fix: 🐛 Use correct type

Signed-off-by: Javier J. Salmerón García <[email protected]>

---------

Signed-off-by: Javier J. Salmerón García <[email protected]>
Signed-off-by: Bitnami Containers <[email protected]>
Co-authored-by: Bitnami Containers <[email protected]>
  • Loading branch information
javsalgar and bitnami-bot authored Sep 3, 2024
1 parent 4c05231 commit 0aaac20
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
8 changes: 6 additions & 2 deletions bitnami/cassandra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## 11.3.14 (2024-08-28)
## 11.4.0 (2024-09-03)

* [bitnami/cassandra] Release 11.3.14 ([#29077](https://github.com/bitnami/charts/pull/29077))
* [bitnami/cassandra] feat: :sparkles: Allow setting initdb scripts in values ([#29172](https://github.com/bitnami/charts/pull/29172))

## <small>11.3.14 (2024-08-28)</small>

* [bitnami/cassandra] Release 11.3.14 (#29077) ([70e610c](https://github.com/bitnami/charts/commit/70e610c83801ad78a7d6370ee830df0ff97c129e)), closes [#29077](https://github.com/bitnami/charts/issues/29077)

## <small>11.3.13 (2024-08-21)</small>

Expand Down
2 changes: 1 addition & 1 deletion bitnami/cassandra/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ maintainers:
name: cassandra
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/cassandra
version: 11.3.14
version: 11.4.0
1 change: 1 addition & 0 deletions bitnami/cassandra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ As the image run as non-root by default, it is necessary to adjust the ownership
| `dbUser.forcePassword` | Force the user to provide a non | `false` |
| `dbUser.password` | Password for `dbUser.user`. Randomly generated if empty | `""` |
| `dbUser.existingSecret` | Use an existing secret object for `dbUser.user` password (will ignore `dbUser.password`) | `""` |
| `initDB` | Object with cql scripts. Useful for creating a keyspace and pre-populating data | `{}` |
| `initDBConfigMap` | ConfigMap with cql scripts. Useful for creating a keyspace and pre-populating data | `""` |
| `initDBSecret` | Secret with cql script (with sensitive data). Useful for creating a keyspace and pre-populating data | `""` |
| `existingConfiguration` | ConfigMap with custom cassandra configuration files. This overrides any other Cassandra configuration set in the chart | `""` |
Expand Down
19 changes: 19 additions & 0 deletions bitnami/cassandra/templates/initdb-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if and .Values.initDB (not .Values.initDBConfigMap) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-init-scripts" (include "common.names.fullname" .) }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: cassandra
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
{{- include "common.tplvalues.render" (dict "value" .Values.initDB "context" .) | nindent 2 }}
{{ end }}
6 changes: 3 additions & 3 deletions bitnami/cassandra/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ spec:
- name: certs-shared
mountPath: /opt/bitnami/cassandra/certs
{{- end }}
{{- if .Values.initDBConfigMap }}
{{- if or .Values.initDBConfigMap .Values.initDB }}
- name: init-db-cm
mountPath: /docker-entrypoint-initdb.d/configmap
{{- end }}
Expand Down Expand Up @@ -566,10 +566,10 @@ spec:
{{- end }}
- name: empty-dir
emptyDir: {}
{{- if .Values.initDBConfigMap }}
{{- if or .Values.initDB .Values.initDBConfigMap }}
- name: init-db-cm
configMap:
name: {{ tpl .Values.initDBConfigMap $ }}
name: {{ ternary (printf "%s-init-scripts" (include "common.names.fullname" .)) (tpl .Values.initDBConfigMap $) (empty .Values.initDBConfigMap) }}
{{- end }}
{{- if .Values.initDBSecret }}
- name: init-db-secret
Expand Down
3 changes: 3 additions & 0 deletions bitnami/cassandra/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ dbUser:
## cassandra-password: myCassandraPasswordKey
##
existingSecret: ""
## @param initDB Object with cql scripts. Useful for creating a keyspace and pre-populating data
##
initDB: {}
## @param initDBConfigMap ConfigMap with cql scripts. Useful for creating a keyspace and pre-populating data
##
initDBConfigMap: ""
Expand Down

0 comments on commit 0aaac20

Please sign in to comment.