@@ -223,7 +223,7 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
223
223
// Resolve the source reference and requeue the reconciliation if the source is not found.
224
224
artifactSource , err := r .getSource (ctx , obj )
225
225
if err != nil {
226
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ArtifactFailedReason , err .Error ())
226
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ArtifactFailedReason , err .Error ())
227
227
228
228
if apierrors .IsNotFound (err ) {
229
229
msg := fmt .Sprintf ("Source '%s' not found" , obj .Spec .SourceRef .String ())
@@ -245,15 +245,15 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
245
245
// Requeue the reconciliation if the source artifact is not found.
246
246
if artifactSource .GetArtifact () == nil {
247
247
msg := fmt .Sprintf ("Source artifact not found, retrying in %s" , r .requeueDependency .String ())
248
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ArtifactFailedReason , msg )
248
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ArtifactFailedReason , msg )
249
249
log .Info (msg )
250
250
return ctrl.Result {RequeueAfter : r .requeueDependency }, nil
251
251
}
252
252
253
253
// Check dependencies and requeue the reconciliation if the check fails.
254
254
if len (obj .Spec .DependsOn ) > 0 {
255
255
if err := r .checkDependencies (ctx , obj , artifactSource ); err != nil {
256
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .DependencyNotReadyReason , err .Error ())
256
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .DependencyNotReadyReason , err .Error ())
257
257
msg := fmt .Sprintf ("Dependencies do not meet ready condition, retrying in %s" , r .requeueDependency .String ())
258
258
log .Info (msg )
259
259
r .event (obj , artifactSource .GetArtifact ().Revision , eventv1 .EventSeverityInfo , msg , nil )
@@ -268,7 +268,7 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
268
268
// Requeue at the specified retry interval if the artifact tarball is not found.
269
269
if errors .Is (reconcileErr , fetch .ErrFileNotFound ) {
270
270
msg := fmt .Sprintf ("Source is not ready, artifact not found, retrying in %s" , r .requeueDependency .String ())
271
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ArtifactFailedReason , msg )
271
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ArtifactFailedReason , msg )
272
272
log .Info (msg )
273
273
return ctrl.Result {RequeueAfter : r .requeueDependency }, nil
274
274
}
@@ -333,20 +333,20 @@ func (r *KustomizationReconciler) reconcile(
333
333
os .Getenv ("SOURCE_CONTROLLER_LOCALHOST" ),
334
334
ctrl .LoggerFrom (ctx ),
335
335
).Fetch (src .GetArtifact ().URL , src .GetArtifact ().Digest , tmpDir ); err != nil {
336
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ArtifactFailedReason , err .Error ())
336
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ArtifactFailedReason , err .Error ())
337
337
return err
338
338
}
339
339
340
340
// check build path exists
341
341
dirPath , err := securejoin .SecureJoin (tmpDir , obj .Spec .Path )
342
342
if err != nil {
343
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ArtifactFailedReason , err .Error ())
343
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ArtifactFailedReason , err .Error ())
344
344
return err
345
345
}
346
346
347
347
if _ , err := os .Stat (dirPath ); err != nil {
348
348
err = fmt .Errorf ("kustomization path not found: %w" , err )
349
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ArtifactFailedReason , err .Error ())
349
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ArtifactFailedReason , err .Error ())
350
350
return err
351
351
}
352
352
@@ -373,33 +373,33 @@ func (r *KustomizationReconciler) reconcile(
373
373
// Create the Kubernetes client that runs under impersonation.
374
374
kubeClient , statusPoller , err := impersonation .GetClient (ctx )
375
375
if err != nil {
376
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ReconciliationFailedReason , err .Error ())
376
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ReconciliationFailedReason , err .Error ())
377
377
return fmt .Errorf ("failed to build kube client: %w" , err )
378
378
}
379
379
380
380
// Generate kustomization.yaml if needed.
381
381
k , err := runtime .DefaultUnstructuredConverter .ToUnstructured (obj )
382
382
if err != nil {
383
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .BuildFailedReason , err .Error ())
383
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .BuildFailedReason , err .Error ())
384
384
return err
385
385
}
386
386
err = r .generate (unstructured.Unstructured {Object : k }, tmpDir , dirPath )
387
387
if err != nil {
388
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .BuildFailedReason , err .Error ())
388
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .BuildFailedReason , err .Error ())
389
389
return err
390
390
}
391
391
392
392
// Build the Kustomize overlay and decrypt secrets if needed.
393
393
resources , err := r .build (ctx , obj , unstructured.Unstructured {Object : k }, tmpDir , dirPath )
394
394
if err != nil {
395
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .BuildFailedReason , err .Error ())
395
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .BuildFailedReason , err .Error ())
396
396
return err
397
397
}
398
398
399
399
// Convert the build result into Kubernetes unstructured objects.
400
400
objects , err := ssautil .ReadObjects (bytes .NewReader (resources ))
401
401
if err != nil {
402
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .BuildFailedReason , err .Error ())
402
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .BuildFailedReason , err .Error ())
403
403
return err
404
404
}
405
405
@@ -421,15 +421,15 @@ func (r *KustomizationReconciler) reconcile(
421
421
// Validate and apply resources in stages.
422
422
drifted , changeSet , err := r .apply (ctx , resourceManager , obj , revision , objects )
423
423
if err != nil {
424
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ReconciliationFailedReason , err .Error ())
424
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ReconciliationFailedReason , err .Error ())
425
425
return err
426
426
}
427
427
428
428
// Create an inventory from the reconciled resources.
429
429
newInventory := inventory .New ()
430
430
err = inventory .AddChangeSet (newInventory , changeSet )
431
431
if err != nil {
432
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ReconciliationFailedReason , err .Error ())
432
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ReconciliationFailedReason , err .Error ())
433
433
return err
434
434
}
435
435
@@ -439,13 +439,13 @@ func (r *KustomizationReconciler) reconcile(
439
439
// Detect stale resources which are subject to garbage collection.
440
440
staleObjects , err := inventory .Diff (oldInventory , newInventory )
441
441
if err != nil {
442
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .ReconciliationFailedReason , err .Error ())
442
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .ReconciliationFailedReason , err .Error ())
443
443
return err
444
444
}
445
445
446
446
// Run garbage collection for stale resources that do not have pruning disabled.
447
447
if _ , err := r .prune (ctx , resourceManager , obj , revision , staleObjects ); err != nil {
448
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .PruneFailedReason , err .Error ())
448
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .PruneFailedReason , err .Error ())
449
449
return err
450
450
}
451
451
@@ -459,7 +459,7 @@ func (r *KustomizationReconciler) reconcile(
459
459
isNewRevision ,
460
460
drifted ,
461
461
changeSet .ToObjMetadataSet ()); err != nil {
462
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .HealthCheckFailedReason , err .Error ())
462
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .HealthCheckFailedReason , err .Error ())
463
463
return err
464
464
}
465
465
@@ -469,7 +469,7 @@ func (r *KustomizationReconciler) reconcile(
469
469
// Mark the object as ready.
470
470
conditions .MarkTrue (obj ,
471
471
meta .ReadyCondition ,
472
- kustomizev1 .ReconciliationSucceededReason ,
472
+ meta .ReconciliationSucceededReason ,
473
473
fmt .Sprintf ("Applied revision: %s" , revision ))
474
474
475
475
return nil
@@ -856,7 +856,7 @@ func (r *KustomizationReconciler) checkHealth(ctx context.Context,
856
856
drifted bool ,
857
857
objects object.ObjMetadataSet ) error {
858
858
if len (obj .Spec .HealthChecks ) == 0 && ! obj .Spec .Wait {
859
- conditions .Delete (obj , kustomizev1 .HealthyCondition )
859
+ conditions .Delete (obj , meta .HealthyCondition )
860
860
return nil
861
861
}
862
862
@@ -870,7 +870,7 @@ func (r *KustomizationReconciler) checkHealth(ctx context.Context,
870
870
}
871
871
872
872
if len (objects ) == 0 {
873
- conditions .Delete (obj , kustomizev1 .HealthyCondition )
873
+ conditions .Delete (obj , meta .HealthyCondition )
874
874
return nil
875
875
}
876
876
@@ -886,12 +886,12 @@ func (r *KustomizationReconciler) checkHealth(ctx context.Context,
886
886
}
887
887
888
888
// Find the previous health check result.
889
- wasHealthy := apimeta .IsStatusConditionTrue (obj .Status .Conditions , kustomizev1 .HealthyCondition )
889
+ wasHealthy := apimeta .IsStatusConditionTrue (obj .Status .Conditions , meta .HealthyCondition )
890
890
891
891
// Update status with the reconciliation progress.
892
892
message := fmt .Sprintf ("Running health checks for revision %s with a timeout of %s" , revision , obj .GetTimeout ().String ())
893
893
conditions .MarkReconciling (obj , meta .ProgressingReason , message )
894
- conditions .MarkUnknown (obj , kustomizev1 .HealthyCondition , meta .ProgressingReason , message )
894
+ conditions .MarkUnknown (obj , meta .HealthyCondition , meta .ProgressingReason , message )
895
895
if err := r .patch (ctx , obj , patcher ); err != nil {
896
896
return fmt .Errorf ("unable to update the healthy status to progressing: %w" , err )
897
897
}
@@ -902,8 +902,8 @@ func (r *KustomizationReconciler) checkHealth(ctx context.Context,
902
902
Timeout : obj .GetTimeout (),
903
903
FailFast : r .FailFast ,
904
904
}); err != nil {
905
- conditions .MarkFalse (obj , meta .ReadyCondition , kustomizev1 .HealthCheckFailedReason , err .Error ())
906
- conditions .MarkFalse (obj , kustomizev1 .HealthyCondition , kustomizev1 .HealthCheckFailedReason , err .Error ())
905
+ conditions .MarkFalse (obj , meta .ReadyCondition , meta .HealthCheckFailedReason , err .Error ())
906
+ conditions .MarkFalse (obj , meta .HealthyCondition , meta .HealthCheckFailedReason , err .Error ())
907
907
return fmt .Errorf ("health check failed after %s: %w" , time .Since (checkStart ).String (), err )
908
908
}
909
909
@@ -913,7 +913,7 @@ func (r *KustomizationReconciler) checkHealth(ctx context.Context,
913
913
r .event (obj , revision , eventv1 .EventSeverityInfo , msg , nil )
914
914
}
915
915
916
- conditions .MarkTrue (obj , kustomizev1 .HealthyCondition , meta .SucceededReason , msg )
916
+ conditions .MarkTrue (obj , meta .HealthyCondition , meta .SucceededReason , msg )
917
917
if err := r .patch (ctx , obj , patcher ); err != nil {
918
918
return fmt .Errorf ("unable to update the healthy status to progressing: %w" , err )
919
919
}
@@ -1077,7 +1077,7 @@ func (r *KustomizationReconciler) patch(ctx context.Context,
1077
1077
// Configure the runtime patcher.
1078
1078
patchOpts := []patch.Option {}
1079
1079
ownedConditions := []string {
1080
- kustomizev1 .HealthyCondition ,
1080
+ meta .HealthyCondition ,
1081
1081
meta .ReadyCondition ,
1082
1082
meta .ReconcilingCondition ,
1083
1083
meta .StalledCondition ,
0 commit comments