@@ -4,10 +4,10 @@ import (
44	"fmt" 
55	"strings" 
66
7- 	"github.com/golang/glog" 
87	"github.com/nginxinc/kubernetes-ingress/internal/configs" 
98	"github.com/nginxinc/kubernetes-ingress/internal/k8s/appprotect" 
109	"github.com/nginxinc/kubernetes-ingress/internal/k8s/appprotectcommon" 
10+ 	nl "github.com/nginxinc/kubernetes-ingress/internal/logger" 
1111	conf_v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" 
1212	api_v1 "k8s.io/api/core/v1" 
1313	networking "k8s.io/api/networking/v1" 
@@ -19,19 +19,19 @@ func createAppProtectPolicyHandlers(lbc *LoadBalancerController) cache.ResourceE
1919	handlers  :=  cache.ResourceEventHandlerFuncs {
2020		AddFunc : func (obj  interface {}) {
2121			pol  :=  obj .(* unstructured.Unstructured )
22- 			glog . V ( 3 ). Infof ( "Adding AppProtectPolicy: %v" , pol .GetName ())
22+ 			nl . Debugf ( lbc . logger ,  "Adding AppProtectPolicy: %v" , pol .GetName ())
2323			lbc .AddSyncQueue (pol )
2424		},
2525		UpdateFunc : func (oldObj , obj  interface {}) {
2626			oldPol  :=  oldObj .(* unstructured.Unstructured )
2727			newPol  :=  obj .(* unstructured.Unstructured )
28- 			different , err  :=  areResourcesDifferent (oldPol , newPol )
28+ 			different , err  :=  areResourcesDifferent (lbc . logger ,  oldPol , newPol )
2929			if  err  !=  nil  {
30- 				glog . V ( 3 ). Infof ( "Error when comparing policy %v" , err )
30+ 				nl . Debugf ( lbc . logger ,  "Error when comparing policy %v" , err )
3131				lbc .AddSyncQueue (newPol )
3232			}
3333			if  different  {
34- 				glog . V ( 3 ). Infof ( "ApPolicy %v changed, syncing" , oldPol .GetName ())
34+ 				nl . Debugf ( lbc . logger ,  "ApPolicy %v changed, syncing" , oldPol .GetName ())
3535				lbc .AddSyncQueue (newPol )
3636			}
3737		},
@@ -46,19 +46,19 @@ func createAppProtectLogConfHandlers(lbc *LoadBalancerController) cache.Resource
4646	handlers  :=  cache.ResourceEventHandlerFuncs {
4747		AddFunc : func (obj  interface {}) {
4848			conf  :=  obj .(* unstructured.Unstructured )
49- 			glog . V ( 3 ). Infof ( "Adding AppProtectLogConf: %v" , conf .GetName ())
49+ 			nl . Debugf ( lbc . logger ,  "Adding AppProtectLogConf: %v" , conf .GetName ())
5050			lbc .AddSyncQueue (conf )
5151		},
5252		UpdateFunc : func (oldObj , obj  interface {}) {
5353			oldConf  :=  oldObj .(* unstructured.Unstructured )
5454			newConf  :=  obj .(* unstructured.Unstructured )
55- 			different , err  :=  areResourcesDifferent (oldConf , newConf )
55+ 			different , err  :=  areResourcesDifferent (lbc . logger ,  oldConf , newConf )
5656			if  err  !=  nil  {
57- 				glog . V ( 3 ). Infof ( "Error when comparing LogConfs %v" , err )
57+ 				nl . Debugf ( lbc . logger ,  "Error when comparing LogConfs %v" , err )
5858				lbc .AddSyncQueue (newConf )
5959			}
6060			if  different  {
61- 				glog . V ( 3 ). Infof ( "ApLogConf %v changed, syncing" , oldConf .GetName ())
61+ 				nl . Debugf ( lbc . logger ,  "ApLogConf %v changed, syncing" , oldConf .GetName ())
6262				lbc .AddSyncQueue (newConf )
6363			}
6464		},
@@ -73,19 +73,19 @@ func createAppProtectUserSigHandlers(lbc *LoadBalancerController) cache.Resource
7373	handlers  :=  cache.ResourceEventHandlerFuncs {
7474		AddFunc : func (obj  interface {}) {
7575			sig  :=  obj .(* unstructured.Unstructured )
76- 			glog . V ( 3 ). Infof ( "Adding AppProtectUserSig: %v" , sig .GetName ())
76+ 			nl . Debugf ( lbc . logger ,  "Adding AppProtectUserSig: %v" , sig .GetName ())
7777			lbc .AddSyncQueue (sig )
7878		},
7979		UpdateFunc : func (oldObj , obj  interface {}) {
8080			oldSig  :=  oldObj .(* unstructured.Unstructured )
8181			newSig  :=  obj .(* unstructured.Unstructured )
82- 			different , err  :=  areResourcesDifferent (oldSig , newSig )
82+ 			different , err  :=  areResourcesDifferent (lbc . logger ,  oldSig , newSig )
8383			if  err  !=  nil  {
84- 				glog . V ( 3 ). Infof ( "Error when comparing UserSigs %v" , err )
84+ 				nl . Debugf ( lbc . logger ,  "Error when comparing UserSigs %v" , err )
8585				lbc .AddSyncQueue (newSig )
8686			}
8787			if  different  {
88- 				glog . V ( 3 ). Infof ( "ApUserSig %v changed, syncing" , oldSig .GetName ())
88+ 				nl . Debugf ( lbc . logger ,  "ApUserSig %v changed, syncing" , oldSig .GetName ())
8989				lbc .AddSyncQueue (newSig )
9090			}
9191		},
@@ -125,7 +125,7 @@ func (nsi *namespacedInformer) addAppProtectUserSigHandler(handlers cache.Resour
125125
126126func  (lbc  * LoadBalancerController ) syncAppProtectPolicy (task  task ) {
127127	key  :=  task .Key 
128- 	glog . V ( 3 ). Infof ( "Syncing AppProtectPolicy %v" , key )
128+ 	nl . Debugf ( lbc . logger ,  "Syncing AppProtectPolicy %v" , key )
129129
130130	var  obj  interface {}
131131	var  polExists  bool 
@@ -142,11 +142,11 @@ func (lbc *LoadBalancerController) syncAppProtectPolicy(task task) {
142142	var  problems  []appprotect.Problem 
143143
144144	if  ! polExists  {
145- 		glog . V ( 2 ). Infof ( "Deleting AppProtectPolicy: %v\n " , key )
145+ 		nl . Debugf ( lbc . logger ,  "Deleting AppProtectPolicy: %v\n " , key )
146146
147147		changes , problems  =  lbc .appProtectConfiguration .DeletePolicy (key )
148148	} else  {
149- 		glog . V ( 2 ). Infof ( "Adding or Updating AppProtectPolicy: %v\n " , key )
149+ 		nl . Debugf ( lbc . logger ,  "Adding or Updating AppProtectPolicy: %v\n " , key )
150150
151151		changes , problems  =  lbc .appProtectConfiguration .AddOrUpdatePolicy (obj .(* unstructured.Unstructured ))
152152	}
@@ -157,7 +157,7 @@ func (lbc *LoadBalancerController) syncAppProtectPolicy(task task) {
157157
158158func  (lbc  * LoadBalancerController ) syncAppProtectLogConf (task  task ) {
159159	key  :=  task .Key 
160- 	glog . V ( 3 ). Infof ( "Syncing AppProtectLogConf %v" , key )
160+ 	nl . Debugf ( lbc . logger ,  "Syncing AppProtectLogConf %v" , key )
161161	var  obj  interface {}
162162	var  confExists  bool 
163163	var  err  error 
@@ -173,11 +173,11 @@ func (lbc *LoadBalancerController) syncAppProtectLogConf(task task) {
173173	var  problems  []appprotect.Problem 
174174
175175	if  ! confExists  {
176- 		glog . V ( 2 ). Infof ( "Deleting AppProtectLogConf: %v\n " , key )
176+ 		nl . Debugf ( lbc . logger ,  "Deleting AppProtectLogConf: %v\n " , key )
177177
178178		changes , problems  =  lbc .appProtectConfiguration .DeleteLogConf (key )
179179	} else  {
180- 		glog . V ( 2 ). Infof ( "Adding or Updating AppProtectLogConf: %v\n " , key )
180+ 		nl . Debugf ( lbc . logger ,  "Adding or Updating AppProtectLogConf: %v\n " , key )
181181
182182		changes , problems  =  lbc .appProtectConfiguration .AddOrUpdateLogConf (obj .(* unstructured.Unstructured ))
183183	}
@@ -188,7 +188,7 @@ func (lbc *LoadBalancerController) syncAppProtectLogConf(task task) {
188188
189189func  (lbc  * LoadBalancerController ) syncAppProtectUserSig (task  task ) {
190190	key  :=  task .Key 
191- 	glog . V ( 3 ). Infof ( "Syncing AppProtectUserSig %v" , key )
191+ 	nl . Debugf ( lbc . logger ,  "Syncing AppProtectUserSig %v" , key )
192192	var  obj  interface {}
193193	var  sigExists  bool 
194194	var  err  error 
@@ -204,11 +204,11 @@ func (lbc *LoadBalancerController) syncAppProtectUserSig(task task) {
204204	var  problems  []appprotect.Problem 
205205
206206	if  ! sigExists  {
207- 		glog . V ( 2 ). Infof ( "Deleting AppProtectUserSig: %v\n " , key )
207+ 		nl . Debugf ( lbc . logger ,  "Deleting AppProtectUserSig: %v\n " , key )
208208
209209		change , problems  =  lbc .appProtectConfiguration .DeleteUserSig (key )
210210	} else  {
211- 		glog . V ( 2 ). Infof ( "Adding or Updating AppProtectUserSig: %v\n " , key )
211+ 		nl . Debugf ( lbc . logger ,  "Adding or Updating AppProtectUserSig: %v\n " , key )
212212
213213		change , problems  =  lbc .appProtectConfiguration .AddOrUpdateUserSig (obj .(* unstructured.Unstructured ))
214214	}
@@ -353,7 +353,7 @@ func (lbc *LoadBalancerController) getAppProtectPolicy(ing *networking.Ingress)
353353}
354354
355355func  (lbc  * LoadBalancerController ) processAppProtectChanges (changes  []appprotect.Change ) {
356- 	glog . V ( 3 ). Infof ( "Processing %v App Protect changes" , len (changes ))
356+ 	nl . Debugf ( lbc . logger ,  "Processing %v App Protect changes" , len (changes ))
357357
358358	for  _ , c  :=  range  changes  {
359359		if  c .Op  ==  appprotect .AddOrUpdate  {
@@ -463,13 +463,13 @@ func (lbc *LoadBalancerController) processAppProtectUserSigChange(change appprot
463463
464464	warnings , err  :=  lbc .configurator .RefreshAppProtectUserSigs (change .UserSigs , delPols , allIngExes , allMergeableIngresses , allVsExes )
465465	if  err  !=  nil  {
466- 		glog .Errorf ("Error when refreshing App Protect Policy User defined signatures: %v" , err )
466+ 		nl .Errorf (lbc . logger ,  "Error when refreshing App Protect Policy User defined signatures: %v" , err )
467467	}
468468	lbc .updateResourcesStatusAndEvents (allResources , warnings , err )
469469}
470470
471471func  (lbc  * LoadBalancerController ) processAppProtectProblems (problems  []appprotect.Problem ) {
472- 	glog . V ( 3 ). Infof ( "Processing %v App Protect problems" , len (problems ))
472+ 	nl . Debugf ( lbc . logger ,  "Processing %v App Protect problems" , len (problems ))
473473
474474	for  _ , p  :=  range  problems  {
475475		eventType  :=  api_v1 .EventTypeWarning 
@@ -479,7 +479,7 @@ func (lbc *LoadBalancerController) processAppProtectProblems(problems []appprote
479479
480480func  (lbc  * LoadBalancerController ) cleanupUnwatchedAppWafResources (nsi  * namespacedInformer ) {
481481	for  _ , obj  :=  range  nsi .appProtectPolicyLister .List () {
482- 		glog . V ( 3 ). Infof ( "Cleaning up unwatched appprotect policies in namespace: %v" , nsi .namespace )
482+ 		nl . Debugf ( lbc . logger ,  "Cleaning up unwatched appprotect policies in namespace: %v" , nsi .namespace )
483483		appPol  :=  obj .((* unstructured.Unstructured ))
484484		namespace  :=  appPol .GetNamespace ()
485485		name  :=  appPol .GetName ()
@@ -489,7 +489,7 @@ func (lbc *LoadBalancerController) cleanupUnwatchedAppWafResources(nsi *namespac
489489		lbc .processAppProtectProblems (problems )
490490	}
491491	for  _ , obj  :=  range  nsi .appProtectLogConfLister .List () {
492- 		glog . V ( 3 ). Infof ( "Cleaning up unwatched approtect logconfs in namespace: %v" , nsi .namespace )
492+ 		nl . Debugf ( lbc . logger ,  "Cleaning up unwatched approtect logconfs in namespace: %v" , nsi .namespace )
493493		appLogConf  :=  obj .((* unstructured.Unstructured ))
494494		namespace  :=  appLogConf .GetNamespace ()
495495		name  :=  appLogConf .GetName ()
@@ -499,7 +499,7 @@ func (lbc *LoadBalancerController) cleanupUnwatchedAppWafResources(nsi *namespac
499499		lbc .processAppProtectProblems (problems )
500500	}
501501	for  _ , obj  :=  range  nsi .appProtectUserSigLister .List () {
502- 		glog . V ( 3 ). Infof ( "Cleaning up unwatched usersigs in namespace: %v" , nsi .namespace )
502+ 		nl . Debugf ( lbc . logger ,  "Cleaning up unwatched usersigs in namespace: %v" , nsi .namespace )
503503		appUserSig  :=  obj .((* unstructured.Unstructured ))
504504		namespace  :=  appUserSig .GetNamespace ()
505505		name  :=  appUserSig .GetName ()
0 commit comments