Skip to content

Commit 18e9174

Browse files
committed
Better error reasons
1 parent ca7639b commit 18e9174

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

api/v1alpha2/conditions_consts.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ const (
4747
// ComponentsFetchErrorReason documents that an error occurred fetching the components.
4848
ComponentsFetchErrorReason = "ComponentsFetchError"
4949

50+
// ComponentsCustomizationErrorReason documents that an error occurred customizing the components.
51+
ComponentsCustomizationErrorReason = "ComponentsCustomizationError"
52+
53+
// ComponentsPatchErrorReason documents that an error occurred patching the components.
54+
ComponentsPatchErrorReason = "ComponentsPatchError"
55+
56+
// ComponentsImageOverrideErrorReason documents that an error occurred overriding the components image.
57+
ComponentsImageOverrideErrorReason = "ComponentsImageOverrideError"
58+
5059
// ComponentsUpgradeErrorReason documents that an error occurred while upgrading the components.
5160
ComponentsUpgradeErrorReason = "ComponentsUpgradeError"
5261

internal/controller/phases.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,17 +472,17 @@ func (p *phaseReconciler) fetch(ctx context.Context) (reconcile.Result, error) {
472472
// ProviderSpec provides fields for customizing the provider deployment options.
473473
// We can use clusterctl library to apply this customizations.
474474
if err := repository.AlterComponents(p.components, customizeObjectsFn(p.provider)); err != nil {
475-
return reconcile.Result{}, wrapPhaseError(err, operatorv1.ComponentsFetchErrorReason, operatorv1.ProviderInstalledCondition)
475+
return reconcile.Result{}, wrapPhaseError(err, operatorv1.ComponentsCustomizationErrorReason, operatorv1.ProviderInstalledCondition)
476476
}
477477

478478
// Apply patches to the provider components if specified.
479479
if err := repository.AlterComponents(p.components, applyPatches(ctx, p.provider)); err != nil {
480-
return reconcile.Result{}, wrapPhaseError(err, operatorv1.ComponentsFetchErrorReason, operatorv1.ProviderInstalledCondition)
480+
return reconcile.Result{}, wrapPhaseError(err, operatorv1.ComponentsPatchErrorReason, operatorv1.ProviderInstalledCondition)
481481
}
482482

483483
// Apply image overrides to the provider manifests.
484484
if err := repository.AlterComponents(p.components, imageOverrides(p.components.ManifestLabel(), p.overridesClient)); err != nil {
485-
return reconcile.Result{}, wrapPhaseError(err, operatorv1.ComponentsFetchErrorReason, operatorv1.ProviderInstalledCondition)
485+
return reconcile.Result{}, wrapPhaseError(err, operatorv1.ComponentsImageOverrideErrorReason, operatorv1.ProviderInstalledCondition)
486486
}
487487

488488
conditions.Set(p.provider, conditions.TrueCondition(operatorv1.ProviderInstalledCondition))

0 commit comments

Comments
 (0)