helm-controller icon indicating copy to clipboard operation
helm-controller copied to clipboard

ValuesFrom optional field not working for a particular key

Open tanujd11 opened this issue 3 years ago • 4 comments

While using ValuesFrom from configmap and keeping optional: true as config, it is showing the following error:

missing key '' in ConfigMap ''

Is this expected behaviour, I am using same configmap for multiple keys. I think the optional field is working only when the configmap is not present altogether. Instead if configmap is present and the key is also not present, the optional field should be respected.

I am talking about the following piece of code

https://github.com/fluxcd/helm-controller/blob/6f0b7cdc76923e79f9472dc49c13842ef3c2c109/controllers/helmrelease_controller.go#L544-L548

Why is the optional not handled in this case?

tanujd11 avatar Jan 03 '23 13:01 tanujd11

@hiddeco @stefanprodan can you help out here? I would be happy to raise the PR, if this is how it should be. Thanks

tanujd11 avatar Jan 03 '23 13:01 tanujd11

#589

tanujd11 avatar Jan 10 '23 06:01 tanujd11

This is by design, as described in the commit which introduced this (and in the documentation of the field itself): https://github.com/fluxcd/helm-controller/commit/1a88b409360b79c198e8109632582ac7a9c46ce6. In my opinion, this results in a better feedback loop in case a field is accidentally deleted which could otherwise go unnoticed.

hiddeco avatar Jan 17 '23 13:01 hiddeco

Hey @hiddeco my usecase is that, I would want to render this in GitOps rep but if this field is not present it will take the default value, but this error fails it.

tanujd11 avatar Jan 19 '23 13:01 tanujd11