Replace glog with klog

This commit is contained in:
Manuel Alejandro de Brito Fontes 2018-12-05 13:27:55 -03:00
parent f4a4daed84
commit 2fa55eabf6
33 changed files with 353 additions and 327 deletions

View file

@ -17,11 +17,11 @@ limitations under the License.
package annotations
import (
"github.com/golang/glog"
"github.com/imdario/mergo"
"k8s.io/ingress-nginx/internal/ingress/annotations/canary"
"k8s.io/ingress-nginx/internal/ingress/annotations/modsecurity"
"k8s.io/ingress-nginx/internal/ingress/annotations/sslcipher"
"k8s.io/klog"
apiv1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
@ -156,7 +156,7 @@ func (e Extractor) Extract(ing *extensions.Ingress) *Ingress {
data := make(map[string]interface{})
for name, annotationParser := range e.annotations {
val, err := annotationParser.Parse(ing)
glog.V(5).Infof("annotation %v in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), val)
klog.V(5).Infof("annotation %v in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), val)
if err != nil {
if errors.IsMissingAnnotations(err) {
continue
@ -177,11 +177,11 @@ func (e Extractor) Extract(ing *extensions.Ingress) *Ingress {
_, alreadyDenied := data[DeniedKeyName]
if !alreadyDenied {
data[DeniedKeyName] = err
glog.Errorf("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
klog.Errorf("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
continue
}
glog.V(5).Infof("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
klog.V(5).Infof("error reading %v annotation in Ingress %v/%v: %v", name, ing.GetNamespace(), ing.GetName(), err)
}
if val != nil {
@ -191,7 +191,7 @@ func (e Extractor) Extract(ing *extensions.Ingress) *Ingress {
err := mergo.MapWithOverwrite(pia, data)
if err != nil {
glog.Errorf("unexpected error merging extracted annotations: %v", err)
klog.Errorf("unexpected error merging extracted annotations: %v", err)
}
return pia

View file

@ -21,7 +21,7 @@ import (
"regexp"
"strings"
"github.com/golang/glog"
"k8s.io/klog"
extensions "k8s.io/api/extensions/v1beta1"
@ -146,12 +146,12 @@ func (a authReq) Parse(ing *extensions.Ingress) (interface{}, error) {
// Optional Parameters
signIn, err := parser.GetStringAnnotation("auth-signin", ing)
if err != nil {
glog.Warning("auth-signin annotation is undefined and will not be set")
klog.Warning("auth-signin annotation is undefined and will not be set")
}
authSnippet, err := parser.GetStringAnnotation("auth-snippet", ing)
if err != nil {
glog.Warning("auth-snippet annotation is undefined and will not be set")
klog.Warning("auth-snippet annotation is undefined and will not be set")
}
responseHeaders := []string{}

View file

@ -20,7 +20,7 @@ import (
"regexp"
"strings"
"github.com/golang/glog"
"k8s.io/klog"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
@ -57,7 +57,7 @@ func (a backendProtocol) Parse(ing *extensions.Ingress) (interface{}, error) {
proto = strings.TrimSpace(strings.ToUpper(proto))
if !validProtocols.MatchString(proto) {
glog.Warningf("Protocol %v is not a valid value for the backend-protocol annotation. Using HTTP as protocol", proto)
klog.Warningf("Protocol %v is not a valid value for the backend-protocol annotation. Using HTTP as protocol", proto)
return HTTP, nil
}

View file

@ -17,7 +17,7 @@ limitations under the License.
package class
import (
"github.com/golang/glog"
"k8s.io/klog"
extensions "k8s.io/api/extensions/v1beta1"
)
@ -44,7 +44,7 @@ var (
func IsValid(ing *extensions.Ingress) bool {
ingress, ok := ing.GetAnnotations()[IngressKey]
if !ok {
glog.V(3).Infof("annotation %v is not present in ingress %v/%v", IngressKey, ing.Namespace, ing.Name)
klog.V(3).Infof("annotation %v is not present in ingress %v/%v", IngressKey, ing.Namespace, ing.Name)
}
// we have 2 valid combinations

View file

@ -19,7 +19,7 @@ package sessionaffinity
import (
"regexp"
"github.com/golang/glog"
"k8s.io/klog"
extensions "k8s.io/api/extensions/v1beta1"
@ -140,7 +140,7 @@ func (a affinity) Parse(ing *extensions.Ingress) (interface{}, error) {
case "cookie":
cookie = a.cookieAffinityParse(ing)
default:
glog.V(3).Infof("No default affinity was found for Ingress %v", ing.Name)
klog.V(3).Infof("No default affinity was found for Ingress %v", ing.Name)
}