From 790884a3bba254bfe0085590f2eb72bfedb2a4f3 Mon Sep 17 00:00:00 2001 From: Ondra Kupka Date: Tue, 27 Jan 2026 14:08:39 +0100 Subject: [PATCH] resourcesync: Handle conflict gracefully Do not degrade on conflict when applying changes. Let the machinery retry automatically when the state is sync'd. --- .../resourcesynccontroller/resourcesync_controller.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/operator/resourcesynccontroller/resourcesync_controller.go b/pkg/operator/resourcesynccontroller/resourcesync_controller.go index cbfc2dd5f4..9aa1088415 100644 --- a/pkg/operator/resourcesynccontroller/resourcesync_controller.go +++ b/pkg/operator/resourcesynccontroller/resourcesync_controller.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" "net/http" "sort" "strings" @@ -17,6 +16,7 @@ import ( corev1client "k8s.io/client-go/kubernetes/typed/core/v1" operatorv1 "github.com/openshift/api/operator/v1" + applyoperatorv1 "github.com/openshift/client-go/operator/applyconfigurations/operator/v1" "github.com/openshift/library-go/pkg/controller/factory" "github.com/openshift/library-go/pkg/operator/condition" @@ -226,7 +226,7 @@ func (c *ResourceSyncController) Sync(ctx context.Context, syncCtx factory.SyncC } _, _, err := resourceapply.SyncPartialConfigMap(ctx, c.configMapGetter, syncCtx.Recorder(), source.Namespace, source.Name, destination.Namespace, destination.Name, source.syncedKeys, []metav1.OwnerReference{}) - if err != nil { + if err != nil && !apierrors.IsConflict(err) { errors = append(errors, errorWithProvider(source.Provider, err)) } } @@ -254,7 +254,7 @@ func (c *ResourceSyncController) Sync(ctx context.Context, syncCtx factory.SyncC } _, _, err := resourceapply.SyncPartialSecret(ctx, c.secretGetter, syncCtx.Recorder(), source.Namespace, source.Name, destination.Namespace, destination.Name, source.syncedKeys, []metav1.OwnerReference{}) - if err != nil { + if err != nil && !apierrors.IsConflict(err) { errors = append(errors, errorWithProvider(source.Provider, err)) } }