Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set glog levels in loadbalancer pool & fix markdown #218

Merged
merged 2 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BETA_LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Ingress is not yet supported on single zone clusters of size > 1000 nodes ([issu

## Disabling GLBC

To completely stop the Ingress controller on GCE/GKE, please see [this] (/docs/faq/gce.md#how-do-i-disable-the-gce-ingress-controller) FAQ.
To completely stop the Ingress controller on GCE/GKE, please see [this](/docs/faq/gce.md#how-do-i-disable-the-gce-ingress-controller) FAQ.

## Changing the cluster UID

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ The certificate in this case is managed by the user and it is their
responsibility to create/delete it. The Ingress controller assigns the SSL certificate with this name to the target proxies of the Ingress.

## Backend HTTPS
For encrypted communication between the load balancer and your Kubernetes service, you need to decorate the service's port as expecting HTTPS. There's an alpha [Service annotation](examples/backside_https/app.yaml) for specifying the expected protocol per service port. Upon seeing the protocol as HTTPS, the ingress controller will assemble a GCP L7 load balancer with an HTTPS backend-service with a HTTPS health check.
For encrypted communication between the load balancer and your Kubernetes service, you need to decorate the service's port as expecting HTTPS. There's an alpha [Service annotation](examples/backside-https/app.yaml) for specifying the expected protocol per service port. Upon seeing the protocol as HTTPS, the ingress controller will assemble a GCP L7 load balancer with an HTTPS backend-service with an HTTPS health check.

The annotation value is a stringified JSON map of port-name to "HTTPS" or "HTTP". If you do not specify the port, "HTTP" is assumed.
```yaml
Expand Down
8 changes: 3 additions & 5 deletions deploy/glbc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ We will explain what each of these things mean in a bit. However, you will only
with one file (script.sh).

**Disclaimer: Running this script could potentially be disruptive to traffic
so if you want to run this on a production cluster, do so at your own risk.
so if you want to run this on a production cluster, do so at your own risk.
Furthermore you should refrain from contacting GKE support if there are issues.**

# Important Prerequisites

There are two prerequisite steps that needs to be taken before running the script.
There are two prerequisite steps that need to be taken before running the script.

Run the command below:

Expand All @@ -37,7 +37,7 @@ theoretically work. If not, the script will do its best to fail gracefully
and let you know what might have went wrong.

The second step is to make sure you populate the gce.conf file. The instructions
for populating the file are in the file itself. You just have to fill it in.
for populating the file are in the file itself. You just have to fill it in.

# Important Details

Expand Down Expand Up @@ -114,5 +114,3 @@ issue.
If you have issues with the controller after the script execution and you do not
know what it causing it, invoke the script in its cleanup mode. The is a quick
and simple way of going back to how everything was before.


37 changes: 18 additions & 19 deletions pkg/loadbalancers/l7.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (l *L7) checkUrlMap(backend *compute.BackendService) (err error) {
return nil
}

glog.Infof("Creating url map %v for backend %v", urlMapName, l.glbcDefaultBackend.Name)
glog.V(3).Infof("Creating url map %v for backend %v", urlMapName, l.glbcDefaultBackend.Name)
newUrlMap := &compute.UrlMap{
Name: urlMapName,
DefaultService: l.glbcDefaultBackend.SelfLink,
Expand All @@ -164,7 +164,7 @@ func (l *L7) checkProxy() (err error) {
proxyName := l.namer.TargetProxy(l.Name, utils.HTTPProtocol)
proxy, _ := l.cloud.GetTargetHttpProxy(proxyName)
if proxy == nil {
glog.Infof("Creating new http proxy for urlmap %v", l.um.Name)
glog.V(3).Infof("Creating new http proxy for urlmap %v", l.um.Name)
newProxy := &compute.TargetHttpProxy{
Name: proxyName,
UrlMap: l.um.SelfLink,
Expand All @@ -180,7 +180,7 @@ func (l *L7) checkProxy() (err error) {
return nil
}
if !utils.CompareLinks(proxy.UrlMap, l.um.SelfLink) {
glog.Infof("Proxy %v has the wrong url map, setting %v overwriting %v",
glog.V(3).Infof("Proxy %v has the wrong url map, setting %v overwriting %v",
proxy.Name, l.um, proxy.UrlMap)
if err := l.cloud.SetUrlMapForTargetHttpProxy(proxy, l.um); err != nil {
return err
Expand Down Expand Up @@ -280,13 +280,13 @@ func (l *L7) populateSSLCert() error {
}
for _, c := range certs {
if l.namer.IsCertUsedForLB(l.Name, c.Name) {
glog.Infof("Populating ssl cert %s for l7 %s", c.Name, l.Name)
glog.V(4).Infof("Populating ssl cert %s for l7 %s", c.Name, l.Name)
l.sslCerts = append(l.sslCerts, c)
}
}
if len(l.sslCerts) == 0 {
// Check for legacy cert since that follows a different naming convention
glog.Infof("Looking for legacy ssl certs")
glog.V(4).Infof("Looking for legacy ssl certs")
expectedCertNames := l.getSslCertLinkInUse()
for _, link := range expectedCertNames {
// Retrieve the certificate and ignore error if certificate wasn't found
Expand All @@ -296,7 +296,7 @@ func (l *L7) populateSSLCert() error {
}
cert, _ := l.cloud.GetSslCertificate(getResourceNameFromLink(name))
if cert != nil {
glog.Infof("Populating legacy ssl cert %s for l7 %s", cert.Name, l.Name)
glog.V(4).Infof("Populating legacy ssl cert %s for l7 %s", cert.Name, l.Name)
l.sslCerts = append(l.sslCerts, cert)
}
}
Expand Down Expand Up @@ -391,7 +391,7 @@ func (l *L7) checkHttpsProxy() (err error) {
proxyName := l.namer.TargetProxy(l.Name, utils.HTTPSProtocol)
proxy, _ := l.cloud.GetTargetHttpsProxy(proxyName)
if proxy == nil {
glog.Infof("Creating new https proxy for urlmap %v", l.um.Name)
glog.V(3).Infof("Creating new https proxy for urlmap %v", l.um.Name)
newProxy := &compute.TargetHttpsProxy{
Name: proxyName,
UrlMap: l.um.SelfLink,
Expand All @@ -414,22 +414,21 @@ func (l *L7) checkHttpsProxy() (err error) {
return nil
}
if !utils.CompareLinks(proxy.UrlMap, l.um.SelfLink) {
glog.Infof("Https proxy %v has the wrong url map, setting %v overwriting %v",
glog.V(3).Infof("Https proxy %v has the wrong url map, setting %v overwriting %v",
proxy.Name, l.um, proxy.UrlMap)
if err := l.cloud.SetUrlMapForTargetHttpsProxy(proxy, l.um); err != nil {
return err
}
}

if !l.compareCerts(proxy.SslCertificates) {
glog.Infof("Https proxy %v has the wrong ssl certs, setting %v overwriting %v",
glog.V(3).Infof("Https proxy %v has the wrong ssl certs, setting %v overwriting %v",
proxy.Name, toCertNames(l.sslCerts), proxy.SslCertificates)
if err := l.cloud.SetSslCertificateForTargetHttpsProxy(proxy, l.sslCerts); err != nil {
return err
}

}
glog.V(3).Infof("Created target https proxy %v", proxy.Name)
l.tps = proxy
return nil
}
Expand All @@ -439,17 +438,17 @@ func (l *L7) checkHttpsProxy() (err error) {
func (l *L7) compareCerts(certLinks []string) bool {
certsMap := getMapfromCertList(l.sslCerts)
if len(certLinks) != len(certsMap) {
glog.Infof("Loadbalancer has %d certs, target proxy has %d certs", len(certsMap), len(certLinks))
glog.V(4).Infof("Loadbalancer has %d certs, target proxy has %d certs", len(certsMap), len(certLinks))
return false
}
var certName string
for _, linkName := range certLinks {
certName = getResourceNameFromLink(linkName)
if cert, ok := certsMap[certName]; !ok {
glog.Infof("Cannot find cert with name %s in certsMap %+v", certName, certsMap)
glog.V(4).Infof("Cannot find cert with name %s in certsMap %+v", certName, certsMap)
return false
} else if ok && !utils.CompareLinks(linkName, cert.SelfLink) {
glog.Infof("Selflink compare failed for certs - %s in loadbalancer, %s in targetproxy", cert.SelfLink, linkName)
glog.V(4).Infof("Selflink compare failed for certs - %s in loadbalancer, %s in targetproxy", cert.SelfLink, linkName)
return false
}
}
Expand All @@ -468,7 +467,7 @@ func (l *L7) checkForwardingRule(name, proxyLink, ip, portRange string) (fw *com
}
if fw == nil {
parts := strings.Split(proxyLink, "/")
glog.Infof("Creating forwarding rule for proxy %v and ip %v:%v", parts[len(parts)-1:], ip, portRange)
glog.V(3).Infof("Creating forwarding rule for proxy %v and ip %v:%v", parts[len(parts)-1:], ip, portRange)
rule := &compute.ForwardingRule{
Name: name,
IPAddress: ip,
Expand All @@ -486,9 +485,9 @@ func (l *L7) checkForwardingRule(name, proxyLink, ip, portRange string) (fw *com
}
// TODO: If the port range and protocol don't match, recreate the rule
if utils.CompareLinks(fw.Target, proxyLink) {
glog.V(3).Infof("Forwarding rule %v already exists", fw.Name)
glog.V(4).Infof("Forwarding rule %v already exists", fw.Name)
} else {
glog.Infof("Forwarding rule %v has the wrong proxy, setting %v overwriting %v",
glog.V(3).Infof("Forwarding rule %v has the wrong proxy, setting %v overwriting %v",
fw.Name, fw.Target, proxyLink)
if err := l.cloud.SetProxyForGlobalForwardingRule(fw.Name, proxyLink); err != nil {
return nil, err
Expand Down Expand Up @@ -577,7 +576,7 @@ func (l *L7) checkStaticIP() (err error) {
staticIPName := l.namer.ForwardingRule(l.Name, utils.HTTPProtocol)
ip, _ := l.cloud.GetGlobalAddress(staticIPName)
if ip == nil {
glog.Infof("Creating static ip %v", staticIPName)
glog.V(3).Infof("Creating static ip %v", staticIPName)
err = l.cloud.ReserveGlobalAddress(&compute.Address{Name: staticIPName, Address: l.fw.IPAddress})
if err != nil {
if utils.IsHTTPErrorCode(err, http.StatusConflict) ||
Expand Down Expand Up @@ -755,11 +754,11 @@ func (l *L7) UpdateUrlMap(ingressRules utils.GCEURLMap) error {
}
oldMap, _ := l.cloud.GetUrlMap(l.um.Name)
if oldMap != nil && mapsEqual(oldMap, l.um) {
glog.Infof("UrlMap for l7 %v is unchanged", l.Name)
glog.V(4).Infof("URLMap for l7 %v is unchanged", l.Name)
return nil
}

glog.V(3).Infof("Updating URLMap: %q", l.Name)
glog.V(3).Infof("Updating URLMap: %q", l.um.Name)
if err := l.cloud.UpdateUrlMap(l.um); err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/loadbalancers/l7s.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ func (l *L7s) Add(ri *L7RuntimeInfo) (err error) {

lb, _ := l.Get(name)
if lb == nil {
glog.Infof("Creating l7 %v", name)
glog.V(3).Infof("Creating l7 %v", name)
lb, err = l.create(ri)
if err != nil {
return err
}
} else {
if !reflect.DeepEqual(lb.runtimeInfo, ri) {
glog.Infof("LB %v runtime info changed, old %+v new %+v", lb.Name, lb.runtimeInfo, ri)
glog.V(3).Infof("LB %v runtime info changed, old %+v new %+v", lb.Name, lb.runtimeInfo, ri)
lb.runtimeInfo = ri
}
}
Expand All @@ -130,7 +130,7 @@ func (l *L7s) Delete(name string) error {
if err != nil {
return err
}
glog.Infof("Deleting lb %v", name)
glog.V(3).Infof("Deleting lb %v", name)
if err := lb.Cleanup(); err != nil {
return err
}
Expand Down Expand Up @@ -204,6 +204,6 @@ func (l *L7s) Shutdown() error {
if err := l.defaultBackendPool.Shutdown(); err != nil {
return err
}
glog.Infof("Loadbalancer pool shutdown.")
glog.V(2).Infof("Loadbalancer pool shutdown.")
return nil
}