Created
March 10, 2022 12:52
-
-
Save JensAc/4f46b9755944f86963b73471a4c2d863 to your computer and use it in GitHub Desktop.
Local Gardener
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
#!/usr/bin/env bash | |
set -e | |
# make sure no cluster is running anymore | |
make kind-down | |
# export LD_PRELOAD to libuserhost. | |
# This enables using the extension-local-provider as non-priviledged user | |
export LD_PRELOAD=$(whereis libuserhosts.so | cut -d ' ' -f 2 ) | |
# create a tmux session | |
session="gardener" | |
tmux new-session -d -s $session | |
window=0 | |
tmux rename-window -t $session:$window 'apiserver' | |
echo "I will setup a tmux session for a local gardener now...hang on tight" | |
# set up a tmux window for the api server | |
tmux send-keys -t $session:$window \ | |
'make kind-up KIND_ENV=local' Enter \ | |
'export KUBECONFIG=example/gardener-local/kind/kubeconfig' Enter \ | |
'make dev-setup' Enter \ | |
'sleep 20' Enter \ | |
'kubectl wait --for=condition=ready pod -l run=etcd -n garden --timeout 2m' Enter \ | |
'make start-apiserver' Enter | |
echo "Just deployed the apiserver, now we will wait for a couple of seconds" | |
while [[ ! $(pgrep -f "gardener-apiserver/main.go") ]] | |
do | |
echo "Waiting for gardener-apiserver to become ready" | |
sleep 5 | |
done | |
window=1 | |
tmux new-window -t $session:$window -n 'admission-controller' | |
tmux send-keys -t $session:$window \ | |
'export KUBECONFIG=example/gardener-local/kind/kubeconfig' Enter \ | |
'kubectl wait --for=condition=available apiservice v1beta1.core.gardener.cloud --timeout 2m' Enter \ | |
'sleep 5' Enter \ | |
'make start-admission-controller' Enter | |
echo "Just deployed the admission-controller, again waiting" | |
while [[ ! $(pgrep -f "gardener-admission-controller/main.go") ]] | |
do | |
echo "Waiting for gardener-admission-controller to become ready" | |
sleep 1 | |
done | |
window=2 | |
tmux new-window -t $session:$window -n 'controller-manager' | |
tmux send-keys -t $session:$window \ | |
'export KUBECONFIG=example/gardener-local/kind/kubeconfig' Enter \ | |
'make dev-setup DEV_SETUP_WITH_WEBHOOKS=true' Enter \ | |
'sleep 20' Enter \ | |
'make start-controller-manager' Enter | |
echo "Just deployed the controller-manager, be patient" | |
while [[ ! $(pgrep -f "gardener-controller-manager/main.go") ]] | |
do | |
echo "Waiting for gardener-controller-manager to become ready" | |
sleep 5 | |
done | |
window=3 | |
tmux new-window -t $session:$window -n 'scheduler' | |
tmux send-keys -t $session:$window \ | |
'export KUBECONFIG=example/gardener-local/kind/kubeconfig' Enter \ | |
'sleep 20' Enter \ | |
'make start-scheduler' Enter | |
echo "Just deployed the scheduler, almost done..." | |
while [[ ! $(pgrep -f "gardener-scheduler/main.go") ]] | |
do | |
echo "Waiting for gardener-scheduler to become ready" | |
sleep 1 | |
done | |
window=4 | |
tmux new-window -t $session:$window -n 'gardenlet' | |
tmux send-keys -t $session:$window \ | |
'export KUBECONFIG=example/gardener-local/kind/kubeconfig' Enter \ | |
'sleep 20' Enter \ | |
'make register-local-env' Enter \ | |
'sleep 5' Enter \ | |
'make start-gardenlet SEED_NAME=local' Enter | |
echo "Just deployed the gardenlet, I will take you to the tmux session in 3 seconds...." | |
sleep 3 | |
tmux attach -t $session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment