syntasso / kratix

Kratix is an open-source framework for building platforms

Home Page:https://kratix.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: when the Promise is invalid, installing it via Promise release gives you no feedback

kirederik opened this issue · comments

Steps to reproduce

  1. Create an invalid promise
  2. Add the following label to it: kratix.io/promise-version: v1.0.0+beta.1
  3. Try to install this promise
  4. See that it fails
  5. Create a Promise Release pointing to this invalid promise
apiVersion: platform.kratix.io/v1alpha1
kind: PromiseRelease
metadata:
  name: promise
spec:
  version: v1.0.0+beta.1
  sourceRef:
    type: http
    url: <url>
  1. Apply the Promise release

Expected

Some feedback

Actual

None

By feedback, I'm assuming it to be the PromiseRelease's status and maybe an event recorded for it. I wish to give it a try.

/assign

Any idea why we're skipping the error from CreateOrUpdate here?

op, err := controllerutil.CreateOrUpdate(o.ctx, o.client, &existingPromise, func() error {
// If promise already exists the existingPromise object has all the fields set.
// Otherwise, it's an empty struct. Either way, we want to override the spec.
existingPromise.Spec = promise.Spec
// Copy labels and annotations from the PromiseRelease's Promise over to the
// existing Promise, prioritising the PromiseRelease Promise's labels and
// annotations.
existingPromise.SetLabels(labels.Merge(existingPromise.Labels, promise.Labels))
existingPromise.Labels[promiseReleaseNameLabel] = promiseRelease.GetName()
annotations.AddAnnotations(&existingPromise.ObjectMeta, promise.Annotations)
return ctrl.SetControllerReference(promiseRelease, &existingPromise, r.Scheme)
})
if err != nil {
return nil
}

@Bhargav-InfraCloud i'm not sure there's a specific reason behind skipping this error 🤔 my guess is that this is why the error is not bubbling up?

@kirederik Submitted PR #101 for this. Please review.

Hey @Bhargav-InfraCloud

I'll take a look! We are in the process of putting a CLA together so getting it merged can get delayed for a few days but I'll check the code later today