diff --git a/api/v1alpha1/conditions_const.go b/api/v1alpha1/conditions_const.go index 82b599064..24ba77602 100644 --- a/api/v1alpha1/conditions_const.go +++ b/api/v1alpha1/conditions_const.go @@ -39,7 +39,7 @@ const ( const ( // HelmChartFoundCondition reports when mentioned helm chart is present in the cluster addon tar archive. - HelmChartFoundCondition = "HelmChartFound" + HelmChartFoundCondition clusterv1.ConditionType = "HelmChartFound" // HelmChartMissingReason is used when mentioned helm chart is missing in the cluster addon tar archive. HelmChartMissingReason = "HelmChartMissing" @@ -62,6 +62,14 @@ const ( TemplateNewClusterStackFailedReason = "TemplateNewClusterStackFailed" ) +const ( + // ClusterAddonConfigValidatedCondition reports when there is a error parsing clusteraddon.yaml. + ClusterAddonConfigValidatedCondition clusterv1.ConditionType = "ClusterAddonConfigValidated" + + // ParsingClusterAddonConfigFailedReason is used when there's some error happen while parsing clusteraddon.yaml. + ParsingClusterAddonConfigFailedReason = "ParsingClusterAddonConfigFailed" +) + const ( // HelmChartAppliedCondition reports on whether the relevant helm chart has been applied. HelmChartAppliedCondition clusterv1.ConditionType = "HelmChartApplied" @@ -91,7 +99,7 @@ const ( const ( // ProviderClusterStackReleasesSyncedCondition reports on whether the ProviderClusterStackReleases are ready. - ProviderClusterStackReleasesSyncedCondition = "ProviderClusterStackReleasesSynced" + ProviderClusterStackReleasesSyncedCondition clusterv1.ConditionType = "ProviderClusterStackReleasesSynced" // ProviderTemplateNotFoundReason is used when providerTemplate is not found. ProviderTemplateNotFoundReason = "ProviderTemplateNotFound" @@ -102,7 +110,7 @@ const ( const ( // ClusterStackReleasesSyncedCondition reports on whether the ClusterStackReleases are ready. - ClusterStackReleasesSyncedCondition = "ClusterStackReleasesSynced" //#nosec + ClusterStackReleasesSyncedCondition clusterv1.ConditionType = "ClusterStackReleasesSynced" //#nosec ) const ( diff --git a/internal/controller/clusteraddon_controller.go b/internal/controller/clusteraddon_controller.go index 307e231b1..23aaf7d41 100644 --- a/internal/controller/clusteraddon_controller.go +++ b/internal/controller/clusteraddon_controller.go @@ -298,8 +298,23 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re // multi-stage cluster addon flow in.addonStagesInput, err = r.getAddonStagesInput(in.restConfig, in.clusterAddonChartPath) if err != nil { - return reconcile.Result{}, fmt.Errorf("failed to get addon stages input: %w", err) + conditions.MarkFalse( + clusterAddon, + csov1alpha1.ClusterAddonConfigValidatedCondition, + csov1alpha1.ParsingClusterAddonConfigFailedReason, + clusterv1.ConditionSeverityError, + "cluster addon config (clusteraddon.yaml) is wrong: %s", err.Error(), + ) + + record.Warnf( + clusterAddon, + csov1alpha1.ParsingClusterAddonConfigFailedReason, + "cluster addon config (clusteraddon.yaml) is wrong: %s", err.Error(), + ) + + return reconcile.Result{}, nil } + conditions.MarkTrue(clusterAddon, csov1alpha1.ClusterAddonConfigValidatedCondition) // clusteraddon.yaml in the release. clusterAddonConfig, err := clusteraddon.ParseConfig(in.clusterAddonConfigPath)