@@ -364,9 +364,6 @@ func (c *Controller) handlePhase(ctx context.Context, key string, cachedApp *cac
364
364
}
365
365
366
366
func (c * Controller ) syncAppFromRelease (ctx context.Context , cachedApp * cachedApp , app * applicationv1.App ) (* applicationv1.App , error ) {
367
- if app .Status .Phase == applicationv1 .AppPhaseSucceeded && hasSynced (app ) {
368
- return app , nil
369
- }
370
367
defer func () {
371
368
if r := recover (); r != nil {
372
369
log .Error ("syncAppFromRelease panic" )
@@ -375,12 +372,6 @@ func (c *Controller) syncAppFromRelease(ctx context.Context, cachedApp *cachedAp
375
372
newStatus := app .Status .DeepCopy ()
376
373
rels , err := action .List (ctx , c .client .ApplicationV1 (), c .platformClient , app )
377
374
if err != nil {
378
- if app .Status .Phase == applicationv1 .AppPhaseSyncFailed {
379
- log .Error (fmt .Sprintf ("sync app failed, helm list failed, err: %s" , err .Error ()))
380
- metrics .GaugeApplicationSyncFailed .WithLabelValues (app .Spec .TargetCluster , app .Name ).Set (1 )
381
- // delayed retry, queue.AddRateLimited does not meet the demand
382
- return app , nil
383
- }
384
375
newStatus .Phase = applicationv1 .AppPhaseSyncFailed
385
376
newStatus .Message = "sync app failed"
386
377
newStatus .Reason = err .Error ()
@@ -390,13 +381,8 @@ func (c *Controller) syncAppFromRelease(ctx context.Context, cachedApp *cachedAp
390
381
}
391
382
rel , found := helmutil .Filter (rels , app .Spec .TargetNamespace , app .Spec .Name )
392
383
if ! found {
393
- if app .Status .Phase == applicationv1 .AppPhaseSyncFailed {
394
- log .Error (fmt .Sprintf ("sync app failed, release not found: %s/%s" , app .Spec .TargetNamespace , app .Spec .Name ))
395
- metrics .GaugeApplicationSyncFailed .WithLabelValues (app .Spec .TargetCluster , app .Name ).Set (1 )
396
- // delayed retry, queue.AddRateLimited does not meet the demand
397
- return app , nil
398
- }
399
- newStatus .Phase = applicationv1 .AppPhaseSyncFailed
384
+ // release not found, reinstall for reconcile
385
+ newStatus .Phase = applicationv1 .AppPhaseInstalling
400
386
newStatus .Message = "sync app failed"
401
387
newStatus .Reason = fmt .Sprintf ("release not found: %s/%s" , app .Spec .TargetNamespace , app .Spec .Name )
402
388
newStatus .LastTransitionTime = metav1 .Now ()
0 commit comments