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

add information for subresource kind determination #49971

Merged
merged 2 commits into from
Sep 1, 2017

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Aug 1, 2017

xref #38810 #38756

Polymorphic subresources usually have different groupVersions for their discovery kinds than their "native" groupVersions. Even though the APIResourceList shows the kind properly, it does not reflect the group or version of that kind, which makes it impossible to unambiguously determine if the subresource matches you and it is impossible to determine how to serialize your data. See HPA controller.

This adds an optional Group and Version to the discovery doc, which can be used to communicate the "native" groupversion of an endpoint. Doing this does not preclude fancier contenttype negotiation in the future and doesn't prevent future expansion from indicating equivalent types, but it does make it possible to solve the problem we have today or polymorphic categorization.

@kubernetes/sig-api-machinery-misc @smarterclayton
@cheftako since @lavalamp is out.

Adds optional group and version information to the discovery interface, so that if an endpoint uses non-default values, the proper value of "kind" can be determined. Scale is a common example.

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 1, 2017
@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note-label-needed labels Aug 1, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Aug 1, 2017

This pull just shows the new fields without wiring or generation, so we can first sort out how to express it.

@DirectXMan12 you want this too I think.

@DirectXMan12
Copy link
Contributor

woot!

This will eventually unblock me on a generic scale client.

@smarterclayton
Copy link
Contributor

Seems very reasonable to me, do we need to qualify group / version with a prefix in order to distinguish them better?

// For subresources, this may have a different value, for example: Scale".
Group string `json:"group,omitempty" protobuf:"bytes,8,opt,name=group"`
// version is the preferred version of the resource. Empty implies the version of the containing resource list
// For subresources, this may have a different value, for example: Scale".
Copy link
Member

Choose a reason for hiding this comment

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

quibble but can we fix the example to be a version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

quibble but can we fix the example to be a version?

Yes. I'll update during my rebase and generation cleanup today.

@@ -750,6 +750,12 @@ type APIResource struct {
SingularName string `json:"singularName" protobuf:"bytes,6,opt,name=singularName"`
// namespaced indicates if a resource is namespaced or not.
Namespaced bool `json:"namespaced" protobuf:"varint,2,opt,name=namespaced"`
// group is the preferred group of the resource. Empty implies the group of the containing resource list.
Copy link
Member

Choose a reason for hiding this comment

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

Don't we expect there times when there are multiple versions of the APIResource? If we want to switch groups then there could even be multiple groups? Would preferred be the most stable? I assume that the preferred group must match the preferred version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume that the preferred group must match the preferred version?

I think this group and version should always match and be the preferred one (the one that most people will use. Our internal code already handles this case today.

Don't we expect there times when there are multiple versions of the APIResource?

Eventually, yes. Right now our code doesn't handle the condition and explicitly forbids it. I think that we should reflect what we have now (and realistically for the next few releases).

If we want to switch groups then there could even be multiple groups? Would preferred be the most stable?

I think we would handle this as we've done for our preferred versions. We would add an array of possible GroupVersions and say that they are in the preferred ordering, leaving the choice to the individual api server.

@deads2k deads2k force-pushed the discovery-01-group branch from 2bf40db to 02c270f Compare August 24, 2017 18:30
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 24, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Aug 24, 2017

Updated for comments and generated code.

@deads2k
Copy link
Contributor Author

deads2k commented Aug 25, 2017

/retest

@deads2k
Copy link
Contributor Author

deads2k commented Aug 29, 2017

@kubernetes/api-approvers

@liggitt
Copy link
Member

liggitt commented Aug 29, 2017

@smarterclayton
Seems very reasonable to me, do we need to qualify group / version with a prefix in order to distinguish them better?

Seems reasonable to me as well. I don't think a prefix is needed here... other discovery types use unprefixed groups, versions, and version field names

@smarterclayton
Copy link
Contributor

Any other comments? I think i'm ok with this as is.

@smarterclayton
Copy link
Contributor

/approve

based on general agreement from participants

@liggitt liggitt added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Aug 30, 2017
@liggitt
Copy link
Member

liggitt commented Aug 30, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 30, 2017
@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Aug 30, 2017

/test all

@liggitt
Copy link
Member

liggitt commented Aug 31, 2017

/test pull-kubernetes-bazel-build
/test pull-kubernetes-bazel-test

@sttts
Copy link
Contributor

sttts commented Aug 31, 2017

/retest

@deads2k deads2k force-pushed the discovery-01-group branch from 02c270f to de4006b Compare August 31, 2017 12:05
@deads2k deads2k added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Aug 31, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Aug 31, 2017

/retest

@lavalamp
Copy link
Member

/lgtm

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, lavalamp, liggitt, smarterclayton

Associated issue: 38810

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@deads2k
Copy link
Contributor Author

deads2k commented Aug 31, 2017

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 49971, 51357, 51616, 51649, 51372)

@k8s-github-robot k8s-github-robot merged commit d56f6ef into kubernetes:master Sep 1, 2017
@k8s-ci-robot
Copy link
Contributor

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

Test name Commit Details Rerun command
pull-kubernetes-unit de4006b link /test pull-kubernetes-unit
pull-kubernetes-e2e-gce-bazel de4006b link /test pull-kubernetes-e2e-gce-bazel

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.

k8s-github-robot pushed a commit that referenced this pull request Sep 3, 2017
Automatic merge from submit-queue (batch tested with PRs 50602, 51561, 51703, 51748, 49142)

expose discovery information on scalable resources

Builds on #49971 and provides the GroupVersion information that can be used by a dynamic scale client.

@kubernetes/sig-api-machinery-pr-reviews 
@foxish @DirectXMan12 since you both asked for it.
@deads2k deads2k deleted the discovery-01-group branch July 3, 2018 18:01
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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
Development

Successfully merging this pull request may close these issues.