-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Allow an empty service selector #2450
Merged
bgrant0607
merged 1 commit into
kubernetes:master
from
smarterclayton:allow_empty_service_selector
Dec 9, 2014
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ func (m *Master) serviceWriterLoop(stop chan struct{}) { | |
// stop polling and start watching. | ||
// TODO: add endpoints of all replicas, not just the elected master. | ||
if m.readWriteServer != "" { | ||
// TODO: the public port should be part of the argument here, port will not always be 443 | ||
if err := m.createMasterServiceIfNeeded("kubernetes", 443); err != nil { | ||
glog.Errorf("Can't create rw service: %v", err) | ||
} | ||
|
@@ -54,6 +55,7 @@ func (m *Master) roServiceWriterLoop(stop chan struct{}) { | |
// TODO: when it becomes possible to change this stuff, | ||
// stop polling and start watching. | ||
if m.readOnlyServer != "" { | ||
// TODO: the public port should be part of the argument here, port will not always be 80 | ||
if err := m.createMasterServiceIfNeeded("kubernetes-ro", 80); err != nil { | ||
glog.Errorf("Can't create ro service: %v", err) | ||
} | ||
|
@@ -81,14 +83,13 @@ func (m *Master) createMasterServiceIfNeeded(serviceName string, port int) error | |
svc := &api.Service{ | ||
ObjectMeta: api.ObjectMeta{ | ||
Name: serviceName, | ||
Namespace: "default", | ||
Namespace: api.NamespaceDefault, | ||
Labels: map[string]string{"provider": "kubernetes", "component": "apiserver"}, | ||
}, | ||
Spec: api.ServiceSpec{ | ||
Port: port, | ||
// We're going to add the endpoints by hand, so this selector is mainly to | ||
// prevent identification of other pods. This selector will be useful when | ||
// we start hosting apiserver in a pod. | ||
Selector: map[string]string{"provider": "kubernetes", "component": "apiserver"}, | ||
// maintained by this code, not by the pod selector | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An explicitly null selector would be more clear. |
||
Selector: nil, | ||
}, | ||
} | ||
// Kids, don't do this at home: this is a hack. There's no good way to call the business | ||
|
@@ -113,10 +114,12 @@ func (m *Master) ensureEndpointsContain(serviceName string, endpoint string) err | |
ctx := api.NewDefaultContext() | ||
e, err := m.endpointRegistry.GetEndpoints(ctx, serviceName) | ||
if err != nil { | ||
e = &api.Endpoints{} | ||
// Fill in ID if it didn't exist already | ||
e.ObjectMeta.Name = serviceName | ||
e.ObjectMeta.Namespace = "default" | ||
e = &api.Endpoints{ | ||
ObjectMeta: api.ObjectMeta{ | ||
Name: serviceName, | ||
Namespace: api.NamespaceDefault, | ||
}, | ||
} | ||
} | ||
found := false | ||
for i := range e.Endpoints { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These json tags aren't used for anything, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not today, but we haven't globally removed them yet from internal so I was following convention only.
----- Original Message -----
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine.