timflannagan / rukpak

Rukpak runs in a Kubernetes cluster and defines an API for installing cloud native bundle content
Apache License 2.0
0 stars 0 forks source link

clean up this condition block #53

Open github-actions[bot] opened 2 years ago

github-actions[bot] commented 2 years ago

https://github.com/timflannagan/rukpak/blob/c4bb0db08a01a70f1c25b25f913e7907da67a05a/internal/provisioner/plain/controllers/bundleinstance_controller.go#L99


    defer func() {
        bi := bi.DeepCopy()
        bi.ObjectMeta.ManagedFields = nil
        if err := r.Status().Patch(ctx, bi, client.Apply, client.FieldOwner(provisioner.PlainID)); err != nil {
            l.Error(err, "failed to patch status")
        }
    }()

    bundle, oldBundles, err := r.reconcileDesiredBundle(ctx, bi)
    if err != nil {
        // TODO: clean up this condition block
        meta.SetStatusCondition(&bi.Status.Conditions, metav1.Condition{
            Type:    rukpakv1alpha1.TypeHasValidBundle,
            Status:  metav1.ConditionFalse,
            Reason:  "InvalidDesiredBundle",
            Message: err.Error(),
        })
        return ctrl.Result{}, err
    }

    desiredObjects, err := r.loadBundle(ctx, bundle, bi.GetName())
    if err != nil {
        var bnuErr *errBundleNotUnpacked
        if errors.As(err, &bnuErr) {
            reason := fmt.Sprintf("BundleUnpack%s", bundle.Status.Phase)
            if bundle.Status.Phase == rukpakv1alpha1.PhaseUnpacking {
                reason = "BundleUnpackRunning"
            }
            meta.SetStatusCondition(&bi.Status.Conditions, metav1.Condition{
github-actions[bot] commented 2 years ago

This issue has become stale because it has been open 60 days with no activity. The maintainers of this repo will remove this label during issue triage or it will be removed automatically after an update. Adding the lifecycle/frozen label will cause this issue to ignore lifecycle events.