-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
SizeLimit violates k8s API convention #50121
Comments
@kyessenov
Note: Method 1 will trigger an email to the group. You can find the group list here and label list here. |
/assign @jingxu97 |
cc @andraxylia @ayj |
Please cherry-pick this into 1.7 since this might affect everyone who uses client-go 1.7 for this API. |
This PR fixes issue kubernetes#50121
This PR fixes issue kubernetes#50121
@kyessenov @liggitt - does this apply to ALL optional api fields or just non-strings? I'm not seeing many types holding this convention? I'm asking in regards to another PR I'm about to do so wanting some clarification. Thanks! cc @msau42 |
IMO we don't have to fix every violations unless they break a use case. We need to strictly enforce the convention during our API reviews to prevent more violations. |
it's about go's ability to honor the see https://play.golang.org/p/gEZoDu7LdG for the way go behaves with zero values |
Sounds like it could be possible to detect this statically: if the field is marked as optional and omitempty, it should not serialize to a JSON field. I can't tell if there are more violations like this one, I happened to discover this while using client-go 1.7 on 1.6 cluster. |
This PR fixes issue kubernetes#50121
This PR fixes issue kubernetes#50121
This PR fixes issue kubernetes#50121
This PR fixes issue kubernetes#50121
This PR fixes issue kubernetes#50121
Automatic merge from submit-queue (batch tested with PRs 51707, 51662, 51723, 50163, 51633) Change SizeLimit to a pointer This PR fixes issue kubernetes#50121 ```release-note The `emptyDir.sizeLimit` field is now correctly omitted from API requests and responses when unset. ```
This PR fixes issue kubernetes#50121
…3-upstream-release-1.7 Automatic merge from submit-queue Automated cherry pick of #50163 Cherry pick of #50163 on release-1.7. fixes #50121 #50163: Change SizeLimit to a pointer ```release-note The alpha `emptyDir.sizeLimit` field is now correctly omitted from API requests and responses when unset. ```
Fixed by #51763 |
FYI #44005 is a bug for a future API linting tool that would have caught this. |
Is this a BUG REPORT or FEATURE REQUEST?:
/kind bug
What happened:
kubernetes/community#306 added field
SizeLimit
in PR 85f030c. The field is marked as optional yet has the non-pointer typeresource.Quantity
. This is against the API convention that requires optional fields to be pointers.As a consequence, k8s client-go library does not omit this field in serialization, breaking k8s 1.6 compatibility for this API.
What you expected to happen:
client-go 1.7 works with k8s 1.6 in pass-through object processing pipeline.
How to reproduce it (as minimally and precisely as possible):
See kubernetes/client-go#257 (comment)
Anything else we need to know?:
Environment:
kubectl version
): 1.7uname -a
):cc @caesarxuchao
The text was updated successfully, but these errors were encountered: