#!/usr/bin/env bash # vault-setup-policies.sh — Create Vault policies + Kubernetes auth roles for VSO # # Prerequisites: # - vault CLI authenticated (VAULT_ADDR + VAULT_TOKEN set) # - Kubernetes auth method enabled at auth/kubernetes/ # - KV v2 secrets engine at kv/ # # Usage: ./scripts/vault-setup-policies.sh set -euo pipefail echo "=== Vault Secrets Operator — Policy & Auth Role Setup ===" echo "" # All namespaces that have secrets to migrate NAMESPACES=( argocd gitea keycloak renovate homepage argocd-mcp mcp10x ts-mcp dot-ai music-man vault-secrets-operator-system ) # --- Per-namespace policies and auth roles --- for NS in "${NAMESPACES[@]}"; do echo "--- Namespace: ${NS} ---" # Create read-only policy for this namespace's secrets echo " Creating policy: ns-${NS}" vault policy write "ns-${NS}" - <