Skip to content

Commit

Permalink
Merge pull request #957 from nicksardo/glbc-cleanup
Browse files Browse the repository at this point in the history
[GLBC] Minor cleanup for logging & future changes
  • Loading branch information
nicksardo authored Jul 18, 2017
2 parents 82e75ee + 25b2723 commit 05ef427
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions controllers/gce/backends/backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ func (b *Backends) Status(name string) string {
}

func applyLegacyHCToHC(existing *compute.HttpHealthCheck, hc *healthchecks.HealthCheck) {
hc.Description = existing.Description
hc.CheckIntervalSec = existing.CheckIntervalSec
hc.HealthyThreshold = existing.HealthyThreshold
hc.Host = existing.Host
Expand Down
4 changes: 3 additions & 1 deletion controllers/gce/backends/backends_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func TestHealthCheckMigration(t *testing.T) {
Name: namer.BeName(p.Port),
RequestPath: "/my-healthz-path",
Host: "k8s.io",
Description: "My custom HC",
UnhealthyThreshold: 30,
CheckIntervalSec: 40,
}
Expand All @@ -154,7 +155,8 @@ func TestHealthCheckMigration(t *testing.T) {
if hc.RequestPath != legacyHC.RequestPath ||
hc.Host != legacyHC.Host ||
hc.UnhealthyThreshold != legacyHC.UnhealthyThreshold ||
hc.CheckIntervalSec != legacyHC.CheckIntervalSec {
hc.CheckIntervalSec != legacyHC.CheckIntervalSec ||
hc.Description != legacyHC.Description {
t.Fatalf("Expected newer health check to have identical settings to legacy health check. Legacy: %+v, New: %+v", legacyHC, hc)
}
}
Expand Down
11 changes: 8 additions & 3 deletions controllers/gce/loadbalancers/loadbalancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (l *L7s) Delete(name string) error {

// Sync loadbalancers with the given runtime info from the controller.
func (l *L7s) Sync(lbs []*L7RuntimeInfo) error {
glog.V(3).Infof("Creating loadbalancers %+v", lbs)
glog.V(3).Infof("Syncing loadbalancers %v", lbs)

if len(lbs) != 0 {
// Lazily create a default backend so we don't tax users who don't care
Expand Down Expand Up @@ -257,6 +257,11 @@ type L7RuntimeInfo struct {
StaticIPName string
}

// String returns the load balancer name
func (l *L7RuntimeInfo) String() string {
return l.Name
}

// L7 represents a single L7 loadbalancer.
type L7 struct {
Name string
Expand Down Expand Up @@ -757,7 +762,6 @@ func (l *L7) UpdateUrlMap(ingressRules utils.GCEURLMap) error {
if l.um == nil {
return fmt.Errorf("cannot add url without an urlmap")
}
glog.V(3).Infof("Updating urlmap for l7 %v", l.Name)

// All UrlMaps must have a default backend. If the Ingress has a default
// backend, it applies to all host rules as well as to the urlmap itself.
Expand Down Expand Up @@ -807,7 +811,8 @@ func (l *L7) UpdateUrlMap(ingressRules utils.GCEURLMap) error {
glog.Infof("UrlMap for l7 %v is unchanged", l.Name)
return nil
}
glog.Infof("Updating url map: %+v", ingressRules)

glog.V(3).Infof("Updating URLMap: %q", l.Name)
um, err := l.cloud.UpdateUrlMap(l.um)
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions controllers/gce/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ func (n *Namer) ParseName(name string) *NameComponents {
// NameBelongsToCluster checks if a given name is tagged with this cluster's UID.
func (n *Namer) NameBelongsToCluster(name string) bool {
if !strings.HasPrefix(name, "k8s-") {
glog.V(4).Infof("%v not part of cluster", name)
return false
}
parts := strings.Split(name, clusterNameDelimiter)
Expand All @@ -203,7 +202,6 @@ func (n *Namer) NameBelongsToCluster(name string) bool {
return false
}
if len(parts) > 2 {
glog.Warningf("Too many parts to name %v, ignoring", name)
return false
}
return parts[1] == clusterName
Expand Down

0 comments on commit 05ef427

Please sign in to comment.