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

Backward compatibility in EmptyDirVolumeSource after v1.7.8 #56505

Conversation

yue9944882
Copy link
Member

@yue9944882 yue9944882 commented Nov 28, 2017

In lower versions of k8s client sdk (golang, java..), requests can be incompatible with apiserver after v1.7.8 because of this commit. The field SizeLimit inEmptyDirVolumeSource struct is no longer a value but a pointer of resource.Quantity. And the default value of SizeLimit is {"Medium":"", "SizeLimit":"0"} but now a nil.

So this PR make apiserver able to process client request made by lower versions of k8s client sdk without simply throw out an error:

Forbidden: pod updates may not change fields other than spec.containers[ ].image, spec.initContainers[].image, spec.activeDeadlineSeconds or spec.tolerations (only additions to existing tolerations)

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #56381

Special notes for your reviewer:

Release note:

Provides compatibility of fields SizeLimit in types.EmptyDirVolumeSource since v1.7.8

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 28, 2017
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please email the CNCF helpdesk: [email protected]

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 28, 2017
@yue9944882
Copy link
Member Author

/assign @jbeda

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 28, 2017
@dims
Copy link
Member

dims commented Nov 29, 2017

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 29, 2017
@liggitt liggitt self-assigned this Dec 1, 2017
@yue9944882
Copy link
Member Author

hello? Anyone following up with this PR?
Thx

if mungedPod.Spec.Volumes[idx].EmptyDir.SizeLimit != nil {
// If EmptyDir.SizeLimit is set to "0", then take SizeLimit as a nil value
if mungedPod.Spec.Volumes[idx].EmptyDir.SizeLimit.String() == "0" && vol.EmptyDir.SizeLimit == nil {
mungedPod.Spec.Volumes[idx].EmptyDir.SizeLimit = nil
Copy link
Member

@liggitt liggitt Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field should already be dropped by this line prior to validation:

podSpec.Volumes[i].EmptyDir.SizeLimit = nil

Copy link
Member Author

@yue9944882 yue9944882 Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this DropDisabledAlphaFields function is written after 1.8.0 release.
But [v1.7.8~v1.8.0) didn't have this before validation, can I submit this PR onto release-1.7 branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to add the DropDisabledAlphaFields part to the 1.7.x branch than this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will update this PR dat way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Could you review my PR again plz? Thx

@yue9944882 yue9944882 changed the base branch from master to release-1.7 December 1, 2017 04:49
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 1, 2017
@k8s-github-robot k8s-github-robot added do-not-merge/cherry-pick-not-approved Indicates that a PR is not yet approved to merge into a release branch. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 1, 2017
@yue9944882 yue9944882 changed the base branch from release-1.7 to master December 1, 2017 04:49
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 1, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2017
@k8s-ci-robot

This comment has been minimized.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 1, 2017
@yue9944882
Copy link
Member Author

/area apiserver

@yue9944882 yue9944882 force-pushed the judge_sizelimit_backward_compatibility branch from a384ae0 to 7efae04 Compare December 2, 2017 15:15
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 2, 2017
@yue9944882
Copy link
Member Author

@liggitt PTAL.Thx.

@liggitt
Copy link
Member

liggitt commented Dec 4, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2017
@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 4, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, yue9944882

Associated issue: 56381

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@yue9944882
Copy link
Member Author

yue9944882 commented Dec 4, 2017

@liggitt @jbeda @yujuhong @jingxu97 Do you think about cherry-picking it?

@liggitt
Copy link
Member

liggitt commented Dec 5, 2017

That means it's pending approval by the 1.7 release branch manager.

@liggitt
Copy link
Member

liggitt commented Dec 5, 2017

^ @wojtek-t

@liggitt liggitt assigned liggitt and wojtek-t and unassigned jbeda, liggitt, yujuhong and jingxu97 Dec 5, 2017
@wojtek-t
Copy link
Member

wojtek-t commented Dec 5, 2017

The PR obviously makes perfect sense for cherrypicking.

@yue9944882 @liggitt - can one of you add user-friendly release note to it?

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Dec 5, 2017
@yue9944882
Copy link
Member Author

@wojtek-t PTAL. Release note updated.

@wojtek-t wojtek-t added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. and removed do-not-merge/cherry-pick-not-approved Indicates that a PR is not yet approved to merge into a release branch. labels Dec 5, 2017
@wojtek-t
Copy link
Member

wojtek-t commented Dec 5, 2017

Thanks - approved.

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue.

@k8s-github-robot k8s-github-robot merged commit 7b3a07d into kubernetes:release-1.7 Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants