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

kustomization.yaml with no resources fails #391

Closed
makkes opened this issue Jul 14, 2021 · 6 comments · Fixed by #426
Closed

kustomization.yaml with no resources fails #391

makkes opened this issue Jul 14, 2021 · 6 comments · Fixed by #426

Comments

@makkes
Copy link
Member

makkes commented Jul 14, 2021

Given this kustomization file in a directory pointed to by a Flux Kustomization:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources: []

The Kustomization fails with this error:

$ k -n flux-system get kustomization k
NAME   READY   STATUS   AGE
k      False   apply failed: error: no objects passed to apply
       39s

which makes sense because there are no resources to apply but I wonder whether a check should be added to kustomize-controller to see whether the set of resources is actually empty and immediately go into ready state. Happy to discuss.

@JaneLiuL
Copy link
Contributor

JaneLiuL commented Jul 26, 2021

Good issue~
I think we should change the message like:"apply finish: no objects passed to apply"
I would like to take this issue.

label //good first issue

@stefanprodan
Copy link
Member

stefanprodan commented Jul 26, 2021

I’m not for changing this behavior, if we really want to set an empty kustomization to ready then we need to wait a couple of months for GA, as this is a major break change in behavior.

@smurfralf
Copy link

smurfralf commented Sep 14, 2021

This is actually a bug. If I have a kustomization that has resources, then I remove them resulting in an empty kustomization, then instead of the controller reconcile deleting the resources, it gives the "apply failed: error: no objects passed to apply". If an object has been removed, it should be deleted by flux. So while this error behavior may make sense for a kustomization that is first set up (basically saying "hey! why did you set up an empty kustomization / folder?") it is not correct after a kustomization has created resources then had them removed.

@makkes
Copy link
Member Author

makkes commented Sep 15, 2021

I agree it's a bug, especially since kustomize itself doesn't fail with an empty resources list. However, I see @stefanprodan's point that it's a breaking change if all of a sudden an empty resources list doesn't result in a Ready: false condition, anymore because people out there might already rely on that behaviour.

@smurfralf
Copy link

I wouldn't object to the Ready:false status if the reconcile would first delete the resources that have been removed.

@takirala
Copy link

I am also affected by this. At the least, we can fix the "bug" such that the prune is correctly honored. Right now, when all the resources are truncated (resources: []) after having a non zero length, kustomize-controller fails to prune them correctly. We don't have to make a change of behavior on Ready: false, but we can fix the behavior to prune the resources correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants