From 80c6e01df02e7b0993dbdbd43576ac214c5d29ef Mon Sep 17 00:00:00 2001 From: Enrique Llorente Pastora Date: Thu, 16 Nov 2023 16:39:22 +0100 Subject: [PATCH] handler: Retry enactment update (#1215) 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 --- pkg/enactmentstatus/status.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/enactmentstatus/status.go b/pkg/enactmentstatus/status.go index c350de8acf..83ed68bdfb 100644 --- a/pkg/enactmentstatus/status.go +++ b/pkg/enactmentstatus/status.go @@ -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 {