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

[WIP] Set ownership of spec.replicas to scale subresource #83444

Closed
wants to merge 4 commits into from
Closed

[WIP] Set ownership of spec.replicas to scale subresource #83444

wants to merge 4 commits into from

Conversation

mariantalla
Copy link
Contributor

(with @hoegaarden )

What type of PR is this?
/kind bug

What this PR does / why we need it:
This PR implements field ownership on replicas.scale for the scale subresource, so that changes to that field would behave the same way (including conflicts where applicable) as a server-side apply of the main resource.

Which issue(s) this PR fixes:

xref: #82046

Special notes for your reviewer:

  • The path that we're exploring in this PR is adding a managedField entry for spec.replicas, on behalf of the scale subresource (i.e. the scale subresource appears as the manager of the field).
    • To begin with we've implemented it for replica sets; if we see that the approach works we'd have to extend that to other resources too... I'm cautious of duplication there.

Does this PR introduce a user-facing change?:

NONE

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


/cc @apelisse @jennybuckley @julianvmodesto @hoegaarden

... when RS is scaled via scale subresource
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Oct 3, 2019
@k8s-ci-robot
Copy link
Contributor

@mariantalla: GitHub didn't allow me to request PR reviews from the following users: julianvmodesto.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

(with @hoegaarden )

What type of PR is this?
/kind bug

What this PR does / why we need it:
This PR implements field ownership on replicas.scale for the scale subresource, so that changes to that field would behave the same way (including conflicts where applicable) as a server-side apply of the main resource.

Which issue(s) this PR fixes:

xref: #82046

Special notes for your reviewer:

  • The path that we're exploring in this PR is adding a managedField entry for spec.replicas, on behalf of the scale subresource (i.e. the scale subresource appears as the manager of the field).
  • To begin with we've implemented it for replica sets; if we see that the approach works we'd have to extend that to other resources too... I'm cautious of duplication there.

Does this PR introduce a user-facing change?:

NONE

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


/cc @apelisse @jennybuckley @julianvmodesto @hoegaarden

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 the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 3, 2019
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. 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. area/test 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 Oct 3, 2019
@mariantalla mariantalla added the kind/bug Categorizes issue or PR as related to a bug. label Oct 3, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-kind Indicates a PR lacks a `kind/foo` label and requires one. label Oct 3, 2019
@apelisse
Copy link
Member

apelisse commented Oct 3, 2019

@julianvmodesto
Copy link
Contributor

Not sure if you've seen @jennybuckley's idea yet here:
#83294 (comment)

Seems nice since we could keep the logic to update fieldmanager in the internal package and we could re-use it for ReplicaSets, Deployments etc. as well as CRDs.

@apelisse
Copy link
Member

apelisse commented Oct 3, 2019

Adding the entry in the ManagedFieldsEntry is not good enough to grab the ownership from other users. You also have to remove it from other users, which is definitely not trivial. The best way to do that is to call FieldManager.Update() with the old and new object (I think both are available in the ScaleREST). Jenny and Julian have discussed the wiring of the FieldManager in ScaleREST.

Will look into FieldManager next.

Signed-off-by: Maria Ntalla <mntalla@pivotal.io>
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 29, 2019
Signed-off-by: Maria Ntalla <mntalla@pivotal.io>
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 29, 2019
@k8s-ci-robot
Copy link
Contributor

@mariantalla: PR needs rebase.

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/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Oct 29, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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 do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Oct 29, 2019
@mariantalla
Copy link
Contributor Author

mariantalla commented Oct 30, 2019

Alright, the commit state is a bit (or, a lot!) messy at the moment, so here's where work for this PR is at for now:

  • In pkg/registry/apps/replicaset/storage/storage.go there's logic that ensures that there only ever is one field manager for spec.replicas. It does this by looping through all managed fields, removing any that mention spec.replicas and adding an entry that specifies that the current manager is the field manager.

    • That's not a very effective implementation, for a number of reasons, so I don't see us sticking with it eventually. For one, it would need to be duplicated for other main resources too. On top of that, it opens space for a number of bugs (for example the case where there's an entry for a manager of spec.replicas AND spec.somethingelse).
  • We've started working through @jennybuckley 's idea (from [WIP] Server-side Apply: Track ownership for scale subresource for Deployments #83294 (comment)). There's a bare-minimum implementation of a scaleFieldManager in staging/src/k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager/fieldmanager.go, and then logic (in staging/src/k8s.io/apiserver/pkg/endpoints/installer.go) to install scaleFieldManager as THE FieldManager in the case of scale subresources.

Next steps:

  • Ensure that the end-to-end flow is as expected, i.e. that scaleFieldManager does get called when requests to /scale happen.
  • Implement the Apply() and Update() logic for scaleFieldManager.

Yesterday at the working group meeting we said we'd speak with the rest of sig-api-machinery on whether a more reasonable approach would be to redirect subresource Apply/Updates to Apply/Updates of the main resource. Related context: #84530 .

Signed-off-by: Maria Ntalla <mntalla@pivotal.io>
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Oct 30, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 28, 2020
@apelisse
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 28, 2020
@k8s-ci-robot k8s-ci-robot added wg/api-expression Categorizes an issue or PR as relevant to WG API Expression. and removed wg/apply labels Apr 17, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 16, 2020
@apelisse
Copy link
Member

/remove-lifecycle stale

@apelisse apelisse closed this Jul 16, 2020
@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 16, 2020
@apelisse apelisse reopened this Jul 16, 2020
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jul 16, 2020

@mariantalla: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kubernetes-node-e2e-containerd e65ab39 link /test pull-kubernetes-node-e2e-containerd
pull-kubernetes-conformance-kind-ipv6 e65ab39 link /test pull-kubernetes-conformance-kind-ipv6
pull-kubernetes-e2e-gce-device-plugin-gpu e65ab39 link /test pull-kubernetes-e2e-gce-device-plugin-gpu
pull-kubernetes-kubemark-e2e-gce-big e65ab39 link /test pull-kubernetes-kubemark-e2e-gce-big
pull-kubernetes-files-remake e65ab39 link /test pull-kubernetes-files-remake
pull-kubernetes-e2e-gce-ubuntu-containerd e65ab39 link /test pull-kubernetes-e2e-gce-ubuntu-containerd
pull-kubernetes-e2e-gce e65ab39 link /test pull-kubernetes-e2e-gce
pull-kubernetes-e2e-kind e65ab39 link /test pull-kubernetes-e2e-kind
pull-kubernetes-node-e2e e65ab39 link /test pull-kubernetes-node-e2e
pull-kubernetes-bazel-build e65ab39 link /test pull-kubernetes-bazel-build
pull-kubernetes-dependencies e65ab39 link /test pull-kubernetes-dependencies
pull-kubernetes-conformance-kind-ipv6-parallel e65ab39 link /test pull-kubernetes-conformance-kind-ipv6-parallel
pull-kubernetes-e2e-gce-100-performance e65ab39 link /test pull-kubernetes-e2e-gce-100-performance
pull-kubernetes-bazel-test e65ab39 link /test pull-kubernetes-bazel-test
pull-kubernetes-verify e65ab39 link /test pull-kubernetes-verify
pull-kubernetes-typecheck e65ab39 link /test pull-kubernetes-typecheck

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 14, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 13, 2020
@apelisse
Copy link
Member

apelisse commented Dec 1, 2020

/close

@nodo is working on an alternative implementation of this.

@k8s-ci-robot
Copy link
Contributor

@apelisse: Closed this PR.

In response to this:

/close

@nodo is working on an alternative implementation of this.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiserver 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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. 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. wg/api-expression Categorizes an issue or PR as relevant to WG API Expression.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants