mirror of
https://github.com/wahyd4/charts.git
synced 2026-08-25 04:56:18 +10:00
Merge pull request #993 from bitnami/cassandraStartupCQL
[bitnami/cassandra] Allow custom cql and sh scripts
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
name: cassandra
|
||||
version: 1.2.0
|
||||
version: 2.0.0
|
||||
appVersion: 3.11.3
|
||||
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.
|
||||
icon: https://bitnami.com/assets/stacks/cassandra/img/cassandra-stack-220x234.png
|
||||
|
||||
@@ -82,7 +82,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` |
|
||||
| `startupCQL` | Startup 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` |
|
||||
| `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` |
|
||||
@@ -139,3 +139,22 @@ The [Bitnami cassandra](https://github.com/bitnami/bitnami-docker-cassandra) ima
|
||||
|
||||
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
|
||||
See the [Configuration](#configuration) section to configure the PVC or to disable persistence.
|
||||
|
||||
## 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` that includes the necessary `sh` or `cql` scripts:
|
||||
|
||||
```bash
|
||||
kubectl create configmap init-db --from-file=path/to/scripts
|
||||
helm install bitnami/cassandra --set initDBConfigMap=init-db
|
||||
```
|
||||
|
||||
## Upgrade
|
||||
|
||||
### 2.0.0
|
||||
|
||||
This releases make it possible to specify custom initialization scripts in both cql and sh files.
|
||||
|
||||
#### Breaking changes
|
||||
|
||||
- `startupCQL` has been removed. Instead, for initializing the database, see [this section](#initializing-the-database).
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
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.
|
||||
@@ -76,6 +76,17 @@ Return the proper metrics image name
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- 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.
|
||||
*/}}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*") (not .Values.initDBConfigMap) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "cassandra.fullname" . }}-init-scripts
|
||||
labels:
|
||||
app: {{ template "cassandra.name" . }}
|
||||
chart: {{ template "cassandra.chart" . }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
data:
|
||||
{{ (.Files.Glob "files/docker-entrypoint-initdb.d/*").AsConfig | indent 2 }}
|
||||
{{- end }}
|
||||
@@ -64,9 +64,11 @@ spec:
|
||||
if [[ $HOSTNAME =~ (.*)-0$ ]]; then
|
||||
echo "Setting node as password seeder"
|
||||
export CASSANDRA_PASSWORD_SEEDER=yes
|
||||
else
|
||||
# Only node 0 will execute the startup initdb scripts
|
||||
export CASSANDRA_IGNORE_INITDB_SCRIPTS=1
|
||||
fi
|
||||
/app-entrypoint.sh /run.sh
|
||||
|
||||
image: {{ template "cassandra.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
resources:
|
||||
@@ -107,10 +109,6 @@ spec:
|
||||
- name: JVM_EXTRA_OPTS
|
||||
value: {{ .Values.jvm.extraOpts | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.startupCQL }}
|
||||
- name: CASSANDRA_STARTUP_CQL
|
||||
value: {{ .Values.startupCQL | quote }}
|
||||
{{- end }}
|
||||
- name: CASSANDRA_ENABLE_RPC
|
||||
value: {{ .Values.cluster.enableRPC | quote }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
@@ -155,6 +153,10 @@ spec:
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /bitnami/cassandra
|
||||
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*") (.Values.initDBConfigMap) }}
|
||||
- name: init-db
|
||||
mountPath: /docker-entrypoint-initdb.d
|
||||
{{- end }}
|
||||
{{ if or (.Files.Glob "files/conf/*") .Values.existingConfiguration }}
|
||||
- name: configurations
|
||||
mountPath: /bitnami/cassandra/conf
|
||||
@@ -197,6 +199,11 @@ spec:
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- else }}
|
||||
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*") (.Values.initDBConfigMap) }}
|
||||
- name: init-db
|
||||
configMap:
|
||||
name: {{ template "cassandra.initDbCM" . }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
|
||||
@@ -121,10 +121,10 @@ dbUser:
|
||||
# password:
|
||||
# existingSecret:
|
||||
|
||||
## Startup CQL commands. Useful for creating a keyspace
|
||||
## ConfigMap with cql scripts. Useful for creating a keyspace
|
||||
## and pre-populating data
|
||||
##
|
||||
# startupCQL: "CREATE KEYSPACE IF NOT EXISTS example_keyspace WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};"
|
||||
# initDBConfigMap:
|
||||
|
||||
## Liveness and Readiness probe values.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
|
||||
|
||||
@@ -121,10 +121,10 @@ dbUser:
|
||||
# password:
|
||||
# existingSecret:
|
||||
|
||||
## Startup CQL commands. Useful for creating a keyspace
|
||||
## ConfigMap with cql scripts. Useful for creating a keyspace
|
||||
## and pre-populating data
|
||||
##
|
||||
# startupCQL: "CREATE KEYSPACE IF NOT EXISTS example_keyspace WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};"
|
||||
# initDBConfigMap:
|
||||
|
||||
## Liveness and Readiness probe values.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
|
||||
|
||||
Reference in New Issue
Block a user