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

separate discovery from the apiserver #43003

Merged
merged 1 commit into from
May 2, 2017

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Mar 13, 2017

This decouples the API discovery handlers from the core API server code. It separates the code into a new package and clarifies interfaces with existing TPR code.

@kubernetes/sig-api-machinery-pr-reviews

@deads2k deads2k added this to the v1.7 milestone Mar 13, 2017
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 13, 2017
@k8s-github-robot k8s-github-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note-label-needed labels Mar 13, 2017
@k8s-reviewable
Copy link

This change is Reviewable

type legacyRootAPIDiscoveryHandler struct {
// DiscoveryAddresses is used to build cluster IPs for discovery.
discoveryAddresses DiscoveryAddresses

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: empty lines

@sttts
Copy link
Contributor

sttts commented Mar 13, 2017

Haven't done a line-by-line review, but overall this looks good!

@sttts sttts 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 Mar 13, 2017
@deads2k deads2k force-pushed the server-05-discovery branch 2 times, most recently from df2fbd7 to 4f9e8d2 Compare March 14, 2017 19:49
@deads2k
Copy link
Contributor Author

deads2k commented Mar 15, 2017

@k8s-bot gce etcd3 e2e test this
@k8s-bot cvm gce e2e test this

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 23, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Mar 29, 2017

Rebased. @liggitt yes, I preserved the discovery ordering tests.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Apr 12, 2017

rebased again. bump.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 12, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 24, 2017
@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 1, 2017
@deads2k
Copy link
Contributor Author

deads2k commented May 1, 2017

@ncdc rebased again


// AddApiWebService adds a service to return the supported api versions at the legacy /api.
func (s *legacyRootAPIDiscoveryHandler) WebService() *restful.WebService {
// Because in release 1.1, /api returns response with empty APIVersion, we
Copy link
Member

Choose a reason for hiding this comment

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

Remove this comment since you have it a few lines up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove this comment since you have it a few lines up?

done

"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
)

type DiscoveryGroupManager interface {
Copy link
Member

Choose a reason for hiding this comment

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

godoc please

Copy link
Member

Choose a reason for hiding this comment

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

Since the package is discovery, call this GroupManager?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the package is discovery, call this GroupManager?

sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

And AddGroup + RemoveGroup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

godoc please

Since the package is discovery, call this GroupManager

And AddGroup + RemoveGroup

done

)

// legacyRootAPIDiscoveryHandler creates a webservice serving api group discovery.
// Note: during the server runtime apiGroups might change.
Copy link
Member

Choose a reason for hiding this comment

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

What exactly does this note mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What exactly does this note mean?

Doesn't belong here. Will remove.


// apiGroupDiscoveryHandler creates a webservice serving the supported versions, preferred version, and name
// of a group. E.g., such a web service will be registered at /apis/extensions.
type apiGroupDiscoveryHandler struct {
Copy link
Member

Choose a reason for hiding this comment

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

Theme: remove discovery from names? apiGroupHandler

group metav1.APIGroup
}

func NewAPIGroupDiscoveryHandler(serializer runtime.NegotiatedSerializer, group metav1.APIGroup) *apiGroupDiscoveryHandler {
Copy link
Member

Choose a reason for hiding this comment

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

Theme: remove discovery from names? NewAPIGroupHandler


// legacyRootAPIDiscoveryHandler creates a webservice serving api group discovery.
// Note: during the server runtime apiGroups might change.
type legacyRootAPIDiscoveryHandler struct {
Copy link
Member

Choose a reason for hiding this comment

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

Theme: remove discovery from names? legacyRootAPIHandler


// rootAPIsDiscoveryHandler creates a webservice serving api group discovery.
// Note: during the server runtime apiGroups might change.
type rootAPIsDiscoveryHandler struct {
Copy link
Member

Choose a reason for hiding this comment

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

Theme: remove discovery from names? rootAPIsHandler

}

// rootAPIsDiscoveryHandler creates a webservice serving api group discovery.
// Note: during the server runtime apiGroups might change.
Copy link
Member

Choose a reason for hiding this comment

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

Is this comment appropriate here? If so, what is it saying exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this comment appropriate here? If so, what is it saying exactly?

This list of API groups is not fixed and (at least currently) this is accomplished by mutating the handler itself. You cannot safely cache this information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this comment appropriate here? If so, what is it saying exactly?

Clarified comment

@deads2k
Copy link
Contributor Author

deads2k commented May 2, 2017

Comments addressed.

apiGroupsForDiscovery map[string]metav1.APIGroup
apiGroupNamesForDiscovery []string
// RootDiscoveryConfig serves /apis
RootDiscoveryConfig discovery.GroupManager
Copy link
Contributor

Choose a reason for hiding this comment

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

s/RootDiscoveryConfig/DiscoveryGroupManager/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

s/RootDiscoveryConfig/DiscoveryGroupManager/

done

@sttts
Copy link
Contributor

sttts commented May 2, 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 May 2, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 45227, 43003, 45231)

@k8s-github-robot k8s-github-robot merged commit e10c59a into kubernetes:master May 2, 2017
@deads2k deads2k deleted the server-05-discovery branch August 3, 2017 20:08
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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants