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

federated api servers: Adding a discovery summarizer server #20358

Merged
merged 1 commit into from
May 14, 2016

Conversation

nikhiljindal
Copy link
Contributor

@nikhiljindal nikhiljindal commented Jan 30, 2016

Ref #20229

The server reads a config file to get the list of federated servers and then surfaces the combined discovery information at /api and /apis.

cc @kubernetes/sig-api-machinery @lavalamp


This change is Reviewable

@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 30, 2016
@nikhiljindal nikhiljindal force-pushed the federatedProxy branch 2 times, most recently from dfa7ef8 to 53d0cf9 Compare January 30, 2016 00:55
@nikhiljindal
Copy link
Contributor Author

@k8s-bot ok to test

@nikhiljindal
Copy link
Contributor Author

@lavalamp Can you please take a look once?

For now, I have redefined the discovery types in pkg/apimachinery/discoverysummarizer/types.go instead of changing the current ones in pkg/api/unversioned/types.go.
I have added a single ServerIP field, which will be set to the public IP address. We can add another field for internal address, when we figure that out.

I redefined the type instead of changing the existing one since that is unversioned and I did not want to make too many changes to that.
But the disadvantage is that clients will have to understand different types depending on whether it is talking to the summarizer or the server directly.

WDYT?

// The IP address of the server that is serving this group.
// TODO: Support returning both internal and external IP addresses:
// http://issues.k8s.io/20229
ServerIP string `json:"serverIP"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we assuming this is an API address. This should be a HostName that can also be an IP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right. Will rename to HostName

@smarterclayton
Copy link
Contributor

I don't like summarizer and server not having the same types. I think that defeats the purpose of this API originally, which is that clients just hit a discovery doc. Having two... isn't much discovery.

@lavalamp
Copy link
Member

lavalamp commented Feb 4, 2016

Yeah, I agree, I think it has to have the same types. But the concern is that we're stuck with whatever we add, so we'd better get it right.

@nikhiljindal
Copy link
Contributor Author

ok then, how about I add publicHostName field to unversioned.APIGroup?
Later, when we figure out when to return internal IP of server, we can add another field preferredHostName which will be internalIP for internal clients and external IP for external clients.

Does that sound good?

@nikhiljindal
Copy link
Contributor Author

Have updated the code so that the summarizer now reads a list of serverAddresses and list of paths exposed by each server. It then fetches the groups exposed by all servers and provides a summarized view. Groups exposed at same path by multiple servers are summarized together at same path.

For ex: if there are 2 servers: one supporting /api and /apis and other supporting /oapi and /apis, then the summarizer will support 3 paths: /api which will list resources from server1/api; /apis which will list resources from both - server1/apis and server2/apis; and /oapi which will list resources from server2/oapi.

In future, we can easily extend the FederatedAPIServer struct to include the list of groupVersions themselves, in which case the summarizer will use that list rather than fetching the group versions from the server.

@lavalamp @smarterclayton PTAL

@k8s-bot
Copy link

k8s-bot commented Feb 17, 2016

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@@ -0,0 +1,35 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Move to cmd/kube-discover. Or plugin/cmd/kube-discover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to cmd/kubernetes-discover.
Chose kubernetes-discover over kube-discover as per comment here: #23509 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem moved?

@lavalamp
Copy link
Member

Sorry for delay. Hopefully that's enough for a first pass :)

return &apiVersions, nil
}

func writeRawJSON(statusCode int, object interface{}, w http.ResponseWriter) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like that these have to be duplicated - add a TODO that common response negotiation and version handling should be split out of pkg/apiserver into a more fundamental package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a TODO to share this with kubernetes apiserver.

limitations under the License.
*/

package main
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to put this directly in the cmd/kubernetes-discovery directory?

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 can, but you didnt like types.go directly in top level directory so I thought you might not like this directly at top level directory as well :)
I can move it there if you think thats better.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's OK for the main.go file to be top level. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to top level

@lavalamp
Copy link
Member

lavalamp commented May 9, 2016

Just a few final comments.

@nikhiljindal nikhiljindal force-pushed the federatedProxy branch 3 times, most recently from a9ff150 to bc5abcc Compare May 9, 2016 22:04
@nikhiljindal
Copy link
Contributor Author

Updated code as per comments

@lavalamp lavalamp added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 9, 2016
@lavalamp
Copy link
Member

lavalamp commented May 9, 2016

LGTM-- good to get this started!

@k8s-github-robot
Copy link

@nikhiljindal
You must link to the test flake issue which caused you to request this manual re-test.
Re-test requests should be in the form of: k8s-bot test this issue: #<number>
Here is the list of open test flakes.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 10, 2016
@nikhiljindal
Copy link
Contributor Author

@k8s-bot e2e test this issue: #IGNORE

@nikhiljindal nikhiljindal added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 10, 2016
@k8s-github-robot
Copy link

@nikhiljindal
You must link to the test flake issue which caused you to request this manual re-test.
Re-test requests should be in the form of: k8s-bot test this issue: #<number>
Here is the list of open test flakes.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 10, 2016
@nikhiljindal
Copy link
Contributor Author

@k8s-bot node e2e test this issue: #IGNORE
@k8s-bot unit test this issue: #IGNORE
@k8s-bot test this issue: #IGNORE

@nikhiljindal
Copy link
Contributor Author

@k8s-bot unit test this issue: #IGNORE

@nikhiljindal
Copy link
Contributor Author

Fixed the test by changing the port so that it does not conflict with examples/apiserver.
The tests should pass now.
Adding back the LGTM tag.

@nikhiljindal nikhiljindal added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 13, 2016
@nikhiljindal
Copy link
Contributor Author

As per logs all tests seem to have passed, not sure why it says FAILED at the end :)
@k8s-bot node e2e test this issue: #IGNORE

@k8s-bot
Copy link

k8s-bot commented May 14, 2016

GCE e2e build/test passed for commit 65c1dc8.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit da3bd75 into kubernetes:master May 14, 2016
openshift-publish-robot pushed a commit to openshift/kubernetes that referenced this pull request Aug 17, 2018
…containers

UPSTREAM: 65549: Fix flexvolume in containerized kubelets

Origin-commit: 4b8fef9c7c9971e1857e901c4bdc7a18f60188ac
openshift-publish-robot pushed a commit to openshift/kubernetes that referenced this pull request Jan 29, 2019
…containers

UPSTREAM: 65549: Fix flexvolume in containerized kubelets

Origin-commit: 4b8fef9c7c9971e1857e901c4bdc7a18f60188ac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/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.

7 participants