diff --git a/api/v1alpha1/bundledeployment_types.go b/api/v1alpha1/bundledeployment_types.go index d5e918a5..b742f329 100644 --- a/api/v1alpha1/bundledeployment_types.go +++ b/api/v1alpha1/bundledeployment_types.go @@ -32,23 +32,24 @@ const ( TypeInstalled = "Installed" TypeAvailable = "Available" - ReasonBundleLoadFailed = "BundleLoadFailed" - ReasonCreateDynamicWatchFailed = "CreateDynamicWatchFailed" - ReasonErrorGettingClient = "ErrorGettingClient" - ReasonErrorGettingReleaseState = "ErrorGettingReleaseState" - ReasonHealthy = "Healthy" - ReasonInstallationStatusFalse = "InstallationStatusFalse" - ReasonInstallationStatusUnknown = "InstallationStatusUnknown" - ReasonInstallationSucceeded = "InstallationSucceeded" - ReasonInstallFailed = "InstallFailed" - ReasonObjectLookupFailure = "ObjectLookupFailure" - ReasonReadingContentFailed = "ReadingContentFailed" - ReasonReconcileFailed = "ReconcileFailed" - ReasonUnhealthy = "Unhealthy" - ReasonUpgradeFailed = "UpgradeFailed" - ReasonInvalidProbeSyntax = "InvalidAvailabilityProbeSyntax" - ReasonAvailabilityProbeFailed = "AvailabilityProbeFailed" - ReasonAvailabilityProbeSucceeded = "AvailabilityProbeSucceeded" + ReasonBundleLoadFailed = "BundleLoadFailed" + ReasonCreateDynamicWatchFailed = "CreateDynamicWatchFailed" + ReasonErrorGettingClient = "ErrorGettingClient" + ReasonErrorGettingReleaseState = "ErrorGettingReleaseState" + ReasonHealthy = "Healthy" + ReasonInstallationStatusFalse = "InstallationStatusFalse" + ReasonInstallationStatusUnknown = "InstallationStatusUnknown" + ReasonInstallationSucceeded = "InstallationSucceeded" + ReasonInstallFailed = "InstallFailed" + ReasonObjectLookupFailure = "ObjectLookupFailure" + ReasonReadingContentFailed = "ReadingContentFailed" + ReasonReconcileFailed = "ReconcileFailed" + ReasonUnhealthy = "Unhealthy" + ReasonUpgradeFailed = "UpgradeFailed" + ReasonInvalidProbeSyntax = "InvalidAvailabilityProbeSyntax" + ReasonAvailabilityProbeFailed = "AvailabilityProbeFailed" + ReasonAvailabilityProbeSucceeded = "Available" + ReasonAvailabilityNoProbesConfigured = "NoProbesConfigured" ) // BundleDeploymentSpec defines the desired state of BundleDeployment diff --git a/internal/controllers/bundledeployment/bundledeployment.go b/internal/controllers/bundledeployment/bundledeployment.go index 341c4eba..5b74e85e 100644 --- a/internal/controllers/bundledeployment/bundledeployment.go +++ b/internal/controllers/bundledeployment/bundledeployment.go @@ -390,8 +390,7 @@ func (c *controller) reconcile(ctx context.Context, bd *rukpakv1alpha1.BundleDep }) } - // todo: unknown condition if there are no probes? or just no condition? - if features.RukpakFeatureGate.Enabled(features.BundleDeploymentCustomAvailabilityProbes) && len(bd.Spec.AvailabilityProbes) > 0 { + if features.RukpakFeatureGate.Enabled(features.BundleDeploymentCustomAvailabilityProbes) { probe, err := probing.Parse(ctx, bd.Spec.AvailabilityProbes) if err != nil { meta.SetStatusCondition(&bd.Status.Conditions, metav1.Condition{ @@ -415,10 +414,15 @@ func (c *controller) reconcile(ctx context.Context, bd *rukpakv1alpha1.BundleDep return ctrl.Result{}, err } + successReason := rukpakv1alpha1.ReasonAvailabilityProbeSucceeded + if len(bd.Spec.AvailabilityProbes) == 0 { + successReason = rukpakv1alpha1.ReasonAvailabilityNoProbesConfigured + } + meta.SetStatusCondition(&bd.Status.Conditions, metav1.Condition{ Type: rukpakv1alpha1.TypeAvailable, Status: metav1.ConditionTrue, - Reason: rukpakv1alpha1.ReasonAvailabilityProbeSucceeded, + Reason: successReason, Message: "BundleDeployment is available", }) }