@@ -28,7 +28,6 @@ import (
28
28
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
29
29
"k8s.io/apimachinery/pkg/runtime/schema"
30
30
"k8s.io/apimachinery/pkg/types"
31
- "k8s.io/client-go/util/retry"
32
31
"kpt.dev/configsync/pkg/api/kpt.dev/v1alpha1"
33
32
"kpt.dev/configsync/pkg/reconcilermanager/controllers"
34
33
"kpt.dev/configsync/pkg/resourcegroup/controllers/handler"
@@ -153,16 +152,21 @@ func updateResourceMetrics(ctx context.Context, nn types.NamespacedName, statuse
153
152
metrics .RecordKCCResourceCount (ctx , nn , int64 (kccCount ))
154
153
}
155
154
155
+ // updateStatusKptGroup updates the ResourceGroup status.
156
+ // To avoid unnecessary updates, it sorts the conditions and checks for a diff.
157
+ //
158
+ // This method explicitly does not retry on conflict errors, to allow the
159
+ // controller manager to handle retry backoff, which it does for all errors,
160
+ // not just conflicts. This allows the reconciler to pick up new changes between
161
+ // update attempts, instead of getting stuck here retrying endlessly.
156
162
func (r * reconciler ) updateStatusKptGroup (ctx context.Context , resgroup * v1alpha1.ResourceGroup , newStatus v1alpha1.ResourceGroupStatus ) error {
157
163
newStatus .Conditions = adjustConditionOrder (newStatus .Conditions )
158
- return retry .RetryOnConflict (retry .DefaultBackoff , func () error {
159
- if apiequality .Semantic .DeepEqual (resgroup .Status , newStatus ) {
160
- return nil
161
- }
162
- resgroup .Status = newStatus
163
- // Use `r.Status().Update()` here instead of `r.Update()` to update only resgroup.Status.
164
- return r .client .Status ().Update (ctx , resgroup , client .FieldOwner (FieldManager ))
165
- })
164
+ if apiequality .Semantic .DeepEqual (resgroup .Status , newStatus ) {
165
+ return nil
166
+ }
167
+ resgroup .Status = newStatus
168
+ // Use `r.Status().Update()` here instead of `r.Update()` to update only resgroup.Status.
169
+ return r .client .Status ().Update (ctx , resgroup , client .FieldOwner (FieldManager ))
166
170
}
167
171
168
172
func (r * reconciler ) startReconcilingStatus (status v1alpha1.ResourceGroupStatus ) v1alpha1.ResourceGroupStatus {
0 commit comments