Do service creation/update/deletion work in a pool of goroutines, protecting

each service with a lock to ensure that no two goroutines will process a
service at the same time. This is needed to avoid weird race conditions.
This commit is contained in:
Alex Robinson
2015-04-09 20:48:27 +00:00
parent 9a351e3670
commit fc08a0a71b
4 changed files with 107 additions and 72 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/testclient"
fake_cloud "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/fake"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
)
const region = "us-central"
@@ -89,7 +90,7 @@ func TestCreateExternalLoadBalancer(t *testing.T) {
controller.init()
cloud.Calls = nil // ignore any cloud calls made in init()
client.Actions = nil // ignore any client calls made in init()
err, _ := controller.createLoadBalancerIfNeeded(item.service)
err, _ := controller.createLoadBalancerIfNeeded(types.NamespacedName{"foo", "bar"}, item.service, nil)
if !item.expectErr && err != nil {
t.Errorf("unexpected error: %v", err)
} else if item.expectErr && err == nil {