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

ValuesFrom optional field not working for a particular key #587

Open
tanujd11 opened this issue Jan 3, 2023 · 4 comments
Open

ValuesFrom optional field not working for a particular key #587

tanujd11 opened this issue Jan 3, 2023 · 4 comments

Comments

@tanujd11
Copy link

tanujd11 commented Jan 3, 2023

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

if data, ok := resource.Data[v.GetValuesKey()]; !ok {
return nil, fmt.Errorf("missing key '%s' in %s '%s'", v.GetValuesKey(), v.Kind, namespacedName)
} else {
valuesData = []byte(data)
}

Why is the optional not handled in this case?

@tanujd11
Copy link
Author

tanujd11 commented Jan 3, 2023

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

@tanujd11
Copy link
Author

#589

@hiddeco
Copy link
Member

hiddeco commented Jan 17, 2023

This is by design, as described in the commit which introduced this (and in the documentation of the field itself): 1a88b40. In my opinion, this results in a better feedback loop in case a field is accidentally deleted which could otherwise go unnoticed.

@tanujd11
Copy link
Author

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.

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

No branches or pull requests

2 participants