Skip to content

Commit

Permalink
script: make deploy_on_kind idempotent
Browse files Browse the repository at this point in the history
Signed-off-by: Alessio Pragliola <[email protected]>
Co-authored-by: Alessio Pragliola <[email protected]>
Signed-off-by: Isabella do Amaral <[email protected]>
  • Loading branch information
isinyaaa and Al-Pragliola committed Oct 4, 2024
1 parent 4fa3cce commit 5eeab26
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/deploy_on_kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,28 @@ if [[ -n "$LOCAL" ]]; then
IMG="${IMG:-docker.io/kubeflow/model-registry:main}"

echo 'Creating local Kind cluster and loading image'
kind create cluster -n "$CLUSTER_NAME"

if [[ $(kind get clusters || false) =~ $CLUSTER_NAME ]]; then
echo 'Cluster already exists, skipping creation'

kubectl config use-context "kind-$CLUSTER_NAME"
else
kind create cluster -n "$CLUSTER_NAME"
fi

kind load docker-image -n "$CLUSTER_NAME" "$IMG"

echo 'Image loaded into kind cluster - use this command to port forward the mr service:'
echo "kubectl port-forward -n $MR_NAMESPACE service/model-registry-service 8080:8080 &"
fi

echo 'Deploying model registry to Kind cluster'
if [[ $(kubectl get namespaces || false) =~ $MR_NAMESPACE ]]; then
echo 'Namespace already exists, skipping creation'
else
kubectl create namespace "$MR_NAMESPACE"
fi

kubectl create namespace "$MR_NAMESPACE"
kubectl apply -k manifests/kustomize/overlays/db
kubectl set image -n kubeflow deployment/model-registry-deployment rest-container="$IMG"
kubectl wait --for=condition=available -n "$MR_NAMESPACE" deployment/model-registry-db --timeout=5m
Expand Down

0 comments on commit 5eeab26

Please sign in to comment.