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

Refactor kubectl scale to patch scale subresource #81342

Merged
merged 2 commits into from
Aug 26, 2019

Conversation

knight42
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:
Currently kubectl scale would send a PUT request without ResourceVersion, which is introduced in #75210, and because of that custom resource cannot be scaled since custom resource could not be updated unconditionally.

Considered that PUT without resource version is not a best practice and we are not willing to do a GET before the request, so I choose to update kubectl to use PATCH instead of PUT.

Which issue(s) this PR fixes:
Part of #80515

Special notes for your reviewer:
Although I have created another PR to fix the problem, which requires changes on apiserver, the apiserver would not be updated as frequently as kubectl in reality, so it may be best to update both apiserver(make old kubectls work) and kubectl.

Does this PR introduce a user-facing change?:

kubectl could scale custom resource again

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 13, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @knight42. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 13, 2019
@knight42
Copy link
Member Author

/assign @seans3

cc @liggitt

@seans3
Copy link
Contributor

seans3 commented Aug 14, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 14, 2019
@k8s-ci-robot k8s-ci-robot added area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Aug 15, 2019
@knight42
Copy link
Member Author

/assign @smarterclayton

@knight42
Copy link
Member Author

@seans3 @smarterclayton all tests passed now, PTAL

@xmudrii
Copy link
Member

xmudrii commented Aug 20, 2019

@seans3 @liggitt Ping. Can anyone help with reviewing this PR?

@dims
Copy link
Member

dims commented Aug 20, 2019

/uncc

@k8s-ci-robot k8s-ci-robot removed the request for review from dims August 20, 2019 22:16
@seans3
Copy link
Contributor

seans3 commented Aug 21, 2019

/cc @apelisse

for more context

@knight42 knight42 force-pushed the fix/kubectl-patch-scale branch 2 times, most recently from 5147a8b to 66d8056 Compare August 22, 2019 10:25
@knight42
Copy link
Member Author

/retest

Copy link
Member

@apelisse apelisse left a comment

Choose a reason for hiding this comment

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

Few style nits, but otherwise looks good. Feel free to fix or not
/lgtm
/approve
/hold

staging/src/k8s.io/kubectl/pkg/scale/scale.go Outdated Show resolved Hide resolved
staging/src/k8s.io/kubectl/pkg/scale/scale.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 22, 2019
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 22, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 23, 2019
@knight42
Copy link
Member Author

@apelisse all fixed now

@apelisse
Copy link
Member

Thanks, I think it looks much better this way,
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 23, 2019
@smarterclayton
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apelisse, knight42, smarterclayton

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2019
@knight42
Copy link
Member Author

@apelisse @smarterclayton would you mind unholding this PR?

@apelisse
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 26, 2019
@k8s-ci-robot k8s-ci-robot merged commit f81ab5a into kubernetes:master Aug 26, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 26, 2019
@knight42 knight42 deleted the fix/kubectl-patch-scale branch September 3, 2019 15:33
wking pushed a commit to wking/kubernetes that referenced this pull request Jul 21, 2020
…cale

Refactor `kubectl scale` to patch scale subresource

Kubernetes-commit: f81ab5a
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/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/kubectl area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants