Last active
September 12, 2024 19:24
-
-
Save alexcreasy/ccc5d2a54ecbfd754ef281beac0b7172 to your computer and use it in GitHub Desktop.
Script to stand up / tear down a KF model registry deployment locally on kind
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 | |
CLUSTER_NAME=model-registry-bff | |
MANIFEST=https://github.com/kubeflow/model-registry/manifests/kustomize/overlays/db | |
if [ $# -ne 1 ] || [[ ! $1 =~ ^(up|down)$ ]] then | |
echo "Stands up a kind cluster and deploys model registry" | |
echo "Usage: $(basename $0) up | down" | |
exit 1 | |
fi | |
if [[ $1 == "down" ]]; then | |
kind delete cluster --name "$CLUSTER_NAME" | |
exit 0 | |
fi | |
if [ $(uname -m)="arm64" ]; then | |
MANIFEST=https://github.com/alexcreasy/model-registry/manifests/kustomize/overlays/db?ref=kind | |
fi | |
# Check if cluster is already running | |
kind -q get clusters | grep "$CLUSTER_NAME" >/dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
# Cluster is not running, create | |
kind create cluster --name "$CLUSTER_NAME" --wait 2m | |
kubectl create namespace kubeflow --context "kind-$CLUSTER_NAME" | |
# Deploy MR service | |
echo "Deploying Model Registry manifests" | |
kubectl apply -k "$MANIFEST" --context "kind-$CLUSTER_NAME" | |
echo | |
echo "Waiting ≤ 2m0s for model-registry-deployment = Ready" | |
kubectl wait --for=condition=available -n kubeflow deployment/model-registry-deployment --timeout=2m --context "kind-$CLUSTER_NAME" | |
fi | |
# Check if port-forward is active (it will be deactivated on logout etc) | |
pgrep -f "kubectl port-forward svc/model-registry-service -n kubeflow 8080:8080 --context kind-$CLUSTER_NAME" >/dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
echo "Setting up portforward on port 8080" | |
# Activate port forward and leave in the background | |
nohup kubectl port-forward svc/model-registry-service -n kubeflow 8080:8080 --context "kind-$CLUSTER_NAME" >/dev/null 2>&1 & | |
fi | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment