-
Notifications
You must be signed in to change notification settings - Fork 39.3k
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
Invalid value: "null" when field is removed from configuration and SSA is used to apply #103011
Comments
/wg api-expression |
@karunasagark: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/wg api-expression |
This is a known issue and has been fixed and backported by this commit: kubernetes-sigs/structured-merge-diff#184 (SMD), #99038 (k/k) The fix applies for server version >=1.19.10 and >=1.20.6. Looking at your server version, 1.19.7 doesn't yet include the fix, and upgrading should solve the problem. Going to close this for now, feel free to reopen if the problem persists in the later versions. |
@Jefftree: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
To close out, I couldn't repro the bug using the repro steps mentioned above on 1.20.7 |
What happened:
We are developing a new k8s controller and decided to use SSA completely. However, ran into an issue when I removed a field from the configuration. I have a custom resource with field called 'prop1' and it is not a required field (see snippet below). Using SSA, I created an object of this CR kind with 'prop1' specified and this was successful. I changed the configuration by removing 'prop1' and used the same code aka SSA to apply this configuration, but this time I received an error - Invalid value: "null": spec.prop1 in body must be of type object: "null".
What you expected to happen:
However, I was not expecting this error. I understand that 'prop1' is not nullable as per JSON schema, but then I didn't set it to null, I removed it from the configuration and ensured that field is not present in the request body. So, it seems that something in the API server sets it to null. And as per the documentation here, if I remove the field it is supposed to be deleted from the live object.
Can you please help me understand this behavior?
How to reproduce it (as minimally and precisely as possible):
Attached zip file containing testcrd.yaml, testcr1.yaml and testcr2.yaml
reproYaml.zip
Anything else we need to know?:
Environment:
Kubernetes version (use
kubectl version
):Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.4", GitCommit:"e87da0bd6e03ec3fea7933c4b5263d151aafd07c", GitTreeState:"clean", BuildDate:"2021-02-18T16:12:00Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"8ab00ff68a1763b5a506a7073cb8e67b12dfbcd7", GitTreeState:"clean", BuildDate:"2021-03-10T23:40:01Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider or hardware configuration:
Azure Kubernetes Service
OS (e.g:
cat /etc/os-release
):Ubuntu 18.04
Kernel (e.g.
uname -a
):Install tools:
Network plugin and version (if this is a network-related bug):
Others:
The text was updated successfully, but these errors were encountered: