-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic Tenant deployment script (#953)
Co-authored-by: cniackz <cniackz@cniackzs-MacBook-Air.local>
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This is a basic workflow to execute our Tenant deployment script | ||
|
||
name: Bash | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Runs a set of commands using the runners shell | ||
- name: Run a multi-line script | ||
run: | | ||
chmod 755 "${GITHUB_WORKSPACE}/testing/basic-tenant.sh" | ||
cd "${GITHUB_WORKSPACE}/testing/" | ||
"${GITHUB_WORKSPACE}/testing/basic-tenant.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2022, MinIO, Inc. | ||
# | ||
# This code is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License, version 3, | ||
# as published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License, version 3, | ||
# along with this program. If not, see <http://www.gnu.org/licenses/> | ||
|
||
# This script requires: kubectl, kind | ||
|
||
yell() { echo "$0: $*" >&2; } | ||
|
||
die() { | ||
yell "$*" | ||
(kind delete cluster || true ) && exit 111 | ||
} | ||
|
||
try() { "$@" || die "cannot $*"; } | ||
|
||
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 -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 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |