Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Tenant deployment script #953

Merged
merged 13 commits into from
Jan 5, 2022
79 changes: 79 additions & 0 deletions testing/basic-tenant.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# This script requires: kubectl, kind, jq

#set -e

yell() { echo "$0: $*" >&2; }

die() {
dvaldivia marked this conversation as resolved.
Show resolved Hide resolved
yell "$*"
(kind delete cluster || true ) && exit 111
}

try() { "$@" || die "cannot $*"; }
dvaldivia marked this conversation as resolved.
Show resolved Hide resolved

try kind create cluster --config kind-config.yaml

echo "Installing Current Operator"

# TODO: Compile the current branch and create an overlay to use that image version
try kubectl apply -k ../resources

echo "Waiting for Operator Pods to come online"

try kubectl wait --namespace minio-operator \
--for=condition=ready pod \
--selector=name=minio-operator \
--timeout=90s

echo "Installing lite tenant"

try kubectl apply -k ../examples/kustomization/tenant-lite


echo "Waiting for the tenant statefulset, this indicates the tenant is being fulfilled"
waitdone=0
totalwait=0
while true; do
waitdone=$(kubectl -n tenant-lite get pods -o json | jq '.items | length')
if [ "$waitdone" -ne 0 ]; then
echo "Found $waitdone pods"
break
fi
sleep 5
totalwait=$((totalwait + 5))
if [ "$totalwait" -gt 300 ]; then
echo "Tenant never created statefulset after 5 minutes"
try false
fi
done

echo "Waiting for tenant pods to come online (5m timeout)"
try kubectl wait --namespace tenant-lite \
--for=condition=ready pod \
--selector="v1.min.io/tenant=storage-lite" \
--timeout=300s

echo "Build passes basic tenant creation"

# Check MinIO is accessible

waitdone=0
totalwait=0
while true; do
waitdone=$(kubectl -n tenant-lite get pods -l v1.min.io/tenant=storage-lite --no-headers | wc -l)
if [ "$waitdone" -ne 0 ]; then
echo "Found $waitdone pods"
break
fi
sleep 5
totalwait=$((totalwait + 5))
if [ "$totalwait" -gt 305 ]; then
echo "Unable to create tenant after 5 minutes, exiting."
try false
fi
done

# clean up
kind delete cluster
9 changes: 9 additions & 0 deletions testing/kind-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# four node (two workers) cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
- role: worker