From c992315059a31acf728823cbe909b46d5a99d6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wenkai=20Yin=28=E5=B0=B9=E6=96=87=E5=BC=80=29?= Date: Tue, 22 Nov 2022 17:10:38 +0800 Subject: [PATCH] Restore ClusterBootstrap before Cluster MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restore ClusterBootstrap before Cluster otherwise a new default ClusterBootstrap object is create for the cluster Signed-off-by: Wenkai Yin(尹文开) --- changelogs/unreleased/5615-ywk253100 | 1 + pkg/cmd/server/server.go | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/5615-ywk253100 diff --git a/changelogs/unreleased/5615-ywk253100 b/changelogs/unreleased/5615-ywk253100 new file mode 100644 index 0000000000..76c266cd16 --- /dev/null +++ b/changelogs/unreleased/5615-ywk253100 @@ -0,0 +1 @@ +Restore ClusterBootstrap before Cluster otherwise a new default ClusterBootstrap object is create for the cluster \ No newline at end of file diff --git a/pkg/cmd/server/server.go b/pkg/cmd/server/server.go index e7c85ed736..3347623e95 100644 --- a/pkg/cmd/server/server.go +++ b/pkg/cmd/server/server.go @@ -487,12 +487,13 @@ func (s *server) veleroResourcesExist() error { // - Replica sets go before deployments/other controllers so they can be explicitly // restored and be adopted by controllers. // - CAPI ClusterClasses go before Clusters. +// +// Low priorities: +// - Tanzu ClusterBootstraps go last as it can reference any other kind of resources. +// ClusterBootstraps go before CAPI Clusters otherwise a new default ClusterBootstrap object is created for the cluster // - CAPI Clusters come before ClusterResourceSets because failing to do so means the CAPI controller-manager will panic. // Both Clusters and ClusterResourceSets need to come before ClusterResourceSetBinding in order to properly restore workload clusters. // See https://github.com/kubernetes-sigs/cluster-api/issues/4105 -// -// Low priorities: -// - Tanzu ClusterBootstrap go last as it can reference any other kind of resources var defaultRestorePriorities = restore.Priorities{ HighPriorities: []string{ "customresourcedefinitions", @@ -514,11 +515,11 @@ var defaultRestorePriorities = restore.Priorities{ // in the backup. "replicasets.apps", "clusterclasses.cluster.x-k8s.io", - "clusters.cluster.x-k8s.io", - "clusterresourcesets.addons.cluster.x-k8s.io", }, LowPriorities: []string{ "clusterbootstraps.run.tanzu.vmware.com", + "clusters.cluster.x-k8s.io", + "clusterresourcesets.addons.cluster.x-k8s.io", }, }