Skip to content

Commit

Permalink
[PLAT-15282]: fix NPE on k8s operator backup/restore status update
Browse files Browse the repository at this point in the history
Summary: If any failed backup/restore exists in k8s operator resource, then status update for other b/r restore is failed with NPE as old failed resource does not have status.

Test Plan: Tested manually by creating failed backup which does not have status and veridfied the issue but after this change, b/r status were updated correctly as failed one are skipped.

Reviewers: anijhawan, vkumar

Reviewed By: vkumar

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D38125
  • Loading branch information
vipul-yb committed Sep 18, 2024
1 parent 7659151 commit 56c9cc9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public void updateRestoreJobStatus(String message, UUID taskUUID) {

for (RestoreJob restoreJob :
kubernetesClient.resources(RestoreJob.class).inNamespace(namespace).list().getItems()) {
if (restoreJob.getStatus().getTaskUUID().equals(taskUUID.toString())) {
if (restoreJob.getStatus() != null
&& restoreJob.getStatus().getTaskUUID().equals(taskUUID.toString())) {
// Found our Restore.
log.info("Found RestoreJob {} task {} ", restoreJob, taskUUID);
RestoreJobStatus status = restoreJob.getStatus();
Expand Down Expand Up @@ -143,7 +144,8 @@ public void updateBackupStatus(

for (Backup backupCr :
kubernetesClient.resources(Backup.class).inNamespace(namespace).list().getItems()) {
if (backupCr.getStatus().getTaskUUID().equals(taskUUID.toString())) {
if (backupCr.getStatus() != null
&& backupCr.getStatus().getTaskUUID().equals(taskUUID.toString())) {
// Found our backup.
log.info("Found Backup {} task {} ", backupCr, taskUUID);
BackupStatus status = backupCr.getStatus();
Expand Down

0 comments on commit 56c9cc9

Please sign in to comment.