diff --git a/README.md b/README.md index 4aeb930d..bacade58 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ It exposes the access controlled web interfaces for Kubeflow components and more. > ⚠️ __Note__ ⚠️ -> +> > We are currently moving the Kubeflow Dashboard codebase from [`kubeflow/kubeflow`](https://github.com/kubeflow/kubeflow) to this repository ([`kubeflow/dashboard`](https://github.com/kubeflow/dashboard)). > Please see [`kubeflow/kubeflow#7549`](https://github.com/kubeflow/kubeflow/issues/7549) for more information. @@ -38,6 +38,40 @@ Please refer to the [Installing Kubeflow](https://www.kubeflow.org/docs/started/ The official documentation for Kubeflow Dashboard can be found [here](https://www.kubeflow.org/docs/components/central-dash/). +## Migrate from V1 + +In the past, up until the Kubeflow 1.10 release, the components hosted in this repository were living in the +[`kubeflow/kubeflow`](https://github.com/kubeflow/kubeflow) repository. + +To accomodate the migration, the first `v2.0.0` release of this repository contains the same artifacts +from the corresponding [`v1.10.0`](https://github.com/kubeflow/kubeflow/releases/tag/v1.10.0) tag from the `kubeflow/kubeflow` repo. This was done to ensure a smooth transition +between the components of the different repos. You can find more details about the migration in https://github.com/kubeflow/dashboard/issues/118. + +### Prerequisites + +1. A Kubeflow cluster with 1.10.0 or above +2. `kubectl` configured for access to the above cluster + +### Script + +You can use the following script to perform the migration from `v1.10.0` components to the `v2.0.0` ones from this repository. The script will +perform the following actions: +1. Remove the existing components of CentralDashboard, Profiles Controller and PodDefaults Webhook + * The script will not remove any CR (Custom Resource) or CRD (Custom Resource Definition), to ensure no data loss + * Only Kubernetes resources relevant to the Deployments will be removed (Deployment, ServiceAccount, Service etc) + * The [`NetworkPolicy`](https://github.com/kubeflow/manifests/blob/v1.10-branch/common/networkpolicies/base/centraldashboard.yaml) from the `kubeflow/manifests` repo, of the CentralDashboard, will be removed +2. Install the manifests from this repository for the Dashboard, Profiles Controller and PodDefaults webhook + +```bash +./scripts/upgrade_v1_to_v2.sh +``` + +> **NOTE**: The script will use the `overlays/kserve` for the Dashboard, since this is what was also used by the 1.10.2 manifests +> [`[1]`](https://github.com/kubeflow/manifests/blob/v1.10.2/example/kustomization.yaml#L74) +> [`[2]`](https://github.com/kubeflow/manifests/blob/v1.10.2/applications/centraldashboard/overlays/oauth2-proxy/kustomization.yaml#L6). +> This means that the dashboard will have a link to the models web app, and expects it to be deployed. If this is not the case for your cluster, you should instead deploy +> the dashboard using the `overlays/istio` overlay. + ## Community Kubeflow Dashboard is part of the Kubeflow project, refer to the [Kubeflow Community](https://www.kubeflow.org/docs/about/community/) page for more information. diff --git a/scripts/upgrade_v1_to_v2.sh b/scripts/upgrade_v1_to_v2.sh new file mode 100755 index 00000000..168813b9 --- /dev/null +++ b/scripts/upgrade_v1_to_v2.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +echo "--------------------------------------------------------------------------------------" +echo "Running the upgrade script to migrate the Kubeflow Dashboard components to V2 release." +echo "--------------------------------------------------------------------------------------" + +PROFILES_LABELS=kustomize.component=profiles +DASHBOARD_LABELS=app.kubernetes.io/component=centraldashboard +PODDEFAULT_LABELS=app.kubernetes.io/component=poddefaults + +# Helper function for removing all K8s resources of a Kubeflow Component. This will include all resources +# relevant to the Deployment, but not CRDs. This is done to ensure we don't accidentally delete CRs +# (like PodDefaults) in user namespace. +remove-component() { + label=$1 + namespace_resources="deployment service role rolebinding configmap serviceaccount virtualservice authorizationpolicy certificate secret" + cluster_resources="clusterrole clusterrolebinding mutatingwebhookconfigurations" + + echo -e "\nWill remove namespaced resources with labels: $label" + for resource in $namespace_resources; do + echo "Removing all $resource objects..." + kubectl delete -n kubeflow -l $label $resource --wait --timeout=300s + echo "Successfully removed all $resource objects" + done + + for resource in $cluster_resources; do + echo "Removing all $resource objects..." + kubectl delete -l $label $resource --wait --timeout=300s + echo "Successfully removed all $resource objects" + done +} + + +echo -e "\nRemoving PodDefaults component..." +remove-component $PODDEFAULT_LABELS +echo -e "\nSuccessfully removed PodDefaults!" + +echo -e "\nRemoving Profiles component..." +remove-component $PROFILES_LABELS +echo -e "\nSuccessfully removed Profiles!\n" + +echo -e "\nRemoving Centraldashboard component..." +remove-component $DASHBOARD_LABELS +echo "Removing NetworkPolicy created by kubeflow/manifests repository..." +kubectl delete networkpolicy -n kubeflow centraldashboard || echo "No NetworkPolicy from manifests repository found. Continuing..." +echo -e "\nSuccessfully removed Centraldashboard!" + +echo "-----------------------------------------------" +echo "Installing the updated Dashboard V2 components." +echo "-----------------------------------------------" + +echo -e "\nApplying PodDefaults component..." +echo -e "----------------------------------" +kustomize build \ + $SCRIPT_DIR/../components/poddefaults-webhooks/manifests/overlays/cert-manager \ + | kubectl apply -f - + +echo "Waiting for PodDefaults Webhook Deployment to become available..." +kubectl wait -n kubeflow \ + --for=condition=Available \ + deployment \ + poddefaults-webhook-deployment \ + --timeout=5m +echo -e "Successfully applied the PodDefaults component!" + +echo -e "\nApplying Profile Controller component..." +echo -e "-----------------------------------------" +kustomize build \ + $SCRIPT_DIR/../components/profile-controller/config/overlays/kubeflow/ \ + | kubectl apply -f - + +echo "Waiting for Profiles Controller Deployment to become available..." +kubectl wait -n kubeflow \ + --for=condition=Available \ + deployment \ + profiles-deployment \ + --timeout=5m +echo -e "Successfully applied the Profile Controller component!" + +echo -e "\nApplying Dashboard component..." +echo -e "--------------------------------" +kustomize build \ + $SCRIPT_DIR/../components/centraldashboard/manifests/overlays/kserve \ + | kubectl apply -f - + +echo "Waiting for Dashboard Deployment to become available..." +kubectl wait -n kubeflow \ + --for=condition=Available \ + deployment \ + dashboard \ + --timeout=5m +echo -e "Successfully applied the Dashboard component!" + +echo -e "\nSuccessfully applied Dashboard V2 components!\n"