Skip to content

Conversation

@julianvmodesto
Copy link
Contributor

What type of PR is this?
/kind bug
/wg apply

What this PR does / why we need it:
Track the owner for .spec.replicas for the Deployment scale subresource.

Not sure if this will actually work, or if we'll have to fix scale somehow.

Which issue(s) this PR fixes:

Fixes #82046

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. wg/apply size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 30, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @julianvmodesto. 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.

Details

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Sep 30, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: julianvmodesto
To complete the pull request process, please assign wojtek-t
You can assign the PR to them by writing /assign @wojtek-t in a comment when ready.

The full list of commands accepted by this bot can be found 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

@jennybuckley
Copy link

jennybuckley commented Sep 30, 2019

This is a good start, but I think it might be difficult to implement the necessary logic to update the managedfields for scale here, since the code for parsing it and encoding it is defined in k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/internal.

I had an idea for how to get around that, let me know if you think it makes sense. The idea is to create a "scale fieldmanager" (that only understands how to update the scale field's ownership of an object), in the k8s.io/apiserver/.../fieldmanager package, and add it to the scale request scope, so it gets passed into ScaleRest.Update by the scale subresource handler automatically as a transformer for the updatedObjectInfo.

To wire this from the subresource to the main resource, autoscaling.v1/Scale already has a metadata field which includes managedFields. We could use that to adjust the managedfields, by modifying scaleFromDeployment to populate that field, then the transformer to the updatedObjectInfo which we passed in earlier would update the ownership for us, and we just need to make sure we also copy back the value from the scale's managedFields into the deployment object.

The "scale fieldmanager" would operate on objects of type autoscaling.v1/Scale, but with managedFields representing field management on the underlying resource. Then, it just needs to know what fieldpath in the underlying resource corresponds to Scale.spec.replicas, in deployment's case it would be the same fieldpath, but I think CRD can define the path themselves, so we would have to construct the scale field manager with that path as an argument.

@jennybuckley
Copy link

Another option is to pass in a Deployment FieldManager into the sub-update as a transformer here

@julianvmodesto
Copy link
Contributor Author

@jennybuckley oh nice! Thank you, this makes sense! I'll give it a shot

@kwiesmueller
Copy link
Member

@jennybuckley would your suggestion mean, that we would have to have a fieldManager for every subresource?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server-side Apply: Ownership not tracked for scale subresource

4 participants