Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
retry on recoverable propagation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
zqzten committed Jun 22, 2021
1 parent 9631566 commit 6e7d14b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/controller/sync/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,15 @@ func (s *KubeFedSyncController) setFederatedStatus(fedResource FederatedResource
return util.StatusError
}

// return Error to trigger a retry with back off on recoverable propagation failure
if reason == status.AggregateSuccess {
for _, value := range collectedStatus.StatusMap {
if status.IsRecoverableError(value) {
return util.StatusError
}
}
}

return util.StatusAllOK
}

Expand Down
18 changes: 18 additions & 0 deletions pkg/controller/sync/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,24 @@ func SetFederatedStatus(fedObject *unstructured.Unstructured, reason AggregateRe
return true, nil
}

// IsRecoverableError returns whether the given PropagationStatus is a possibly recoverable error.
func IsRecoverableError(status PropagationStatus) bool {
switch status {
case
CreationFailed,
UpdateFailed,
DeletionFailed,
LabelRemovalFailed,
RetrievalFailed,
CreationTimedOut,
UpdateTimedOut,
DeletionTimedOut,
LabelRemovalTimedOut:
return true
}
return false
}

// update ensures that the status reflects the given generation, reason
// and collected status. Returns a boolean indication of whether the
// status has been changed.
Expand Down

0 comments on commit 6e7d14b

Please sign in to comment.