diff --git a/kind/hack/tools/install_kubeflow.sh b/kind/hack/tools/install_kubeflow.sh index 3456fe476..17f912646 100755 --- a/kind/hack/tools/install_kubeflow.sh +++ b/kind/hack/tools/install_kubeflow.sh @@ -1,79 +1,78 @@ #!/usr/bin/env bash -op=$1 - -source ../common.sh - +# Set default values if not provided SLEEP_TIME="${SLEEP_TIME:-50}" MAX_RETRIES="${MAX_RETRIES:-20}" EXIT_CODE=0 -deploy() { - TEMP_DIR="$(mktemp -d)" - echo "Temporary dir:" - echo "${TEMP_DIR}" - cd $TEMP_DIR - git clone https://github.com/kubeflow/pipelines.git - cd pipelines - git checkout tags/${PIPELINE_VERSION} - kubectl apply -k manifests/kustomize/cluster-scoped-resources - kubectl wait --for condition=established --timeout=60s crd/applications.app.k8s.io - # Disable the public endpoint - # ref: https://www.kubeflow.org/docs/components/pipelines/v1/installation/standalone-deployment/#disable-the-public-endpoint - sed -i.back '/inverse-proxy$/d' manifests/kustomize/env/dev/kustomization.yaml - sed -i.back 's/30Mi/60Mi/' manifests/kustomize/third-party/application/application-controller-deployment.yaml - sed -i.back 's/20Mi/60Mi/' manifests/kustomize/third-party/application/application-controller-deployment.yaml - deploy_with_retries "-k" "manifests/kustomize/env/dev" "$MAX_RETRIES" "$SLEEP_TIME" || EXIT_CODE=$? - if [[ $EXIT_CODE -ne 0 ]] - then - echo "Kubeflow deployment unsuccessful." - exit 1 - fi - kubectl create clusterrolebinding pipeline-runner-extend --clusterrole cluster-admin --serviceaccount=kubeflow:pipeline-runner - echo "Finished Kubeflow deployment." - rm -rf $TEMP_DIR -} +# Include common functions +source ../common.sh + +# Functions -wait(){ - echo "Wait for kubeflow deployment." - wait_for_pods "kubeflow" "$MAX_RETRIES" "$SLEEP_TIME" || EXIT_CODE=$? +deploy_kubeflow() { + local temp_dir + temp_dir=$(mktemp -d) + echo "Temporary dir: $temp_dir" + cd "$temp_dir" || exit 1 + git clone https://github.com/kubeflow/pipelines.git + cd pipelines || exit 1 + git checkout "tags/${PIPELINE_VERSION}" + kubectl apply -k manifests/kustomize/cluster-scoped-resources + kubectl wait --for condition=established --timeout=60s crd/applications.app.k8s.io + # Disable the public endpoint + sed -i.back '/inverse-proxy$/d' manifests/kustomize/env/dev/kustomization.yaml + sed -i.back 's/30Mi/60Mi/' manifests/kustomize/third-party/application/application-controller-deployment.yaml + sed -i.back 's/20Mi/60Mi/' manifests/kustomize/third-party/application/application-controller-deployment.yaml + deploy_with_retries "-k" "manifests/kustomize/env/dev" "$MAX_RETRIES" "$SLEEP_TIME" || EXIT_CODE=$? + if [[ $EXIT_CODE -ne 0 ]]; then + echo "Kubeflow deployment unsuccessful." + exit 1 + fi + kubectl create clusterrolebinding pipeline-runner-extend --clusterrole cluster-admin --serviceaccount=kubeflow:pipeline-runner + echo "Finished Kubeflow deployment." + rm -rf "$temp_dir" +} - if [[ $EXIT_CODE -ne 0 ]] - then - echo "Kubeflow Deployment unsuccessful. Not all pods running" - exit $EXIT_CODE - fi - # disable cache for testing - # ref https://www.kubeflow.org/docs/components/pipelines/v1/overview/caching/#disabling-caching-in-your-kubeflow-pipelines-deployment - kubectl patch mutatingwebhookconfiguration cache-webhook-kubeflow --type='json' -p='[{"op":"replace", "path": "/webhooks/0/rules/0/operations/0", "value": "DELETE"}]' +wait_for_kubeflow() { + echo "Waiting for Kubeflow deployment..." + wait_for_pods "kubeflow" "$MAX_RETRIES" "$SLEEP_TIME" || EXIT_CODE=$? + if [[ $EXIT_CODE -ne 0 ]]; then + echo "Kubeflow deployment unsuccessful. Not all pods running." + exit $EXIT_CODE + fi + # Disable cache for testing + kubectl patch mutatingwebhookconfiguration cache-webhook-kubeflow --type='json' -p='[{"op":"replace", "path": "/webhooks/0/rules/0/operations/0", "value": "DELETE"}]' } -delete(){ - kubectl delete -k "github.com/kubeflow/pipelines/manifests/kustomize/cluster-scoped-resources?ref=$PIPELINE_VERSION" - kubectl delete -k "github.com/kubeflow/pipelines/manifests/kustomize/env/dev?ref=$PIPELINE_VERSION" +delete_kubeflow() { + kubectl delete -k "github.com/kubeflow/pipelines/manifests/kustomize/cluster-scoped-resources?ref=$PIPELINE_VERSION" + kubectl delete -k "github.com/kubeflow/pipelines/manifests/kustomize/env/dev?ref=$PIPELINE_VERSION" } -usage(){ - cat <