@@ -326,7 +326,7 @@ func (r *HelmChartReconciler) reconcileSource(ctx context.Context, obj *sourcev1
326
326
Err : fmt .Errorf ("failed to get source: %w" , err ),
327
327
Reason : "SourceUnavailable" ,
328
328
}
329
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , "SourceUnavailable" , e .Err .Error ())
329
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
330
330
331
331
// Return Kubernetes client errors, but ignore others which can only be
332
332
// solved by a change in generation
@@ -416,7 +416,7 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
416
416
Err : fmt .Errorf ("failed to get secret '%s': %w" , repo .Spec .SecretRef .Name , err ),
417
417
Reason : sourcev1 .AuthenticationFailedReason ,
418
418
}
419
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , sourcev1 . AuthenticationFailedReason , e .Err .Error ())
419
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
420
420
// Return error as the world as observed may change
421
421
return sreconcile .ResultEmpty , e
422
422
}
@@ -428,7 +428,7 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
428
428
Err : fmt .Errorf ("failed to configure Helm client with secret data: %w" , err ),
429
429
Reason : sourcev1 .AuthenticationFailedReason ,
430
430
}
431
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , sourcev1 . AuthenticationFailedReason , e .Err .Error ())
431
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
432
432
// Requeue as content of secret might change
433
433
return sreconcile .ResultEmpty , e
434
434
}
@@ -440,7 +440,7 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
440
440
Err : fmt .Errorf ("failed to create TLS client config with secret data: %w" , err ),
441
441
Reason : sourcev1 .AuthenticationFailedReason ,
442
442
}
443
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , sourcev1 . AuthenticationFailedReason , e .Err .Error ())
443
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
444
444
// Requeue as content of secret might change
445
445
return sreconcile .ResultEmpty , e
446
446
}
@@ -457,14 +457,14 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
457
457
Err : fmt .Errorf ("invalid Helm repository URL: %w" , err ),
458
458
Reason : sourcev1 .URLInvalidReason ,
459
459
}
460
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , sourcev1 . URLInvalidReason , e .Err .Error ())
460
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
461
461
return sreconcile .ResultEmpty , e
462
462
default :
463
463
e := & serror.Stalling {
464
464
Err : fmt .Errorf ("failed to construct Helm client: %w" , err ),
465
465
Reason : meta .FailedReason ,
466
466
}
467
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , meta . FailedReason , e .Err .Error ())
467
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
468
468
return sreconcile .ResultEmpty , e
469
469
}
470
470
}
@@ -509,7 +509,7 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
509
509
Err : fmt .Errorf ("failed to create temporary working directory: %w" , err ),
510
510
Reason : sourcev1 .DirCreationFailedReason ,
511
511
}
512
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , sourcev1 . DirCreationFailedReason , e .Err .Error ())
512
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
513
513
return sreconcile .ResultEmpty , e
514
514
}
515
515
defer os .RemoveAll (tmpDir )
@@ -521,7 +521,7 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
521
521
Err : fmt .Errorf ("failed to create directory to untar source into: %w" , err ),
522
522
Reason : sourcev1 .DirCreationFailedReason ,
523
523
}
524
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , sourcev1 . DirCreationFailedReason , e .Err .Error ())
524
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
525
525
return sreconcile .ResultEmpty , e
526
526
}
527
527
@@ -532,7 +532,7 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
532
532
Err : fmt .Errorf ("failed to open source artifact: %w" , err ),
533
533
Reason : sourcev1 .ReadOperationFailedReason ,
534
534
}
535
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , sourcev1 . ReadOperationFailedReason , e .Err .Error ())
535
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
536
536
return sreconcile .ResultEmpty , e
537
537
}
538
538
if _ , err = untar .Untar (f , sourceDir ); err != nil {
@@ -556,7 +556,7 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
556
556
Err : fmt .Errorf ("path calculation for chart '%s' failed: %w" , obj .Spec .Chart , err ),
557
557
Reason : "IllegalPath" ,
558
558
}
559
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , "IllegalPath" , e .Err .Error ())
559
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e . Reason , e .Err .Error ())
560
560
// We are unable to recover from this change without a change in generation
561
561
return sreconcile .ResultEmpty , e
562
562
}
@@ -664,8 +664,7 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, obj *source
664
664
Err : fmt .Errorf ("failed to create artifact directory: %w" , err ),
665
665
Reason : sourcev1 .DirCreationFailedReason ,
666
666
}
667
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition ,
668
- sourcev1 .DirCreationFailedReason , e .Err .Error ())
667
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e .Err .Error ())
669
668
return sreconcile .ResultEmpty , e
670
669
}
671
670
unlock , err := r .Storage .Lock (artifact )
@@ -674,8 +673,7 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, obj *source
674
673
Err : fmt .Errorf ("failed to acquire lock for artifact: %w" , err ),
675
674
Reason : sourcev1 .AcquireLockFailedReason ,
676
675
}
677
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition ,
678
- sourcev1 .AcquireLockFailedReason , e .Err .Error ())
676
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e .Err .Error ())
679
677
return sreconcile .ResultEmpty , e
680
678
}
681
679
defer unlock ()
@@ -686,8 +684,7 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, obj *source
686
684
Err : fmt .Errorf ("unable to copy Helm chart to storage: %w" , err ),
687
685
Reason : sourcev1 .ArchiveOperationFailedReason ,
688
686
}
689
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition ,
690
- sourcev1 .ArchiveOperationFailedReason , e .Err .Error ())
687
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e .Err .Error ())
691
688
return sreconcile .ResultEmpty , e
692
689
}
693
690
0 commit comments