Compare commits

...

1 Commits

Author SHA1 Message Date
Axel Lender
c7681fb545 feat(helmfile): Add templating support for Cassandra external secrets
Signed-off-by: Axel Lender <lender@b1-systems.de>
2025-07-08 13:02:15 +02:00
3 changed files with 60 additions and 1 deletions

42
docs/external-secrets.md Normal file
View File

@@ -0,0 +1,42 @@
<!--
SPDX-FileCopyrightText: 2025 Zentrum für Digitale Souveränität der Öffentlichen Verwaltung (ZenDiS) GmbH
SPDX-License-Identifier: Apache-2.0
-->
<h1>External Secrets</h1>
This document covers how to utilise external secrets and special requirements.
<!-- TOC -->
* [General](#general)
* [Components](#components)
* [Cassandra](#cassandra)
<!-- TOC -->
# General
For most components when set the external secret will supersede e.g. a password in a `values.yaml` file.
The file [`external_secrets.yaml`](/helmfile/environments/default/external_secrets.yaml.gotmpl) lists all possible references to external secrets that are currently implemented in openDesk.
# Components
This section covers information and special requirements to external secrets that some Helm Charts expect.
## Cassandra
Cassandra is pre-populated with information regarding Dovecot with a `cql` script. The openDesk default `initDB` setting is configured as follows:
```yaml
initUserData.cql: >
CREATE KEYSPACE IF NOT EXISTS {{ .Values.databases.dovecotDictmap.name | quote }} WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
CREATE ROLE IF NOT EXISTS {{ .Values.databases.dovecotDictmap.username | quote }};
ALTER ROLE {{ .Values.databases.dovecotDictmap.username | quote }} WITH PASSWORD = {{ regexReplaceAll "'" .Values.secrets.cassandra.dovecotDictmapUser "''" | squote }} AND LOGIN = true;
GRANT ALL ON KEYSPACE {{ .Values.databases.dovecotDictmap.name | quote }} TO {{ .Values.databases.dovecotDictmap.username | quote }};
CREATE KEYSPACE IF NOT EXISTS {{ .Values.databases.dovecotACL.name | quote }} WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
CREATE ROLE IF NOT EXISTS {{ .Values.databases.dovecotACL.username | quote }};
ALTER ROLE {{ .Values.databases.dovecotACL.username | quote }} WITH PASSWORD = {{ regexReplaceAll "'" .Values.secrets.cassandra.dovecotACLUser "''" | squote }} AND LOGIN = true;
GRANT ALL ON KEYSPACE {{ .Values.databases.dovecotACL.name | quote }} TO {{ .Values.databases.dovecotACL.username | quote }};
```
This has to be adapted into a secret that also holds a `cql` script and is named in `initDBSecret`.

View File

@@ -22,7 +22,10 @@ containerSecurityContext:
dbUser:
user: "root"
password: {{ .Values.secrets.cassandra.rootPassword | quote }}
existingSecret:
name: {{ .Values.externalSecrets.cassandra.existingSecret.name | quote }}
keyMapping:
cassandra-password: {{ .Values.externalSecrets.cassandra.existingSecret.passwordKey | quote }}
global:
imagePullSecrets:
{{ .Values.global.imagePullSecrets | toYaml | nindent 4 }}
@@ -48,6 +51,8 @@ initDB:
ALTER ROLE {{ .Values.databases.dovecotACL.username | quote }} WITH PASSWORD = {{ regexReplaceAll "'" .Values.secrets.cassandra.dovecotACLUser "''" | squote }} AND LOGIN = true;
GRANT ALL ON KEYSPACE {{ .Values.databases.dovecotACL.name | quote }} TO {{ .Values.databases.dovecotACL.username | quote }};
initDBSecret: {{ .Values.externalSecrets.cassandra.initDBSecret | quote }}
# Will print a warning if unset but is automatically calculated:
jvm:
maxHeapSize: ""

View File

@@ -0,0 +1,12 @@
{{/*
SPDX-FileCopyrightText: 2025 Zentrum für Digitale Souveränität der Öffentlichen Verwaltung (ZenDiS) GmbH
SPDX-License-Identifier: Apache-2.0
*/}}
---
externalSecrets:
cassandra:
initDBSecret: ~
existingSecret:
name: ~
passwordKey: ~
...