diff --git a/cassandra/templates/init_cm.yaml b/cassandra/templates/init_cm.yaml new file mode 100644 index 0000000..934d1b8 --- /dev/null +++ b/cassandra/templates/init_cm.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: cassandra-init-scripts + namespace: {{ .Release.Namespace }} +data: + init.cql: | + CREATE KEYSPACE IF NOT EXISTS workspaces WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; + CREATE KEYSPACE IF NOT EXISTS users WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; + CREATE KEYSPACE IF NOT EXISTS stickers WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; + CREATE KEYSPACE IF NOT EXISTS notifications WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; + CREATE KEYSPACE IF NOT EXISTS messages WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; + CREATE KEYSPACE IF NOT EXISTS chats WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; + CREATE KEYSPACE IF NOT EXISTS calls WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; diff --git a/cassandra/templates/statefulset.yaml b/cassandra/templates/statefulset.yaml index 4aa28e0..eb45a3d 100644 --- a/cassandra/templates/statefulset.yaml +++ b/cassandra/templates/statefulset.yaml @@ -215,6 +215,8 @@ spec: resources: {{- include "common.resources.preset" (dict "type" .Values.tls.resourcesPreset) | nindent 12 }} {{- end }} volumeMounts: + - name: script-volume + mountPath: /scripts - name: certs mountPath: /certs - name: certs-shared @@ -495,6 +497,8 @@ spec: resources: {{- include "common.resources.preset" (dict "type" .Values.resourcesPreset) | nindent 12 }} {{- end }} volumeMounts: + - name: script-volume + mountPath: /scripts - name: data mountPath: {{ .Values.persistence.mountPath }} {{- if .Values.usePasswordFiles }} @@ -594,6 +598,9 @@ spec: {{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }} {{- end }} volumes: + - name: script-volume + configMap: + name: cassandra-init-script - name: metrics-conf configMap: name: {{ include "cassandra.metricsConfConfigMap" . }} diff --git a/cassandra/values.yaml b/cassandra/values.yaml index 1c301f9..97c04ef 100644 --- a/cassandra/values.yaml +++ b/cassandra/values.yaml @@ -139,19 +139,11 @@ dbUser: ## @param initDB Object with cql scripts. Useful for creating a keyspace and pre-populating data ## -initDB: - init.cql: | - CREATE KEYSPACE IF NOT EXISTS workspaces WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; - CREATE KEYSPACE IF NOT EXISTS users WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; - CREATE KEYSPACE IF NOT EXISTS stickers WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; - CREATE KEYSPACE IF NOT EXISTS notifications WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; - CREATE KEYSPACE IF NOT EXISTS messages WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; - CREATE KEYSPACE IF NOT EXISTS chats WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; - CREATE KEYSPACE IF NOT EXISTS calls WITH replication = {'class' : 'SimpleStrategy', 'replication_factor' : 3}; +initDB: {} ## @param initDBConfigMap ConfigMap with cql scripts. Useful for creating a keyspace and pre-populating data ## -initDBConfigMap: "" +initDBConfigMap: {} ## @param initDBSecret Secret with cql script (with sensitive data). Useful for creating a keyspace and pre-populating data ##