Skip to content

Support scale subresource for PDBs#76294

Merged
k8s-ci-robot merged 3 commits intokubernetes:masterfrom
mortent:ScaleSubResourceForPDBs
May 24, 2019
Merged

Support scale subresource for PDBs#76294
k8s-ci-robot merged 3 commits intokubernetes:masterfrom
mortent:ScaleSubResourceForPDBs

Conversation

@mortent
Copy link
Copy Markdown
Member

@mortent mortent commented Apr 8, 2019

What type of PR is this?
/kind feature

What this PR does / why we need it:
PDBs currently only work with the workload controllers deployment, replicaset, statefulset and replicationcontroller. This change adds support for any controllers that implement the scale subresource.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

PDB support for custom resources with scale subresource

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. 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. labels Apr 8, 2019
@k8s-ci-robot k8s-ci-robot requested review from kow3ns and lukaszo April 8, 2019 21:44
@k8s-ci-robot k8s-ci-robot added area/test sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 8, 2019
@mortent mortent force-pushed the ScaleSubResourceForPDBs branch 3 times, most recently from 9092fb3 to f98f893 Compare April 9, 2019 20:31
@mortent
Copy link
Copy Markdown
Member Author

mortent commented Apr 10, 2019

/test pull-kubernetes-integration

@fedebongio
Copy link
Copy Markdown
Contributor

/remove-sig api-machinery
/sig scheduling

@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Apr 11, 2019
@liggitt
Copy link
Copy Markdown
Member

liggitt commented Apr 11, 2019

thanks for the PR... is there a proposal for this API change?

@mortent
Copy link
Copy Markdown
Member Author

mortent commented Apr 11, 2019

@liggitt I have discussed it with @kow3ns, but there is no KEP for this. I thought this was small enough to not require a KEP, but I'm happy to do one if needed.

@liggitt
Copy link
Copy Markdown
Member

liggitt commented Apr 12, 2019

Yes, a design would be good. It can be short if the semantics are simple and there are few issues.

@mortent mortent force-pushed the ScaleSubResourceForPDBs branch from f98f893 to cc916c8 Compare April 15, 2019 18:53
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Apr 15, 2019
@mortent mortent force-pushed the ScaleSubResourceForPDBs branch 4 times, most recently from ab0ae9a to 717e4a5 Compare April 16, 2019 17:50
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels May 16, 2019
@mortent mortent force-pushed the ScaleSubResourceForPDBs branch from 4f60537 to 3e82085 Compare May 16, 2019 17:34
@mortent
Copy link
Copy Markdown
Member Author

mortent commented May 20, 2019

@mikedanese @liggitt Can you take a look at this one? I would like to get this into 1.15 and I don't want to get too close to code freeze.

}
gr := mapping.Resource.GroupResource()

scale, err := dc.scaleNamespacer.Scales(namespace).Get(gr, controllerRef.Name)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this API is unfortunate... we're throwing away the version information we just got from our restmapper. if we know the full group/version/resource we want, we should be able to invoke it directly, and the scale client would be way simpler (it wouldn't need a restmapper internally). can you open a follow up issue to improve this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Created issue: #78231

Copy link
Copy Markdown
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

RBAC change looks fine, there's some additional checking that needs to be done on the controllerRef group

return nil, err
}
rs, err := dc.rsLister.ReplicaSets(namespace).Get(controllerRef.Name)
if err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pre-existing, but the same group check ("apps" or "extensions") should be done when resolving the deployment controllerref below. up to you whether you do that here or in a follow-up

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated the PR to include the group test on the deployment controller ref.

return false, nil
}

if controllerRef.Kind == expectedKind {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: move this first and short-circuit the parse and group search and return false, nil early if this doesn't match

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, this looks cleaner. I have updated the function.

groupMatch := false
for _, group := range expectedGroups {
if group == gv.Group {
groupMatch = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if the kind match has already been done, can simply return true, nil here

@liggitt
Copy link
Copy Markdown
Member

liggitt commented May 23, 2019

a couple nits in verifyGroupKind, and one other place a group check is needed

I'm not that familiar with the test coverage of PDBs... do we have positive and negative tests for each of the controllerref types modified here?

@mortent
Copy link
Copy Markdown
Member Author

mortent commented May 24, 2019

@liggitt I have added additional tests to cover the finder functions.

@liggitt
Copy link
Copy Markdown
Member

liggitt commented May 24, 2019

thanks, looks great

/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 May 24, 2019
@liggitt liggitt added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 24, 2019
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: janetkuo, kow3ns, liggitt, mortent

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

The pull request process is described here

Details 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 May 24, 2019
@k8s-ci-robot k8s-ci-robot merged commit f1883c9 into kubernetes:master May 24, 2019
superlime pushed a commit to superlime/kubernetes that referenced this pull request Jun 3, 2019
* Support scale subresource for PDBs

* Check group in finder functions

* Small fixes and more tests
@liggitt liggitt removed the sig/auth Categorizes an issue or PR as relevant to SIG Auth. label Feb 18, 2020
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/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. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants