From 893a64f2eda49fde2d64b0b65f51554faee59bd6 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Sat, 14 Mar 2015 13:07:56 -0400 Subject: [PATCH] Don't log when auto-published services and namespace exist already Also, be a bit less chatty w.r.t. master setDefaults --- pkg/master/master.go | 6 +++--- pkg/master/publish.go | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/master/master.go b/pkg/master/master.go index 574ce24bde7..dc296875d84 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -221,12 +221,12 @@ func setDefaults(c *Config) { continue } if ip.IsLoopback() { - glog.Infof("'%v' (%v) is a loopback address, ignoring.", ip, addrs[i]) + glog.V(5).Infof("'%v' (%v) is a loopback address, ignoring.", ip, addrs[i]) continue } found = true c.PublicAddress = ip - glog.Infof("Will report %v as public IP address.", ip) + glog.V(2).Infof("Will report %v as public IP address.", ip) break } if !found { @@ -279,7 +279,7 @@ func New(c *Config) *Master { if err != nil { glog.Fatalf("Failed to generate service read-write IP for master service: %v", err) } - glog.Infof("Setting master service IPs based on PortalNet subnet to %q (read-only) and %q (read-write).", serviceReadOnlyIP, serviceReadWriteIP) + glog.V(4).Infof("Setting master service IPs based on PortalNet subnet to %q (read-only) and %q (read-write).", serviceReadOnlyIP, serviceReadWriteIP) m := &Master{ client: c.Client, diff --git a/pkg/master/publish.go b/pkg/master/publish.go index 3cfb43f73f4..ac7bfa40957 100644 --- a/pkg/master/publish.go +++ b/pkg/master/publish.go @@ -21,6 +21,7 @@ import ( "time" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" + "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" "github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver" "github.com/golang/glog" @@ -91,6 +92,9 @@ func (m *Master) createMasterNamespaceIfNeeded(ns string) error { }, } _, err := m.storage["namespaces"].(apiserver.RESTCreater).Create(ctx, namespace) + if err != nil && errors.IsAlreadyExists(err) { + err = nil + } return err } @@ -118,6 +122,9 @@ func (m *Master) createMasterServiceIfNeeded(serviceName string, serviceIP net.I }, } _, err := m.storage["services"].(apiserver.RESTCreater).Create(ctx, svc) + if err != nil && errors.IsAlreadyExists(err) { + err = nil + } return err }