Skip to content
Open
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
20 changes: 16 additions & 4 deletions scripts/k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,24 @@ fi
if [ $CMD = "start" ]; then
echo "[+] Appliying use-sprkl into your cluster"
USE_SPRKL_ROOT_DIR="$(git rev-parse --show-toplevel)"
helm install use-sprkl $USE_SPRKL_ROOT_DIR/helm/use-sprkl
shop_pod_name=$(kubectl get pod -l app/name=shop -o jsonpath="{.items[0].metadata.name}")
helm upgrade --install use-sprkl $USE_SPRKL_ROOT_DIR/helm/use-sprkl
shop_pod_name=""
retries=0
while true; do
retries=$((retries+1))
shop_pod_name=$(kubectl get pod -l app/name=shop -o jsonpath="{.items[0].metadata.name}")
if [[ $retries -gt 10 ]]; then
echo "Error: failed to find shop pod name after 10 retries."
exit 1
fi
if [[ ! -z $shop_pod_name ]]; then
break
fi
done
echo " >> Waiting for shop service to be ready"
kubectl wait --for=condition=Ready pod/"$shop_pod_name"
echo " >> Open your browser at http://localhost:5000"
kubectl port-forward "$shop_pod_name" 5000:5000
echo " >> Open your browser at http://localhost"
sudo kubectl port-forward svc/shop 80:5000
elif [ $CMD = "stop" ]; then
echo "[+] Removing use-sprkl from your cluster"
helm uninstall use-sprkl
Expand Down