Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Rashmi Gottipati <chowdary.grashmi@gmail.com>
  • Loading branch information
rashmigottipati committed Jun 26, 2024
1 parent 86634d8 commit af4db2b
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions internal/controllers/clusterextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import (
"github.com/operator-framework/operator-registry/alpha/declcfg"
"github.com/operator-framework/operator-registry/alpha/property"
rukpakv1alpha2 "github.com/operator-framework/rukpak/api/v1alpha2"
"github.com/operator-framework/rukpak/pkg/features"
registryv1handler "github.com/operator-framework/rukpak/pkg/handler"
rukpaksource "github.com/operator-framework/rukpak/pkg/source"
"github.com/operator-framework/rukpak/pkg/storage"
Expand Down Expand Up @@ -334,13 +333,13 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
case stateNeedsInstall:
err := preflight.Install(ctx, desiredRel)
if err != nil {
setInstalledAndHealthyFalse(ext, rukpakv1alpha2.ReasonInstallFailed, err.Error())
setInstalledStatusConditionFailed(ext, fmt.Sprintf("%s:%v", ocv1alpha1.ReasonInstallationFailed, err))
return ctrl.Result{}, err
}
case stateNeedsUpgrade:
err := preflight.Upgrade(ctx, desiredRel)
if err != nil {
setInstalledAndHealthyFalse(ext, rukpakv1alpha2.ReasonInstallFailed, err.Error())
setInstalledStatusConditionFailed(ext, fmt.Sprintf("%s:%v", ocv1alpha1.ReasonInstallationFailed, err))
return ctrl.Result{}, err
}
}
Expand Down Expand Up @@ -782,23 +781,3 @@ func (r *ClusterExtensionReconciler) validateBundle(bundle *catalogmetadata.Bund

return nil
}

// setInstalledAndHealthyFalse sets the Installed and if the feature gate is enabled, the Healthy conditions to False,
// and allows to set the Installed condition reason and message.
func setInstalledAndHealthyFalse(ext *ocv1alpha1.ClusterExtension, installedConditionReason, installedConditionMessage string) {
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
Type: rukpakv1alpha2.TypeInstalled,
Status: metav1.ConditionFalse,
Reason: installedConditionReason,
Message: installedConditionMessage,
})

if features.RukpakFeatureGate.Enabled(features.BundleDeploymentHealth) {
apimeta.SetStatusCondition(&ext.Status.Conditions, metav1.Condition{
Type: rukpakv1alpha2.TypeHealthy,
Status: metav1.ConditionFalse,
Reason: rukpakv1alpha2.ReasonInstallationStatusFalse,
Message: "Installed condition is false",
})
}
}

0 comments on commit af4db2b

Please sign in to comment.