From 588461596b85cf526af95f2102fe16505434eb95 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 6 Jun 2024 03:18:07 +1000 Subject: [PATCH] backup seaweedfs label and namespace in disaster recovery (#4660) * backup seaweedfs label and namespace in disaster recovery * unit test updates --- pkg/kotsadmsnapshot/backup.go | 8 ++++++++ pkg/kotsadmsnapshot/backup_test.go | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/kotsadmsnapshot/backup.go b/pkg/kotsadmsnapshot/backup.go index 6b354eb9b5..abd77860bd 100644 --- a/pkg/kotsadmsnapshot/backup.go +++ b/pkg/kotsadmsnapshot/backup.go @@ -991,6 +991,7 @@ func prepareIncludedNamespaces(namespaces []string, isEC bool) []string { uniqueNamespaces["kube-system"] = true uniqueNamespaces["openebs"] = true uniqueNamespaces["registry"] = true + uniqueNamespaces["seaweedfs"] = true } includedNamespaces := make([]string, len(uniqueNamespaces)) @@ -1097,6 +1098,13 @@ func instanceBackupLabelSelectors(isEmbeddedCluster bool) []*metav1.LabelSelecto "app": "docker-registry", }, }, + { + // we cannot add new labels to the seaweedfs chart as of June 6th 2024 + // so we need to add a label selector for the seaweedfs app + MatchLabels: map[string]string{ + "app.kubernetes.io/name": "seaweedfs", + }, + }, } } diff --git a/pkg/kotsadmsnapshot/backup_test.go b/pkg/kotsadmsnapshot/backup_test.go index 30ff75ca8a..9386d2c790 100644 --- a/pkg/kotsadmsnapshot/backup_test.go +++ b/pkg/kotsadmsnapshot/backup_test.go @@ -85,7 +85,7 @@ func TestPrepareIncludedNamespaces(t *testing.T) { { name: "embedded-cluster install", namespaces: []string{"test", "abcapp"}, - want: []string{"test", "abcapp", "embedded-cluster", "kube-system", "openebs", "registry"}, + want: []string{"test", "abcapp", "embedded-cluster", "kube-system", "openebs", "registry", "seaweedfs"}, isEC: true, }, } @@ -674,6 +674,11 @@ func Test_instanceBackupLabelSelectors(t *testing.T) { "app": "docker-registry", }, }, + { + MatchLabels: map[string]string{ + "app.kubernetes.io/name": "seaweedfs", + }, + }, }, }, }