Skip to content

Commit

Permalink
handler: Retry enactment update (#1215)
Browse files Browse the repository at this point in the history
At some scenarios it takes some retries to update the enactment status
if the network is not totally settle. This change add some retries to
enactment status update.

Signed-off-by: Enrique Llorente <[email protected]>
  • Loading branch information
qinqon authored Nov 16, 2023
1 parent c072c22 commit 80c6e01
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/enactmentstatus/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@ import (
)

var (
log = logf.Log.WithName("enactmentstatus")
log = logf.Log.WithName("enactmentstatus")
allErrors = func(error) bool { return true }
)

func Update(cli client.Client, key types.NamespacedName, statusSetter func(*nmstate.NodeNetworkConfigurationEnactmentStatus)) error {
logger := log.WithValues("enactment", key.Name)
return retry.RetryOnConflict(retry.DefaultRetry, func() error {

// Some network configuration can break api server connectivity temporally and that
// prevents the NNCE to final state so is forever at in progress makeing the NNCP also
// forever in progress too, this retry allow to overcome that issue.
return retry.OnError(retry.DefaultRetry, allErrors, func() error {
instance := &nmstatev1beta1.NodeNetworkConfigurationEnactment{}
err := cli.Get(context.TODO(), key, instance)
if err != nil {
Expand Down

0 comments on commit 80c6e01

Please sign in to comment.