feat: add script for import controller migration #574
Merged
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.
kind/feature
What this PR does / why we need it:
Migrating to the new import controller based on
clusters.management.cattle.io
(v3 clusters) means we need to apply changes to the existing Rancher cluster resources to let the new controller identify CAPI clusters as already imported. As described in the migration proposal #573, the v3 controller looks for cluster resources marked with the following labels:cluster-api.cattle.io/owned
is added to all clusters imported via Turtles, even if using the existingclusters.provisioning.cattle.io
(v1 clusters) based controller. The other two labels must be added to the existingclusters.management.cattle.io
resources to let the new controller's label selector find a match and hence detect that the CAPI cluster is properly imported and no new resource needs to be created.This PR adds a basic bash script for users to run pre-controller-migration so clusters are labeled accordingly. It simply gets one or multiple namespaces as input and applies labels to all Turtles clusters in that namespace.
We'll also be adding instructions on how to do it manually at the cluster level on a migration guide.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Checklist: