-
Notifications
You must be signed in to change notification settings - Fork 25
feat: migration script for V1 to V2 components #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kimwnasptd
wants to merge
14
commits into
kubeflow:main
Choose a base branch
from
kimwnasptd:feat-migration-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+132
−1
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ae66bf2
feat: script for V1 to V2 migration
kimwnasptd f2c4684
feat: update README.md for upgrade instructions
kimwnasptd 6f84e02
Update README.md
kimwnasptd 35a4ea2
Update README.md
kimwnasptd 23fb0f7
Update README.md
kimwnasptd 41e1cbb
Update README.md
kimwnasptd 11f879c
Update scripts/upgrade_v1_to_v2.sh
kimwnasptd 953cdfe
Update scripts/upgrade_v1_to_v2.sh
kimwnasptd a725173
Update scripts/upgrade_v1_to_v2.sh
kimwnasptd 186408a
Update scripts/upgrade_v1_to_v2.sh
kimwnasptd 66e2345
Update README.md
kimwnasptd 4691fd5
Update README.md
kimwnasptd be7d1cf
review: wait on delete and dashboard order
kimwnasptd 5cf0e01
review: explanation of dashboard overlay
kimwnasptd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asking b/c I have no idea - but is it "safe" to assume the overlays this script is using when deploying to any potential client (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say yes, for:
cert-manageroverlay, which is currently the only supported way for creating the Webhook certificatekubeflowoverlay, which is what we want to install in this case (platform)The only one with a bit of a debate would be the dashboard, as the script uses the
kserveoverlay (had a bug, and was usingistio) which in turn expects KServe to be deployed.Adding a small note in the README. LMKWDYT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5cf0e01