Skip to content

Commit

Permalink
add backuprepo (#4989)
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyxjh authored Aug 21, 2024
1 parent 132eb38 commit a42f12a
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@ func processBackup(backup unstructured.Unstructured) {
backupPolicyName, _, _ := unstructured.NestedString(backup.Object, "spec", "backupPolicyName")
databaseName := getPrefix(backupPolicyName)
cluster, err := api.DynamicClient.Resource(databaseClusterGVR).Namespace(namespace).Get(context.Background(), databaseName, metav1.GetOptions{})
if cluster != nil && errors.IsNotFound(err) {
if cluster == nil && errors.IsNotFound(err) {
return
}
dbStatus, _, _ := unstructured.NestedString(cluster.Object, "status", "phase")
if dbStatus == "Stopped" {
dbStatus, found, err := unstructured.NestedString(cluster.Object, "status", "phase")
if err != nil {
log.Printf("Unable to get %s phase in %s: %v", backupName, namespace, err)
return
}
if !found || dbStatus == "Stopped" {
return
}
SendBackupNotification(backupName, namespace, status, startTimestamp)
Expand Down

0 comments on commit a42f12a

Please sign in to comment.