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

Fix custom resource handler in-memory version #70087

Merged
merged 6 commits into from
Oct 25, 2018

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Oct 22, 2018

What type of PR is this?
/kind bug

What this PR does / why we need it:
Allows custom resource handlers to indicate what group-version they wish to deal with internally.

Traditionally, API resource handlers have dealt with "internal" versions, converting data read from etcd and from incoming requests into a "hub" version.

Custom resources have no "internal" version. This causes problems when handler code is asked to perform conversions to that version (done during update, patch, etc).

This PR:

  • Includes the desired GVK in the unstructured objects created for decoding into in the custom resource handler
  • Avoids decoding arbitrary content into unstructured objects that have expressed an opinion about their GVK in ways that short circuit conversion paths
  • Allows handlers to specify the hub version that etcd and request versions will be converted to, rather than assuming __internal
  • Adds tests to make sure the stored version is converted to the handler version before being validated
  • Adds tests to make sure scale subresources work on a non-storage API version

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 #68197
Fixes #68035

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Fixed patch/update operations on multi-version custom resources

@liggitt
Copy link
Member Author

liggitt commented Oct 22, 2018

/cc @sttts @mbohlool @deads2k

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 22, 2018
@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 22, 2018
@liggitt liggitt force-pushed the fix-crd-internal-types branch 2 times, most recently from dd3f050 to 77a0071 Compare October 22, 2018 20:17
@k8s-ci-robot k8s-ci-robot added 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. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 22, 2018
@mbohlool
Copy link
Contributor

/test pull-kubernetes-integration

@liggitt liggitt changed the title WIP - Fix custom resource handler in-memory version Fix custom resource handler in-memory version Oct 22, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2018
@liggitt
Copy link
Member Author

liggitt commented Oct 22, 2018

Tests are green, ready for review

@liggitt liggitt force-pushed the fix-crd-internal-types branch 2 times, most recently from c7c41fa to f24fa25 Compare October 23, 2018 13:02
@liggitt
Copy link
Member Author

liggitt commented Oct 23, 2018

comments addressed

@liggitt
Copy link
Member Author

liggitt commented Oct 23, 2018

/retest

1 similar comment
@liggitt
Copy link
Member Author

liggitt commented Oct 23, 2018

/retest

@liggitt
Copy link
Member Author

liggitt commented Oct 25, 2018

@sttts any remaining comments?

@sttts
Copy link
Contributor

sttts commented Oct 25, 2018

/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 Oct 25, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

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 area/custom-resources cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
5 participants