Commit 538e6507 authored by Geoff Simmons's avatar Geoff Simmons

Unclutter the controller log a bit.

parent 52e64fda
......@@ -35,6 +35,7 @@ import (
"encoding/base64"
"fmt"
"strconv"
"strings"
vcr_v1alpha1 "code.uplex.de/uplex-varnish/k8s-ingress/pkg/apis/varnishingress/v1alpha1"
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/haproxy"
......@@ -1010,6 +1011,19 @@ func (worker *NamespaceWorker) ings2OffloaderSpec(
return offldrSpec, nil
}
func ingsArrayString(ings []*net_v1.Ingress) string {
var s strings.Builder
s.WriteRune('[')
for _, ing := range ings {
s.WriteRune(' ')
s.WriteString(ing.Namespace)
s.WriteRune('/')
s.WriteString(ing.Name)
}
s.WriteString(" ]")
return s.String()
}
// Update the status.loadBalancer field of each suuccessfully synced
// Ingress, using network addresses of the Services that expose the
// http and https ports.
......@@ -1021,24 +1035,24 @@ func (worker *NamespaceWorker) updateIngStatus(
if errors.IsNotFound(err) {
worker.log.Warnf("No Service found in namespace %s "+
"with label %s=%s, will not update "+
"status.loadBalancer for Ingress(es): %v",
"status.loadBalancer for Ingress(es): %s",
worker.namespace, vikingPubSvcKey,
vikingPubSvcVal, ings)
vikingPubSvcVal, ingsArrayString(ings))
return update.MakeSuccess("")
}
return update.MakeFatal(
"Error searching for Services with label %s=%s in "+
"namespace %s, cannot update "+
"status.loadBalancer for Ingress(es) %v: %v",
"status.loadBalancer for Ingress(es) %s: %v",
vikingPubSvcKey, vikingPubSvcVal, worker.namespace,
ings, err)
ingsArrayString(ings), err)
}
if len(svcs) == 0 {
worker.log.Warnf("No Service found in namespace %s "+
"with label %s=%s, will not update "+
"status.loadBalancer for Ingress(es): %v",
"status.loadBalancer for Ingress(es): %s",
worker.namespace, vikingPubSvcKey, vikingPubSvcVal,
ings)
ingsArrayString(ings))
return update.MakeSuccess("")
}
......@@ -1079,17 +1093,17 @@ func (worker *NamespaceWorker) updateIngStatus(
default:
worker.log.Warnf("Service %s/%s has label %s=%s but "+
"type %s, not adding to status.loadBalancer "+
"for Ingress(es): %v", svc.Namespace, svc.Name,
"for Ingress(es): %s", svc.Namespace, svc.Name,
vikingPubSvcKey, vikingPubSvcVal, svc.Spec.Type,
ings)
ingsArrayString(ings))
}
}
if len(ips)+len(hosts) == 0 {
worker.log.Warnf("No public addresses found for Services in "+
"namespace %s with label %s=%s, will not update "+
"status.loadBalancer for Ingress(es): %v",
"status.loadBalancer for Ingress(es): %s",
worker.namespace, vikingPubSvcKey, vikingPubSvcVal,
ings)
ingsArrayString(ings))
return update.MakeSuccess("")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment