fleet icon indicating copy to clipboard operation
fleet copied to clipboard

[SURE-8482] Misleading error message when trying to deploy cluster resources with targetNamespace

Open kkaempf opened this issue 1 year ago • 1 comments

Issue description:

When deploying the sample code attached by the client (sample.zip), an error is thrown by Fleet :

Error while running post render on files: invalid cluster scoped object [name=kube-ops-view-2 kind=ClusterRole apiVersion=rbac.authorization.k8s.io/v1] found, consider using "defaultNamespace", not "namespace" in fleet.yaml

This is related to the following GitHub issue: https://github.com/rancher/fleet/issues/752.

When GitRepo.spec.targetNamespace is set, Fleet fails at creating cluster-scoped objects (as documented here: https://fleet.rancher.io/ref-crds#gitrepospec).

The error message is misleading and does not point to the actual problem when attempting to deploy cluster-wide resources and having targetNamespace present in the Git Repo.

Repro steps:

Use the sample code (sample.zip) to create a repo Apply the gitrepo.yaml file with the needed modifications The error will appear on the UI in the Git Repos section of Continuous Delivery (along with a "Err Applied" state, see "Error message repo.png" for example screenshot) Comment/remove GitRepo.spec.targetNamespace from the repo App will be deployed without errors

Workaround:

Is a workaround available and implemented? no

Actual behavior:

The error message speaks about using the defaultNamespace, which is not the problem in practice.

Expected behavior:

The error message in the UI should indicate that using targetNamespace is the cause of the deployment failure of a cluster-wide resource.

Files, logs, traces:

See attachments for sample code and a screenshot of the error message in the UI

kkaempf avatar Jun 04 '24 07:06 kkaempf

We should try to make the error message clearer.

As stated in https://github.com/rancher/fleet/issues/2065 the error should no longer be overwritten.

manno avatar Jun 05 '24 13:06 manno