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

Adding hostname to groups discovery information #20626

Merged

Conversation

nikhiljindal
Copy link
Contributor

Based on #20358 (comment)

Ref #20229

Adding a publicHostname field to groups discovery information.

To be used by dynamic client talking to a cluster with federated api servers.

cc @bgrant0607 @lavalamp @smarterclayton @kubernetes/sig-api-machinery

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 4, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/XS

@k8s-bot
Copy link

k8s-bot commented Feb 4, 2016

GCE e2e test build/test passed for commit 8607da2200e16a68fb9004c8d56f4b4e793df2ec.

@k8s-bot
Copy link

k8s-bot commented Feb 4, 2016

GCE e2e test build/test passed for commit 64b6b8cf1ba86ecf83cbd1b473befba39a234589.

@lavalamp
Copy link
Member

lavalamp commented Feb 4, 2016

Can you also add the master change needed to populate this field? I think you want that in 1.2, also.

@k8s-github-robot k8s-github-robot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 4, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 4, 2016
@@ -298,6 +298,8 @@ const (
// +protobuf.options.(gogoproto.goproto_stringer)=false
type APIVersions struct {
TypeMeta `json:",inline"`
// public hostname of the server that is serving this group.
PublicHostname string `json:"publicHostname"`
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to be consistent with service terminology, which is "External" rather than "Public":

https://github.com/kubernetes/kubernetes/blob/master/pkg/api/v1/types.go#L1740

Copy link
Member

Choose a reason for hiding this comment

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

And are we also going to want the port?

Copy link
Member

Choose a reason for hiding this comment

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

And path prefix?

Copy link
Member

Choose a reason for hiding this comment

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

And would we want to allow 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.

Will change to External.

Yes, it can have IP and port as well.

@nikhiljindal
Copy link
Contributor Author

Have updated the PR to populate the field as well.

This is how it looks for me on local cluster:

localhost:8080/apis:
apis

localhost:8080/api:
api

@smarterclayton
Copy link
Contributor

Do we want to call it public? What does "public" mean? Do we use "public"
anywhere else in the API? Do we want to formalize "public" as meaning
"visible outside the cluster"?

On Thu, Feb 4, 2016 at 3:09 PM, Nikhil Jindal notifications@github.com
wrote:

Have updated the PR to populate the field as well.

This is how it looks for me on local cluster:

localhost:8080/apis:
[image: apis]
https://cloud.githubusercontent.com/assets/10199099/12828099/a2f7e568-cb37-11e5-8a58-d570c73d8a1f.png

localhost:8080/api:
[image: api]
https://cloud.githubusercontent.com/assets/10199099/12828101/a79136b0-cb37-11e5-9e17-568bb0837013.png


Reply to this email directly or view it on GitHub
#20626 (comment)
.

@nikhiljindal
Copy link
Contributor Author

You are right @smarterclayton. @bgrant0607 also said the same thing. He suggested renaming public to external (which is what we use in ServiceSpec: https://github.com/kubernetes/kubernetes/blob/master/pkg/api/v1/types.go#L1740).

But on discussing further with @lavalamp and @bgrant0607, we decided to replace the external address field with a CIDRToAddressMap.
Clients can match their IP with the CIDR and figure out the address that they should use.
This assumes that the subnets have exclusive CIDRs. Clients can use the address with the longest CIDR that they match.
I will update the PR accordingly.

cc @thockin @bprashanth

@nikhiljindal
Copy link
Contributor Author

Pushed a new commit as per the comment above.

I am using ServiceClusterIPRange to determine the internal CIDR (not sure if thats the right thing to use).
This is what I see now:

localhost:8080/api:
api_cidr

localhost:8080/apis:
apis_cidr

@k8s-bot
Copy link

k8s-bot commented Feb 5, 2016

GCE e2e test build/test passed for commit 56557fbe7f70e30869d2e66aca7ef8dbe1ecac76.

@smarterclayton
Copy link
Contributor

Wow.... that's... interesting. It uh... is certainly flexible.... :)

On Thu, Feb 4, 2016 at 7:43 PM, Kubernetes Bot notifications@github.com
wrote:

GCE e2e test build/test passed for commit 56557fb
56557fb
.


Reply to this email directly or view it on GitHub
#20626 (comment)
.

@smarterclayton
Copy link
Contributor

Will this map to IPv6 cleanly?

On Thu, Feb 4, 2016 at 7:49 PM, Clayton Coleman ccoleman@redhat.com wrote:

Wow.... that's... interesting. It uh... is certainly flexible.... :)

On Thu, Feb 4, 2016 at 7:43 PM, Kubernetes Bot notifications@github.com
wrote:

GCE e2e test build/test passed for commit 56557fb
56557fb
.


Reply to this email directly or view it on GitHub
#20626 (comment)
.

@lavalamp
Copy link
Member

lavalamp commented Feb 5, 2016

It looks like you have the wrong port on the external address, I thought 6443 was the one we listen on, but we actually should be advertising 443? I forget how it's connected.

@@ -321,6 +323,15 @@ type APIGroup struct {
// preferredVersion is the version preferred by the API server, which
// probably is the storage version.
PreferredVersion GroupVersionForDiscovery `json:"preferredVersion,omitempty"`
// a map of CIDR to address of the server that is serving this group. Clients can use the appropriate address as per the CIDR that they match.
CIDRToAddressMap []CIDRToAddress `json:"cidrToAddressMap"`
Copy link
Member

Choose a reason for hiding this comment

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

@thockin we need you to bless this type.

Copy link
Member

Choose a reason for hiding this comment

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

How about ServerAddressByClientCIDR?

@lavalamp
Copy link
Member

lavalamp commented Feb 5, 2016

I believe CIDRs are still things for IPv6, so it should. Also this would
let us provide IPv6 and IPv4 addresses, which could be handy, though that
wasn't what we were thinking.

On Thu, Feb 4, 2016 at 4:49 PM, Clayton Coleman notifications@github.com
wrote:

Will this map to IPv6 cleanly?

On Thu, Feb 4, 2016 at 7:49 PM, Clayton Coleman ccoleman@redhat.com
wrote:

Wow.... that's... interesting. It uh... is certainly flexible.... :)

On Thu, Feb 4, 2016 at 7:43 PM, Kubernetes Bot <notifications@github.com

wrote:

GCE e2e test build/test passed for commit 56557fb
<
56557fb

.


Reply to this email directly or view it on GitHub
<
#20626 (comment)

.


Reply to this email directly or view it on GitHub
#20626 (comment)
.

@smarterclayton
Copy link
Contributor

I'm ok with the map, I don't know how humans will understand it (it's awful
clever). But I'd rather have this than something not well thought through.

On Thu, Feb 4, 2016 at 8:03 PM, Daniel Smith notifications@github.com
wrote:

I believe CIDRs are still things for IPv6, so it should. Also this would
let us provide IPv6 and IPv4 addresses, which could be handy, though that
wasn't what we were thinking.

On Thu, Feb 4, 2016 at 4:49 PM, Clayton Coleman notifications@github.com
wrote:

Will this map to IPv6 cleanly?

On Thu, Feb 4, 2016 at 7:49 PM, Clayton Coleman ccoleman@redhat.com
wrote:

Wow.... that's... interesting. It uh... is certainly flexible.... :)

On Thu, Feb 4, 2016 at 7:43 PM, Kubernetes Bot <
notifications@github.com

wrote:

GCE e2e test build/test passed for commit 56557fb
<

56557fb

.

  • Build Log
    <

https://storage.cloud.google.com/kubernetes-jenkins/pr-logs/pull/20626/kubernetes-pull-build-test-e2e-gce/26852/build-log.txt

  • Test Artifacts
    <

https://console.developers.google.com/storage/browser/kubernetes-jenkins/pr-logs/pull/20626/kubernetes-pull-build-test-e2e-gce/26852/artifacts/

  • Internal Jenkins Results
    <

http://goto.google.com/prkubekins/job/kubernetes-pull-build-test-e2e-gce//26852


Reply to this email directly or view it on GitHub
<

#20626 (comment)

.


Reply to this email directly or view it on GitHub
<
#20626 (comment)

.


Reply to this email directly or view it on GitHub
#20626 (comment)
.

@nikhiljindal
Copy link
Contributor Author

Updated to use ServiceReadWritePort instead of ReadWritePort which switched the address to use 443 instead of 6443 port.
Also pushed a new version as per comments.

@k8s-bot
Copy link

k8s-bot commented Feb 5, 2016

GCE e2e build/test failed for commit f178c1631a9f26d55a7f98fcbbce3fb25b59a289.

hdrRealIp := hdr.Get("X-Real-Ip")
if hdrRealIp != "" {
ip := net.ParseIP(hdrRealIp)
return ip
Copy link
Member

Choose a reason for hiding this comment

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

If ip is nil here, I think you should keep going also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@nikhiljindal nikhiljindal force-pushed the serverIPInDiscovery branch 3 times, most recently from 641d34c to 00b1fd9 Compare February 18, 2016 07:48
@nikhiljindal
Copy link
Contributor Author

Renamed ServerAddressByClientCIDRMap to ServerAddressByClientCIDRs and pushed updated code as per comments.
PTAL

@k8s-bot
Copy link

k8s-bot commented Feb 18, 2016

GCE e2e test build/test passed for commit 641d34ca3647ccbb6b753dda06af3270fbc99d30.

@k8s-bot
Copy link

k8s-bot commented Feb 18, 2016

GCE e2e build/test failed for commit c1c0dcc7bd815e064fd8d29c03b74c489c98e3cb.

@k8s-bot
Copy link

k8s-bot commented Feb 18, 2016

GCE e2e test build/test passed for commit 00b1fd9de3217a74c3c7a44e4dda168e13d2363c.

@k8s-github-robot
Copy link

PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 18, 2016
@lavalamp lavalamp added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 18, 2016
@lavalamp
Copy link
Member

LGTM

@nikhiljindal
Copy link
Contributor Author

Rebased. Readding the LGTM tag

@nikhiljindal nikhiljindal 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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 18, 2016
@k8s-bot
Copy link

k8s-bot commented Feb 18, 2016

GCE e2e test build/test passed for commit 20ce4ae.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Feb 19, 2016

GCE e2e test build/test passed for commit 20ce4ae.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Feb 19, 2016
@k8s-github-robot k8s-github-robot merged commit 5d7d0ee into kubernetes:master Feb 19, 2016
@deads2k deads2k mentioned this pull request Feb 19, 2016
@nikhiljindal nikhiljindal added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Mar 11, 2016
@nikhiljindal
Copy link
Contributor Author

Added the release note label

k8s-github-robot pushed a commit that referenced this pull request Jun 4, 2016
Automatic merge from submit-queue

Fixing logic to generate ExternalHost in genericapiserver

@ncdc pointed it out (https://kubernetes.slack.com/archives/sig-api-machinery/p1464974528000139) that lines 305 and 306 dont match. We should be using ReadWritePort instead of ServiceReadWritePort in line 306.

#20626 seems to be the culprit PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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.

10 participants