Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SURE-9137] Add template errors to bundle and gitrepo status #3114

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

p-se
Copy link
Contributor

@p-se p-se commented Dec 3, 2024

When fleet.yaml is evaluated for targeting, errors can occur due to missing values, like for instance, if a cluster has a missing label that is used in the fleet.yaml file.

Those kind of errors would previously only be visible in logs. This PR introduces error messages in the bundle, more specifically in the Ready condition of the Bundle status, when errors occur on rendering the templates for targeting. Subsequently the error message is being copied from the Bundle to the GitRepo. It will not show up in Clusters or ClusterGroups.

It is new that Bundles will have their own errors. Errors are commonly created in BundleDeployments and are aggregated in the status of Bundle. Now, additionally, the bundle itself may have errors that result in a status change. Those errors will take precedence over any errors that may already exist and effectively overwrite the Ready status condition, should they occur.

Overwriting errors coming from BundleDeployments in Bundle will not happen if the Bundle never created a BundleDeployment that has an error, but will happen if BundleDeployments have successfully been created from the Bundle. If then a cluster is added that has a missing label or a cluster is edited so that a label value required for templating is removed, the error will be shown in the Bundle, not those errors that might be present in the BundleDeployment resources. The errors present in the BundleDeployment will not be changed at all, so that there is a possibility of retrieving both at the same time.

@kkaempf
Copy link
Collaborator

kkaempf commented Dec 9, 2024

Where are Bundle errors displayed in the UI ?

@p-se p-se marked this pull request as ready for review December 9, 2024 15:30
@p-se p-se requested a review from a team as a code owner December 9, 2024 15:30
@p-se
Copy link
Contributor Author

p-se commented Dec 9, 2024

Where are Bundle errors displayed in the UI ?

Good point, the Bundle is not something we like to advertise to users. We're treating it more like an internal resource in the Rancher UI. It would be in Continuous Delivery, Advanced, Bundles.

That said, the same error will be in the GitRepo.

image

if c.Type == string(fleet.Ready) && c.Status == v1.ConditionFalse {
condition = c
found = true
break bundles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this will only propagate the first bundle rendering error to the gitrepo status, if multiple such errors exist over multiple bundles.
Perhaps something to clarify in documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's true. That is something that we might want to change at some point, but I'd need to think more about it, since there's another possible optimization. In the meantime, I'm thinking of adding some documentation to our docs, too, since the errors we start showing in Bundle and GitRepo won't be found in Cluster or ClusterGroup.

e2e/assets/status/chart-with-template-vars/.helmignore Outdated Show resolved Hide resolved
e2e/single-cluster/status_test.go Outdated Show resolved Hide resolved
e2e/single-cluster/status_test.go Show resolved Hide resolved
})
})

// getGitRepoStatus retrieves the status of the gitrepo with the provided name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// getGitRepoStatus retrieves the status of the gitrepo with the provided name.
// getBundleStatus retrieves the status of the bundle with the provided name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were 2 suggested changes on this line ;)

@@ -107,3 +117,175 @@ var _ = Describe("Checks status updates happen for a simple deployment", Ordered
})
})
})

var _ = Describe("Checks that template errors are shown in bundles and gitrepos", Ordered, Label("infra-setup"), func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What prevents these tests from being integration tests instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure that there is something that would prevent that, I was just worried about the complexity of having to work with several controllers in integration tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already support multiple reconcilers in integration tests ;)

@p-se p-se force-pushed the SURE-9137 branch 3 times, most recently from 2edaa8e to 064833e Compare December 10, 2024 15:17
@p-se p-se changed the title Add template errors to bundle and gitrepo status [SURE-9137] Add template errors to bundle and gitrepo status Dec 11, 2024
@kkaempf kkaempf added this to the v2.10.2 milestone Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

3 participants