Open shaunmitchellve opened 2 years ago
@rquitales Is this something you can take a look at ?
/cc @mortent
Hi @shaunmitchellve
It looks like you have an error in the yaml example you provided. The key and values of the annotation map must be a string.
In the example you provided, the value of the annotation cnrm.cloud.google.com/deletion-policy: true
is parsed as a boolean instead of a string. This causes a silent error when we extract annotations from the unstructured object from upstream apimachinery's util functions, and no annotations are returned (ie. an empty map) here:
https://github.com/GoogleContainerTools/kpt/blob/10868bd100b3547e665f608bdb43d51543ad3c2e/pkg/live/rgpath.go#L135
The custom resource will be ignored on apply, as expected, if you update the annotation to:
cnrm.cloud.google.com/deletion-policy: "true"
Thanks @rquitales. I added the quotes and local-config is now working as expected.
I wonder if not having it be a silent error but perhaps a warning might have helped me troubleshoot this.
Thanks again, going to close the issue.
Should we reopen this? I think it's common to forget the quotes and the error behavior is non-intuitive.
Expected behavior
When adding the annotation config.kubernetes.io/local-config: "true" to the resource definition. Kpt would not check to see if the CRD is defined on the server.
Actual behavior
The above resource uses a kpt function (gcr.io/kpt-fn/enable-gcp-services:v0.1.0) to create other resources (service.serviceusage.cnrm.cloud.google.com) that work perfectly fine.
I need to either delete the yaml file or change the extension of that file after
kpt fn render
to get past this error.Information
Tried on kpt version: 1.0.0-beta.9 (Google Cloud Shell version) Also on: 1.0.0-beta.10, 1.0.0-beta.12