kubernetes-sigs / cluster-api-provider-azure

Cluster API implementation for Microsoft Azure
https://capz.sigs.k8s.io/
Apache License 2.0
293 stars 422 forks source link

Provide more ASO API migration guidance #5032

Open dtzar opened 2 months ago

dtzar commented 2 months ago

Describe the solution you'd like Provide more guidance on a supported migration for production clusters using the current CAPZ definitions to the ASO-based API definition. Add this guidance to what is exists here: https://capz.sigs.k8s.io/topics/managedcluster.html?highlight=import#option-1-using-the-experimental-aso-based-api

nojnhuh commented 3 weeks ago

This is roughly what I would try first to achieve this:

  1. Create an AKS cluster with the old AzureManagedControlPlane API
  2. Pause the cluster (set the Cluster's spec.paused=true)
  3. asoctl import the resource group (which should also capture the managed cluster and agent pools)
    • Include the -a sigs.k8s.io/cluster-api-provider-azure-adopt=true flag to annotate the resources
  4. Apply the asoctl imported resources to the cluster
  5. CAPZ should automatically create all the necessary CAPI/CAPZ resources to represent the cluster
  6. Delete the old AzureManagedControlPlane-backed Cluster
    • This might hang because the cluster is paused, so one way to get past that is to delete and remove all finalizers from the Cluster and all of its child resources manually.
    • Creating a new management cluster for the new Cluster may make this easier because then the old management cluster can be deleted entirely without trying to trace everything that is ultimately owned by the old Cluster.