Skip to content

Commit

Permalink
backup seaweedfs label and namespace in disaster recovery (#4660)
Browse files Browse the repository at this point in the history
* backup seaweedfs label and namespace in disaster recovery

* unit test updates
  • Loading branch information
laverya committed Jun 5, 2024
1 parent 12bf0e7 commit 5884615
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pkg/kotsadmsnapshot/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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",
},
},
}
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/kotsadmsnapshot/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -674,6 +674,11 @@ func Test_instanceBackupLabelSelectors(t *testing.T) {
"app": "docker-registry",
},
},
{
MatchLabels: map[string]string{
"app.kubernetes.io/name": "seaweedfs",
},
},
},
},
}
Expand Down

0 comments on commit 5884615

Please sign in to comment.