Merge pull request #4122 from pmorie/comment

Clarify commenting in endpoints_controller
This commit is contained in:
Brian Grant 2015-02-05 07:09:56 -08:00
commit 50b1034b6c
2 changed files with 5 additions and 4 deletions

View File

@ -96,7 +96,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) {
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.AffinityTypeNone,
}, },
}, },
"empty selector": { "empty port": {
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},

View File

@ -30,7 +30,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
) )
// EndpointController manages service endpoints. // EndpointController manages selector-based service endpoints.
type EndpointController struct { type EndpointController struct {
client *client.Client client *client.Client
} }
@ -42,7 +42,7 @@ func NewEndpointController(client *client.Client) *EndpointController {
} }
} }
// SyncServiceEndpoints syncs service endpoints. // SyncServiceEndpoints syncs endpoints for services with selectors.
func (e *EndpointController) SyncServiceEndpoints() error { func (e *EndpointController) SyncServiceEndpoints() error {
services, err := e.client.Services(api.NamespaceAll).List(labels.Everything()) services, err := e.client.Services(api.NamespaceAll).List(labels.Everything())
if err != nil { if err != nil {
@ -52,7 +52,8 @@ func (e *EndpointController) SyncServiceEndpoints() error {
var resultErr error var resultErr error
for _, service := range services.Items { for _, service := range services.Items {
if service.Spec.Selector == nil { if service.Spec.Selector == nil {
// services without a selector receive no endpoints. The last endpoint will be used. // services without a selector receive no endpoints from this controller;
// these services will receive the endpoints that are created out-of-band via the REST API.
continue continue
} }