activity-core/k8s/railiance/bootstrap-secrets.sh
tegwick f0a897e088
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Container Image / build-and-push (push) Successful in 33s
Harden ops run identity and leases
Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a028de-e2c8-7732-8521-46a7fc5db82f
2026-08-23 13:01:46 +02:00

48 lines
1.7 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
NS="${NS:-activity-core}"
kubectl apply -f k8s/railiance/00-namespace.yaml
secret_exists() {
kubectl -n "$NS" get secret "$1" >/dev/null 2>&1
}
random_password() {
openssl rand -base64 32 | tr -d '\n'
}
if ! secret_exists actcore-app-db-secret; then
APP_DB_PASSWORD="$(random_password)"
kubectl -n "$NS" create secret generic actcore-app-db-secret \
--from-literal=username=actcore \
--from-literal=database=actcore \
--from-literal=password="$APP_DB_PASSWORD"
else
APP_DB_PASSWORD="$(kubectl -n "$NS" get secret actcore-app-db-secret -o jsonpath='{.data.password}' | base64 -d)"
fi
if ! secret_exists actcore-temporal-db-secret; then
kubectl -n "$NS" create secret generic actcore-temporal-db-secret \
--from-literal=username=temporal \
--from-literal=database=temporal \
--from-literal=password="$(random_password)"
fi
ACTCORE_DB_URL="postgresql+asyncpg://actcore:${APP_DB_PASSWORD}@actcore-app-db:5432/actcore"
if ! secret_exists actcore-runtime-secret; then
kubectl -n "$NS" create secret generic actcore-runtime-secret \
--from-literal=ACTCORE_DB_URL="$ACTCORE_DB_URL" \
--from-literal=WEBHOOK_SECRET_GITEA="" \
--from-literal=WEBHOOK_SECRET_GITHUB="" \
--from-literal=OPS_HUB_KEY=""
fi
# ISSUE_CORE_API_KEY is merged into actcore-runtime-secret by ExternalSecret
# actcore-issue-core-runtime (k8s/railiance/15-externalsecret-issue-core.yaml).
# Apply that manifest after ClusterSecretStore openbao-activity-core is Ready.
#
# Patch ACTIVITY_CORE_WORKER_TOKEN and ACTIVITY_CORE_OPERATOR_TOKEN into
# actcore-runtime-secret before enabling their API paths — see
# docs/deploy-ops-run-queue-railiance.md. Not auto-generated here.