mirror of
https://github.com/outbackdingo/bank-of-holos.git
synced 2026-01-27 10:18:27 +00:00
```
deploy/clusters/workload
└── projects
├── argocd
│ ├── components
│ │ ├── app-projects
│ │ │ └── app-projects.gen.yaml
│ │ ├── argocd
│ │ │ └── argocd.gen.yaml
│ │ ├── argocd-crds
│ │ │ └── argocd-crds.gen.yaml
│ │ ├── kargo
│ │ │ └── kargo.gen.yaml
│ │ ├── kargo-secrets
│ │ │ └── kargo-secrets.gen.yaml
│ │ ├── namespaces
│ │ │ └── namespaces.gen.yaml
│ │ ├── rollouts
│ │ │ └── rollouts.gen.yaml
│ │ └── rollouts-crds
│ │ └── rollouts-crds.gen.yaml
│ └── gitops
│ ├── app-projects.application.gen.yaml
│ ├── argocd-crds.application.gen.yaml
│ ├── argocd.application.gen.yaml
│ ├── kargo-secrets.application.gen.yaml
│ ├── kargo.application.gen.yaml
│ ├── namespaces.application.gen.yaml
│ ├── rollouts-crds.application.gen.yaml
│ └── rollouts.application.gen.yaml
├── network
│ ├── components
│ │ ├── gateway-api
│ │ │ └── gateway-api.gen.yaml
│ │ ├── httproutes
│ │ │ └── httproutes.gen.yaml
│ │ ├── istio-base
│ │ │ └── istio-base.gen.yaml
│ │ ├── istio-cni
│ │ │ └── istio-cni.gen.yaml
│ │ ├── istio-gateway
│ │ │ └── istio-gateway.gen.yaml
│ │ ├── istio-ztunnel
│ │ │ └── istio-ztunnel.gen.yaml
│ │ ├── istiod
│ │ │ └── istiod.gen.yaml
│ │ └── namespaces
│ │ └── namespaces.gen.yaml
│ └── gitops
│ ├── gateway-api.application.gen.yaml
│ ├── httproutes.application.gen.yaml
│ ├── istio-base.application.gen.yaml
│ ├── istio-cni.application.gen.yaml
│ ├── istio-gateway.application.gen.yaml
│ ├── istio-ztunnel.application.gen.yaml
│ ├── istiod.application.gen.yaml
│ └── namespaces.application.gen.yaml
├── nonprod-bank-backend
│ ├── components
│ │ ├── dev-accounts-db
│ │ │ └── dev-accounts-db.gen.yaml
│ │ ├── dev-balance-reader
│ │ │ └── dev-balance-reader.gen.yaml
│ │ ├── dev-bank-backend-config
│ │ │ └── dev-bank-backend-config.gen.yaml
│ │ ├── dev-contacts
│ │ │ └── dev-contacts.gen.yaml
│ │ ├── dev-ledger-db
│ │ │ └── dev-ledger-db.gen.yaml
│ │ ├── dev-ledger-writer
│ │ │ └── dev-ledger-writer.gen.yaml
│ │ ├── dev-transaction-history
│ │ │ └── dev-transaction-history.gen.yaml
│ │ ├── dev-userservice
│ │ │ └── dev-userservice.gen.yaml
│ │ ├── stage-accounts-db
│ │ │ └── stage-accounts-db.gen.yaml
│ │ ├── stage-balance-reader
│ │ │ └── stage-balance-reader.gen.yaml
│ │ ├── stage-bank-backend-config
│ │ │ └── stage-bank-backend-config.gen.yaml
│ │ ├── stage-contacts
│ │ │ └── stage-contacts.gen.yaml
│ │ ├── stage-ledger-db
│ │ │ └── stage-ledger-db.gen.yaml
│ │ ├── stage-ledger-writer
│ │ │ └── stage-ledger-writer.gen.yaml
│ │ ├── stage-transaction-history
│ │ │ └── stage-transaction-history.gen.yaml
│ │ ├── stage-userservice
│ │ │ └── stage-userservice.gen.yaml
│ │ ├── test-accounts-db
│ │ │ └── test-accounts-db.gen.yaml
│ │ ├── test-balance-reader
│ │ │ └── test-balance-reader.gen.yaml
│ │ ├── test-bank-backend-config
│ │ │ └── test-bank-backend-config.gen.yaml
│ │ ├── test-contacts
│ │ │ └── test-contacts.gen.yaml
│ │ ├── test-ledger-db
│ │ │ └── test-ledger-db.gen.yaml
│ │ ├── test-ledger-writer
│ │ │ └── test-ledger-writer.gen.yaml
│ │ ├── test-transaction-history
│ │ │ └── test-transaction-history.gen.yaml
│ │ └── test-userservice
│ │ └── test-userservice.gen.yaml
│ └── gitops
│ ├── dev-accounts-db.application.gen.yaml
│ ├── dev-balance-reader.application.gen.yaml
│ ├── dev-bank-backend-config.application.gen.yaml
│ ├── dev-contacts.application.gen.yaml
│ ├── dev-ledger-db.application.gen.yaml
│ ├── dev-ledger-writer.application.gen.yaml
│ ├── dev-transaction-history.application.gen.yaml
│ ├── dev-userservice.application.gen.yaml
│ ├── stage-accounts-db.application.gen.yaml
│ ├── stage-balance-reader.application.gen.yaml
│ ├── stage-bank-backend-config.application.gen.yaml
│ ├── stage-contacts.application.gen.yaml
│ ├── stage-ledger-db.application.gen.yaml
│ ├── stage-ledger-writer.application.gen.yaml
│ ├── stage-transaction-history.application.gen.yaml
│ ├── stage-userservice.application.gen.yaml
│ ├── test-accounts-db.application.gen.yaml
│ ├── test-balance-reader.application.gen.yaml
│ ├── test-bank-backend-config.application.gen.yaml
│ ├── test-contacts.application.gen.yaml
│ ├── test-ledger-db.application.gen.yaml
│ ├── test-ledger-writer.application.gen.yaml
│ ├── test-transaction-history.application.gen.yaml
│ └── test-userservice.application.gen.yaml
├── nonprod-bank-security
│ ├── components
│ │ ├── dev-secrets
│ │ │ └── dev-secrets.gen.yaml
│ │ ├── namespaces
│ │ │ └── namespaces.gen.yaml
│ │ ├── projects
│ │ │ └── projects.gen.yaml
│ │ ├── stage-secrets
│ │ │ └── stage-secrets.gen.yaml
│ │ ├── stages
│ │ │ └── stages.gen.yaml
│ │ └── test-secrets
│ │ └── test-secrets.gen.yaml
│ └── gitops
│ ├── dev-secrets.application.gen.yaml
│ ├── namespaces.application.gen.yaml
│ ├── projects.application.gen.yaml
│ ├── stage-secrets.application.gen.yaml
│ ├── stages.application.gen.yaml
│ └── test-secrets.application.gen.yaml
├── nonprod-bank-web
│ ├── components
│ │ ├── dev-frontend
│ │ │ ├── dev-frontend.gen.yaml
│ │ │ └── kustomization.yaml
│ │ ├── stage-frontend
│ │ │ ├── kustomization.yaml
│ │ │ └── stage-frontend.gen.yaml
│ │ └── test-frontend
│ │ ├── kustomization.yaml
│ │ └── test-frontend.gen.yaml
│ └── gitops
│ ├── dev-frontend.application.gen.yaml
│ ├── stage-frontend.application.gen.yaml
│ └── test-frontend.application.gen.yaml
├── prod-bank-backend
│ ├── components
│ │ ├── prod-east-accounts-db
│ │ │ └── prod-east-accounts-db.gen.yaml
│ │ ├── prod-east-balance-reader
│ │ │ └── prod-east-balance-reader.gen.yaml
│ │ ├── prod-east-bank-backend-config
│ │ │ └── prod-east-bank-backend-config.gen.yaml
│ │ ├── prod-east-contacts
│ │ │ └── prod-east-contacts.gen.yaml
│ │ ├── prod-east-ledger-db
│ │ │ └── prod-east-ledger-db.gen.yaml
│ │ ├── prod-east-ledger-writer
│ │ │ └── prod-east-ledger-writer.gen.yaml
│ │ ├── prod-east-transaction-history
│ │ │ └── prod-east-transaction-history.gen.yaml
│ │ ├── prod-east-userservice
│ │ │ └── prod-east-userservice.gen.yaml
│ │ ├── prod-west-accounts-db
│ │ │ └── prod-west-accounts-db.gen.yaml
│ │ ├── prod-west-balance-reader
│ │ │ └── prod-west-balance-reader.gen.yaml
│ │ ├── prod-west-bank-backend-config
│ │ │ └── prod-west-bank-backend-config.gen.yaml
│ │ ├── prod-west-contacts
│ │ │ └── prod-west-contacts.gen.yaml
│ │ ├── prod-west-ledger-db
│ │ │ └── prod-west-ledger-db.gen.yaml
│ │ ├── prod-west-ledger-writer
│ │ │ └── prod-west-ledger-writer.gen.yaml
│ │ ├── prod-west-transaction-history
│ │ │ └── prod-west-transaction-history.gen.yaml
│ │ └── prod-west-userservice
│ │ └── prod-west-userservice.gen.yaml
│ └── gitops
│ ├── prod-east-accounts-db.application.gen.yaml
│ ├── prod-east-balance-reader.application.gen.yaml
│ ├── prod-east-bank-backend-config.application.gen.yaml
│ ├── prod-east-contacts.application.gen.yaml
│ ├── prod-east-ledger-db.application.gen.yaml
│ ├── prod-east-ledger-writer.application.gen.yaml
│ ├── prod-east-transaction-history.application.gen.yaml
│ ├── prod-east-userservice.application.gen.yaml
│ ├── prod-west-accounts-db.application.gen.yaml
│ ├── prod-west-balance-reader.application.gen.yaml
│ ├── prod-west-bank-backend-config.application.gen.yaml
│ ├── prod-west-contacts.application.gen.yaml
│ ├── prod-west-ledger-db.application.gen.yaml
│ ├── prod-west-ledger-writer.application.gen.yaml
│ ├── prod-west-transaction-history.application.gen.yaml
│ └── prod-west-userservice.application.gen.yaml
├── prod-bank-security
│ ├── components
│ │ ├── namespaces
│ │ │ └── namespaces.gen.yaml
│ │ ├── prod-east-secrets
│ │ │ └── prod-east-secrets.gen.yaml
│ │ ├── prod-west-secrets
│ │ │ └── prod-west-secrets.gen.yaml
│ │ ├── projects
│ │ │ └── projects.gen.yaml
│ │ └── stages
│ │ └── stages.gen.yaml
│ └── gitops
│ ├── namespaces.application.gen.yaml
│ ├── prod-east-secrets.application.gen.yaml
│ ├── prod-west-secrets.application.gen.yaml
│ ├── projects.application.gen.yaml
│ └── stages.application.gen.yaml
├── prod-bank-web
│ ├── components
│ │ ├── prod-east-frontend
│ │ │ ├── kustomization.yaml
│ │ │ └── prod-east-frontend.gen.yaml
│ │ └── prod-west-frontend
│ │ ├── kustomization.yaml
│ │ └── prod-west-frontend.gen.yaml
│ └── gitops
│ ├── prod-east-frontend.application.gen.yaml
│ └── prod-west-frontend.application.gen.yaml
└── security
├── components
│ ├── cert-manager
│ │ └── cert-manager.gen.yaml
│ ├── external-secrets
│ │ └── external-secrets.gen.yaml
│ ├── external-secrets-crds
│ │ └── external-secrets-crds.gen.yaml
│ ├── local-ca
│ │ └── local-ca.gen.yaml
│ └── namespaces
│ └── namespaces.gen.yaml
└── gitops
├── cert-manager.application.gen.yaml
├── external-secrets-crds.application.gen.yaml
├── external-secrets.application.gen.yaml
├── local-ca.application.gen.yaml
└── namespaces.application.gen.yaml
106 directories, 159 files
```
113 lines
3.2 KiB
Bash
Executable File
113 lines
3.2 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
# cd to the repository root
|
|
TOPLEVEL="$(cd $(dirname "$0") && git rev-parse --show-toplevel)"
|
|
cd "$TOPLEVEL"
|
|
|
|
set -xeuo pipefail
|
|
|
|
apply() {
|
|
local file="${1%.gen.yaml}.gen.yaml"
|
|
local cluster="${2:-workload}"
|
|
|
|
find "deploy/clusters/${cluster}" -name "${file}" \
|
|
| xargs -S1024 -I% -n1 bash -c 'test -s % && echo % || true' \
|
|
| xargs -S1024 -I% -n1 kubectl apply --force-conflicts --server-side=true -f %
|
|
}
|
|
|
|
applyDir() {
|
|
local dir="${1}"
|
|
local cluster="${2:-workload}"
|
|
|
|
find "deploy/clusters/${cluster}" -type d -name "${dir}" \
|
|
| xargs -I% -n1 kubectl apply --force-conflicts --server-side=true -f %
|
|
}
|
|
|
|
applyProject() {
|
|
local project="${1}"
|
|
local cluster="${2:-workload}"
|
|
|
|
find "deploy/clusters/${cluster}/projects/${project}/components" -name "*.gen.yaml" \
|
|
| xargs -S1024 -I% -n1 bash -c 'test -s % && echo % || true' \
|
|
| xargs -t -S1024 -I% -n1 kubectl apply --force-conflicts --server-side=true -f %
|
|
}
|
|
|
|
# Namespaces first
|
|
apply namespaces
|
|
|
|
# Custom Resource Definitions
|
|
apply argocd-crds
|
|
apply rollouts-crds
|
|
apply gateway-api
|
|
apply external-secrets-crds
|
|
kubectl wait --for=condition=Established crd --all --timeout=300s
|
|
|
|
# External Secrets
|
|
apply external-secrets
|
|
# Cert Manager (CRDs are included)
|
|
apply cert-manager
|
|
# Wait for cert manager to be available so we can manage the cluster issuer
|
|
kubectl wait --for=condition=Available deployment/cert-manager-webhook -n cert-manager --timeout=300s
|
|
|
|
# Manage the cluster issuer (local-ca)
|
|
apply local-ca
|
|
if ! kubectl wait --for=condition=Ready clusterissuer/local-ca --timeout=30s; then
|
|
echo 'Did you forget to apply your local CA? See: https://holos.run/docs/local-cluster/#reset-the-cluster' >&2
|
|
exit 1
|
|
fi
|
|
|
|
# ArgoCD
|
|
apply argocd
|
|
apply app-projects
|
|
apply rollouts
|
|
|
|
# Kargo
|
|
kubectl wait --for=condition=Available deployment/external-secrets-webhook -n external-secrets --timeout=300s
|
|
apply kargo-secrets
|
|
apply kargo # includes crds
|
|
|
|
# Istio
|
|
apply istio-base
|
|
apply istiod
|
|
apply istio-cni
|
|
apply istio-ztunnel
|
|
apply istio-gateway
|
|
|
|
if ! kubectl wait --for=condition=Ready pod -l k8s-app=istio-cni-node --timeout=300s -n istio-system; then
|
|
echo 'istio-cni-node not ready' >&2
|
|
exit 1
|
|
fi
|
|
# Routes should be accepted, but all backends aren't valid yet.
|
|
apply httproutes
|
|
|
|
# ArgoCD Applications
|
|
applyDir gitops
|
|
|
|
# Kargo Projects. They need the webhook but we don't need them until later.
|
|
kubectl wait --for=condition=Available deployment/kargo-webhooks-server -n kargo --timeout=300s
|
|
|
|
## nonprod Bank of Holos
|
|
applyProject nonprod-bank-security
|
|
applyProject nonprod-bank-backend
|
|
applyProject nonprod-bank-web
|
|
## prod Bank of Holos
|
|
applyProject prod-bank-security
|
|
applyProject prod-bank-backend
|
|
applyProject prod-bank-web
|
|
|
|
set +x
|
|
echo
|
|
echo "httproutes:"
|
|
echo " - https://argocd.holos.localhost"
|
|
echo " - https://kargo.holos.localhost"
|
|
echo " - https://prod-east-bank-frontend.holos.localhost - Regional endpoint"
|
|
echo " - https://prod-west-bank-frontend.holos.localhost - Regional endpoint"
|
|
echo " - https://bank.holos.localhost - Routes to all prod environments"
|
|
echo
|
|
echo "Kargo admin password:"
|
|
echo " run: kubectl get secret -n kargo admin-credentials -o json | jq --exit-status -r '.data.password | @base64d'"
|
|
echo
|
|
set -x
|
|
|
|
exit 0
|