You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A FunctionConfig defined via an inline configMap should accept values like "true" and "123" as long as they are explicitly quoted to indicate they are of type string. This type of functionality was working with sigs.k8s.io/kustomize/kyaml v0.13.3, but something seems to have changed with the introduction of v0.13.6
Actual behavior
The ResourceList.FunctionConfig.As() method fails with an error like:
unable to convert object to *v1.ConfigMap with error: json: cannot unmarshal [number|bool] into Go struct field ConfigMap.data of type string
Information
Here's my example GO application compiled against github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20220517213353-b99a4025f2aa:
Run kpt as kpt fn render --truncate-output=false --output _output --image-pull-policy=ifnotpresent . using the example Kptfile above (replacing the image name as necesssary)
Observe the error message reported above
Edit the Kptfile removing the configMap entry and enabling configPath: which references a ConfigMap file with the same data values
Repeat the kpt fn render command from (2)
Observe that the json unmarshal error is not reported, and the Results include output like:
The problem is that kyaml cannot properly set the "data" field types when kpt fn render builds the inline ConfigMap functionConfig.
@droot We are pushing the strong typed KRM resource in the function SDK, so input values like ConfigMap should have data field as type map[string]string as the k8s/api defines, but kpt passed in the inline ConfigMap with data type "bool" and "int".
Agree with @tgjonestx that it might due to some behavior change between kyaml versions which kpt is also being affected See version diff between kpt beta-14 and beta-15 around kyaml
Expected behavior
A FunctionConfig defined via an inline configMap should accept values like
"true"
and"123"
as long as they are explicitly quoted to indicate they are of typestring
. This type of functionality was working withsigs.k8s.io/kustomize/kyaml v0.13.3
, but something seems to have changed with the introduction ofv0.13.6
Actual behavior
The
ResourceList.FunctionConfig.As()
method fails with an error like:Information
Here's my example GO application compiled against
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20220517213353-b99a4025f2aa
:Here's the Kptfile which produces the error:
Note that error does not occur, if you replace
configMap
withconfigPath
which references a ConfigMap like this:Steps to reproduce the behavior
kpt fn render --truncate-output=false --output _output --image-pull-policy=ifnotpresent .
using the example Kptfile above (replacing the image name as necesssary)configMap
entry and enablingconfigPath:
which references a ConfigMap file with the same data valueskpt fn render
command from (2)The text was updated successfully, but these errors were encountered: