Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions demo/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

set -eux

K8S_BASE_NAME=${K8S_NAME:-k8s}
git_repo_root=$(git rev-parse --show-toplevel)
kube_config_path=${git_repo_root}/k8s/kube-config.yaml
demo_yaml_path=${git_repo_root}/demo/yaml
Expand Down Expand Up @@ -60,51 +61,51 @@ for region in eu us; do
# Deploy CloudNativePG operator (trunk - main branch)
curl -sSfL \
https://raw.githubusercontent.com/cloudnative-pg/artifacts/main/manifests/operator-manifest.yaml | \
kubectl --context kind-k8s-${region} apply -f - --server-side
kubectl --context kind-${K8S_BASE_NAME}-${region} apply -f - --server-side
else
# Deploy CloudNativePG operator (latest version, through the plugin)
kubectl cnpg install generate --control-plane | \
kubectl --context kind-k8s-${region} apply -f - --server-side
kubectl --context kind-${K8S_BASE_NAME}-${region} apply -f - --server-side
fi

# Wait for CNPG deployment to complete
kubectl --context kind-k8s-${region} rollout status deployment \
kubectl --context kind-${K8S_BASE_NAME}-${region} rollout status deployment \
-n cnpg-system cnpg-controller-manager

# Deploy cert-manager
kubectl apply --context kind-k8s-${region} -f \
kubectl apply --context kind-${K8S_BASE_NAME}-${region} -f \
https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml

# Wait for cert-manager deployment to complete
kubectl rollout --context kind-k8s-${region} status deployment \
kubectl rollout --context kind-${K8S_BASE_NAME}-${region} status deployment \
-n cert-manager
cmctl check api --wait=2m --context kind-k8s-${region}
cmctl check api --wait=2m --context kind-${K8S_BASE_NAME}-${region}

if [ $trunk -eq 1 ]
then
# Deploy Barman Cloud Plugin (trunk)
kubectl apply --context kind-k8s-${region} -f \
kubectl apply --context kind-${K8S_BASE_NAME}-${region} -f \
https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml
else
# Deploy Barman Cloud Plugin (latest stable)
kubectl apply --context kind-k8s-${region} -f \
kubectl apply --context kind-${K8S_BASE_NAME}-${region} -f \
https://github.com/cloudnative-pg/plugin-barman-cloud/releases/latest/download/manifest.yaml
fi

# Wait for Barman Cloud Plugin deployment to complete
kubectl rollout --context kind-k8s-${region} status deployment \
kubectl rollout --context kind-${K8S_BASE_NAME}-${region} status deployment \
-n cnpg-system barman-cloud

# Create Barman object stores
kubectl apply --context kind-k8s-${region} -f \
kubectl apply --context kind-${K8S_BASE_NAME}-${region} -f \
${demo_yaml_path}/object-stores

# Create the Postgres cluster
kubectl apply --context kind-k8s-${region} -f \
kubectl apply --context kind-${K8S_BASE_NAME}-${region} -f \
${demo_yaml_path}/${region}/pg-${region}${legacy}.yaml

# Wait for the cluster to be ready
kubectl wait --context kind-k8s-${region} \
kubectl wait --context kind-${K8S_BASE_NAME}-${region} \
--timeout 30m \
--for=condition=Ready cluster/pg-${region}

Expand Down
12 changes: 6 additions & 6 deletions demo/teardown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

set -ux

K8S_BASE_NAME=${K8S_NAME:-k8s}
git_repo_root=$(git rev-parse --show-toplevel)
kube_config_path=${git_repo_root}/k8s/kube-config.yaml
demo_yaml_path=${git_repo_root}/demo/yaml
Expand All @@ -33,26 +34,25 @@ export KUBECONFIG=${kube_config_path}

# Delete deployment, one region at a time
for region in eu us; do

# Delete the Postgres cluster
kubectl delete --context kind-k8s-${region} -f \
kubectl delete --context kind-${K8S_BASE_NAME}-${region} -f \
${demo_yaml_path}/${region}

# Delete Barman object stores
kubectl delete --context kind-k8s-${region} -f \
kubectl delete --context kind-${K8S_BASE_NAME}-${region} -f \
${demo_yaml_path}/object-stores

# Delete Barman Cloud Plugin
kubectl delete --context kind-k8s-${region} -f \
kubectl delete --context kind-${K8S_BASE_NAME}-${region} -f \
https://github.com/cloudnative-pg/plugin-barman-cloud/releases/latest/download/manifest.yaml

# Delete cert-manager
kubectl delete --context kind-k8s-${region} -f \
kubectl delete --context kind-${K8S_BASE_NAME}-${region} -f \
https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml

# Delete CNPG operator
kubectl cnpg install generate --control-plane | \
kubectl --context kind-k8s-${region} delete -f -
kubectl --context kind-${K8S_BASE_NAME}-${region} delete -f -

# Remove backup data
docker exec minio-${region} rm -rf /data/backups/pg-${region}
Expand Down