From 797776ee5b861dc3dff41cb7824615237e74e2ee Mon Sep 17 00:00:00 2001 From: Janis Eccarius Date: Sat, 30 May 2026 11:45:02 +0200 Subject: [PATCH] feat(sealed-secrets): add sealed secrets management scripts and configurations --- Passwords.kdbx | Bin eu-central-1/argo-apps/nowchess/nowchess.yaml | 2 +- .../sealed-secrets/sealed-secrets.yaml | 27 +++++++++++++++++ eu-central-1/argo-apps/secrets/secrets.yaml | 22 ++++++++++++++ .../nowchess/ncs-projectconfig.yaml | 2 +- kargo-projects/nowchess/ncs-stage.yaml | 2 +- scripts/seal-secrets.sh | 28 ++++++++++++++++++ sealed-secrets/eu-central-1/values.yaml | 1 + 8 files changed, 81 insertions(+), 3 deletions(-) mode change 100644 => 100755 Passwords.kdbx create mode 100644 eu-central-1/argo-apps/sealed-secrets/sealed-secrets.yaml create mode 100644 eu-central-1/argo-apps/secrets/secrets.yaml create mode 100755 scripts/seal-secrets.sh create mode 100644 sealed-secrets/eu-central-1/values.yaml diff --git a/Passwords.kdbx b/Passwords.kdbx old mode 100644 new mode 100755 diff --git a/eu-central-1/argo-apps/nowchess/nowchess.yaml b/eu-central-1/argo-apps/nowchess/nowchess.yaml index e0fd458..54e33db 100644 --- a/eu-central-1/argo-apps/nowchess/nowchess.yaml +++ b/eu-central-1/argo-apps/nowchess/nowchess.yaml @@ -4,7 +4,7 @@ metadata: name: nowchess namespace: argocd annotations: - kargo.akuity.io/authorized-stage: nowchess-kargo:prod + kargo.akuity.io/authorized-stage: nowchess-kargo:eu-central-1-prod spec: project: default destination: diff --git a/eu-central-1/argo-apps/sealed-secrets/sealed-secrets.yaml b/eu-central-1/argo-apps/sealed-secrets/sealed-secrets.yaml new file mode 100644 index 0000000..d2f9fa9 --- /dev/null +++ b/eu-central-1/argo-apps/sealed-secrets/sealed-secrets.yaml @@ -0,0 +1,27 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: sealed-secrets + namespace: argocd +spec: + project: default + destination: + namespace: kube-system + server: https://kubernetes.default.svc + sources: + - repoURL: https://bitnami-labs.github.io/sealed-secrets + chart: sealed-secrets + targetRevision: 2.16.1 + helm: + valueFiles: + - $values/sealed-secrets/eu-central-1/values.yaml + - repoURL: git@git.janis-eccarius.de:NowChess/GitOps.git + path: ./sealed-secrets/eu-central-1 + ref: values + targetRevision: main + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/eu-central-1/argo-apps/secrets/secrets.yaml b/eu-central-1/argo-apps/secrets/secrets.yaml new file mode 100644 index 0000000..f6c1ca0 --- /dev/null +++ b/eu-central-1/argo-apps/secrets/secrets.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: secrets + namespace: argocd + annotations: + argocd.argoproj.io/sync-wave: "1" +spec: + project: default + destination: + namespace: argocd + server: https://kubernetes.default.svc + sources: + - repoURL: git@git.janis-eccarius.de:NowChess/GitOps.git + path: ./secrets + targetRevision: main + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/kargo-projects/nowchess/ncs-projectconfig.yaml b/kargo-projects/nowchess/ncs-projectconfig.yaml index f8abd33..89dfb73 100644 --- a/kargo-projects/nowchess/ncs-projectconfig.yaml +++ b/kargo-projects/nowchess/ncs-projectconfig.yaml @@ -6,4 +6,4 @@ spec: promotionPolicies: - autoPromotionEnabled: true stageSelector: - name: regex:^staging|prod$ + name: regex:^staging|eu-central-1-prod$ diff --git a/kargo-projects/nowchess/ncs-stage.yaml b/kargo-projects/nowchess/ncs-stage.yaml index 38d2650..7d944f0 100644 --- a/kargo-projects/nowchess/ncs-stage.yaml +++ b/kargo-projects/nowchess/ncs-stage.yaml @@ -71,7 +71,7 @@ spec: kind: Stage apiVersion: kargo.akuity.io/v1alpha1 metadata: - name: prod + name: eu-central-1-prod namespace: nowchess-kargo annotations: kargo.akuity.io/color: green diff --git a/scripts/seal-secrets.sh b/scripts/seal-secrets.sh new file mode 100755 index 0000000..b849359 --- /dev/null +++ b/scripts/seal-secrets.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +CONTROLLER_NAME="sealed-secrets" +CONTROLLER_NS="kube-system" +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +SECRETS_DIR="$REPO_ROOT/secrets" + +seal_file() { + local f="$1" + local tmp="${f}.tmp" + kubeseal \ + --controller-name="$CONTROLLER_NAME" \ + --controller-namespace="$CONTROLLER_NS" \ + --format=yaml \ + < "$f" > "$tmp" + mv "$tmp" "$f" + echo "sealed: $f" +} + +# Only seal plain Secrets (not already-sealed SealedSecrets or kustomizations) +while IFS= read -r -d '' f; do + if grep -q "^kind: Secret$" "$f" 2>/dev/null; then + seal_file "$f" + fi +done < <(find "$SECRETS_DIR" -name "*.yaml" ! -name "kustomization.yaml" -print0) + +echo "done — commit the sealed files and push" diff --git a/sealed-secrets/eu-central-1/values.yaml b/sealed-secrets/eu-central-1/values.yaml new file mode 100644 index 0000000..365c955 --- /dev/null +++ b/sealed-secrets/eu-central-1/values.yaml @@ -0,0 +1 @@ +fullnameOverride: sealed-secrets