Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions api/v1alpha1/conditions_const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -102,7 +110,7 @@ const (

const (
// ClusterStackReleasesSyncedCondition reports on whether the ClusterStackReleases are ready.
ClusterStackReleasesSyncedCondition = "ClusterStackReleasesSynced" //#nosec
ClusterStackReleasesSyncedCondition clusterv1.ConditionType = "ClusterStackReleasesSynced" //#nosec
)

const (
Expand Down
17 changes: 16 additions & 1 deletion internal/controller/clusteraddon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down