Clarify commenting in endpoints_controller

pull/6/head
Paul Morie 2015-02-04 14:21:33 -05:00
parent 7ffbe1444a
commit 3229a634a0
2 changed files with 5 additions and 4 deletions

View File

@ -92,7 +92,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) {
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
}, },
}, },
"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
} }