@@ -81,8 +81,7 @@ type DataPlane struct {
8181func NewDataPlane (nodeName string , ioShim * common.IOShim , cfg * Config , stopChannel <- chan struct {}) (* DataPlane , error ) {
8282 metrics .InitializeAll ()
8383 if util .IsWindowsDP () {
84- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
85- // klog.Infof("[DataPlane] enabling AddEmptySetToLists for Windows")
84+ klog .Infof ("[DataPlane] enabling AddEmptySetToLists for Windows" )
8685 cfg .IPSetManagerCfg .AddEmptySetToLists = true
8786 }
8887
@@ -113,8 +112,7 @@ func NewDataPlane(nodeName string, ioShim *common.IOShim, cfg *Config, stopChann
113112 return nil , ErrInvalidApplyConfig
114113 }
115114 } else {
116- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
117- // klog.Info("[DataPlane] dataplane configured to NOT apply in background")
115+ klog .Info ("[DataPlane] dataplane configured to NOT apply in background" )
118116 dp .updatePodCache = newUpdatePodCache (1 )
119117 }
120118
@@ -152,8 +150,7 @@ func (dp *DataPlane) FinishBootupPhase() {
152150 dp .applyInfo .Lock ()
153151 defer dp .applyInfo .Unlock ()
154152
155- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
156- // klog.Infof("[DataPlane] finished bootup phase")
153+ klog .Infof ("[DataPlane] finished bootup phase" )
157154 dp .applyInfo .inBootupPhase = false
158155}
159156
@@ -260,8 +257,7 @@ func (dp *DataPlane) AddToSets(setNames []*ipsets.IPSetMetadata, podMetadata *Po
260257 }
261258
262259 if dp .shouldUpdatePod () && podMetadata .NodeName == dp .nodeName {
263- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
264- // klog.Infof("[DataPlane] Updating Sets to Add for pod key %s", podMetadata.PodKey)
260+ klog .Infof ("[DataPlane] Updating Sets to Add for pod key %s" , podMetadata .PodKey )
265261
266262 // lock updatePodCache while reading/modifying or setting the updatePod in the cache
267263 dp .updatePodCache .Lock ()
@@ -283,8 +279,7 @@ func (dp *DataPlane) RemoveFromSets(setNames []*ipsets.IPSetMetadata, podMetadat
283279 }
284280
285281 if dp .shouldUpdatePod () && podMetadata .NodeName == dp .nodeName {
286- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
287- // klog.Infof("[DataPlane] Updating Sets to Remove for pod key %s", podMetadata.PodKey)
282+ klog .Infof ("[DataPlane] Updating Sets to Remove for pod key %s" , podMetadata .PodKey )
288283
289284 // lock updatePodCache while reading/modifying or setting the updatePod in the cache
290285 dp .updatePodCache .Lock ()
@@ -333,27 +328,23 @@ func (dp *DataPlane) ApplyDataPlane() error {
333328 newCount := dp .applyInfo .numBatches
334329 dp .applyInfo .Unlock ()
335330
336- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
337- // klog.Infof("[DataPlane] [%s] new batch count: %d", contextApplyDP, newCount)
331+ klog .Infof ("[DataPlane] [%s] new batch count: %d" , contextApplyDP , newCount )
338332
339333 if newCount >= dp .ApplyMaxBatches {
340- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
341- // klog.Infof("[DataPlane] [%s] applying now since reached maximum batch count: %d", contextApplyDP, newCount)
334+ klog .Infof ("[DataPlane] [%s] applying now since reached maximum batch count: %d" , contextApplyDP , newCount )
342335 return dp .applyDataPlaneNow (contextApplyDP )
343336 }
344337
345338 return nil
346339}
347340
348341func (dp * DataPlane ) applyDataPlaneNow (context string ) error {
349- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
350- // klog.Infof("[DataPlane] [ApplyDataPlane] [%s] starting to apply ipsets", context)
342+ klog .Infof ("[DataPlane] [ApplyDataPlane] [%s] starting to apply ipsets" , context )
351343 err := dp .ipsetMgr .ApplyIPSets ()
352344 if err != nil {
353345 return fmt .Errorf ("[DataPlane] [%s] error while applying IPSets: %w" , context , err )
354346 }
355- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
356- // klog.Infof("[DataPlane] [ApplyDataPlane] [%s] finished applying ipsets", context)
347+ klog .Infof ("[DataPlane] [ApplyDataPlane] [%s] finished applying ipsets" , context )
357348
358349 // see comment in RemovePolicy() for why this is here
359350 dp .setRemovePolicyFailure (false )
@@ -374,8 +365,7 @@ func (dp *DataPlane) applyDataPlaneNow(context string) error {
374365 }
375366 dp .updatePodCache .Unlock ()
376367
377- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
378- // klog.Infof("[DataPlane] [ApplyDataPlane] [%s] refreshing endpoints before updating pods", context)
368+ klog .Infof ("[DataPlane] [ApplyDataPlane] [%s] refreshing endpoints before updating pods" , context )
379369
380370 err := dp .refreshPodEndpoints ()
381371 if err != nil {
@@ -384,16 +374,14 @@ func (dp *DataPlane) applyDataPlaneNow(context string) error {
384374 return nil
385375 }
386376
387- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
388- // klog.Infof("[DataPlane] [ApplyDataPlane] [%s] refreshed endpoints", context)
377+ klog .Infof ("[DataPlane] [ApplyDataPlane] [%s] refreshed endpoints" , context )
389378
390379 // lock updatePodCache while driving goal state to kernel
391380 // prevents another ApplyDataplane call from updating the same pods
392381 dp .updatePodCache .Lock ()
393382 defer dp .updatePodCache .Unlock ()
394383
395- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
396- // klog.Infof("[DataPlane] [ApplyDataPlane] [%s] starting to update pods", context)
384+ klog .Infof ("[DataPlane] [ApplyDataPlane] [%s] starting to update pods" , context )
397385 for ! dp .updatePodCache .isEmpty () {
398386 pod := dp .updatePodCache .dequeue ()
399387 if pod == nil {
@@ -411,16 +399,14 @@ func (dp *DataPlane) applyDataPlaneNow(context string) error {
411399 }
412400 }
413401
414- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
415- // klog.Infof("[DataPlane] [ApplyDataPlane] [%s] finished updating pods", context)
402+ klog .Infof ("[DataPlane] [ApplyDataPlane] [%s] finished updating pods" , context )
416403 }
417404 return nil
418405}
419406
420407// AddPolicy takes in a translated NPMNetworkPolicy object and applies on dataplane
421408func (dp * DataPlane ) AddPolicy (policy * policies.NPMNetworkPolicy ) error {
422- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
423- // klog.Infof("[DataPlane] Add Policy called for %s", policy.PolicyKey)
409+ klog .Infof ("[DataPlane] Add Policy called for %s" , policy .PolicyKey )
424410
425411 if ! dp .netPolInBackground {
426412 return dp .addPolicies ([]* policies.NPMNetworkPolicy {policy })
@@ -434,12 +420,10 @@ func (dp *DataPlane) AddPolicy(policy *policies.NPMNetworkPolicy) error {
434420 dp .netPolQueue .enqueue (policy )
435421 newCount := dp .netPolQueue .len ()
436422
437- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
438- // klog.Infof("[DataPlane] [%s] new pending netpol count: %d", contextAddNetPol, newCount)
423+ klog .Infof ("[DataPlane] [%s] new pending netpol count: %d" , contextAddNetPol , newCount )
439424
440425 if newCount >= dp .MaxPendingNetPols {
441- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
442- // klog.Infof("[DataPlane] [%s] applying now since reached maximum batch count: %d", contextAddNetPol, newCount)
426+ klog .Infof ("[DataPlane] [%s] applying now since reached maximum batch count: %d" , contextAddNetPol , newCount )
443427 dp .addPoliciesWithRetry (contextAddNetPol )
444428 }
445429 return nil
@@ -449,14 +433,12 @@ func (dp *DataPlane) AddPolicy(policy *policies.NPMNetworkPolicy) error {
449433// The caller must lock netPolQueue.
450434func (dp * DataPlane ) addPoliciesWithRetry (context string ) {
451435 netPols := dp .netPolQueue .dump ()
452- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
453- // klog.Infof("[DataPlane] adding policies %+v", netPols)
436+ klog .Infof ("[DataPlane] adding policies %+v" , netPols )
454437
455438 err := dp .addPolicies (netPols )
456439 if err == nil {
457440 // clear queue and return on success
458- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
459- // klog.Infof("[DataPlane] [%s] added policies successfully", context)
441+ klog .Infof ("[DataPlane] [%s] added policies successfully" , context )
460442 dp .netPolQueue .clear ()
461443 return
462444 }
@@ -469,8 +451,7 @@ func (dp *DataPlane) addPoliciesWithRetry(context string) {
469451 err = dp .addPolicies ([]* policies.NPMNetworkPolicy {netPol })
470452 if err == nil {
471453 // remove from queue on success
472- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
473- // klog.Infof("[DataPlane] [%s] added policy successfully one at a time. policyKey: %s", context, netPol.PolicyKey)
454+ klog .Infof ("[DataPlane] [%s] added policy successfully one at a time. policyKey: %s" , context , netPol .PolicyKey )
474455 dp .netPolQueue .delete (netPol .PolicyKey )
475456 } else {
476457 // keep in queue on failure
@@ -488,8 +469,7 @@ func (dp *DataPlane) addPolicies(netPols []*policies.NPMNetworkPolicy) error {
488469 }
489470
490471 if len (netPols ) == 0 {
491- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
492- // klog.Infof("[DataPlane] expected to have at least one NetPol in dp.addPolicies()")
472+ klog .Infof ("[DataPlane] expected to have at least one NetPol in dp.addPolicies()" )
493473 return nil
494474 }
495475
@@ -533,8 +513,7 @@ func (dp *DataPlane) addPolicies(netPols []*policies.NPMNetworkPolicy) error {
533513 // Create and add references for Rule IPSets
534514 err = dp .createIPSetsAndReferences (netPol .RuleIPSets , netPol .PolicyKey , ipsets .NetPolType )
535515 if err != nil {
536- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
537- // klog.Infof("[DataPlane] error while adding Rule IPSet references: %s", err.Error())
516+ klog .Infof ("[DataPlane] error while adding Rule IPSet references: %s" , err .Error ())
538517 return fmt .Errorf ("[DataPlane] error while adding Rule IPSet references: %w" , err )
539518 }
540519
@@ -547,18 +526,15 @@ func (dp *DataPlane) addPolicies(netPols []*policies.NPMNetworkPolicy) error {
547526 // increment batch and apply IPSets if needed
548527 dp .applyInfo .numBatches ++
549528 newCount := dp .applyInfo .numBatches
550- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
551- // klog.Infof("[DataPlane] [%s] new batch count: %d", contextAddNetPolBootup, newCount)
529+ klog .Infof ("[DataPlane] [%s] new batch count: %d" , contextAddNetPolBootup , newCount )
552530 if newCount >= dp .ApplyMaxBatches {
553- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
554- // klog.Infof("[DataPlane] [%s] applying now since reached maximum batch count: %d", contextAddNetPolBootup, newCount)
555- // klog.Infof("[DataPlane] [%s] starting to apply ipsets", contextAddNetPolBootup)
531+ klog .Infof ("[DataPlane] [%s] applying now since reached maximum batch count: %d" , contextAddNetPolBootup , newCount )
532+ klog .Infof ("[DataPlane] [%s] starting to apply ipsets" , contextAddNetPolBootup )
556533 err = dp .ipsetMgr .ApplyIPSets ()
557534 if err != nil {
558535 return fmt .Errorf ("[DataPlane] [%s] error while applying IPSets: %w" , contextAddNetPolBootup , err )
559536 }
560- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
561- // klog.Infof("[DataPlane] [%s] finished applying ipsets", contextAddNetPolBootup)
537+ klog .Infof ("[DataPlane] [%s] finished applying ipsets" , contextAddNetPolBootup )
562538
563539 // see comment in RemovePolicy() for why this is here
564540 dp .setRemovePolicyFailure (false )
@@ -598,8 +574,7 @@ func (dp *DataPlane) addPolicies(netPols []*policies.NPMNetworkPolicy) error {
598574
599575// RemovePolicy takes in network policyKey (namespace/name of network policy) and removes it from dataplane and cache
600576func (dp * DataPlane ) RemovePolicy (policyKey string ) error {
601- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
602- // klog.Infof("[DataPlane] Remove Policy called for %s", policyKey)
577+ klog .Infof ("[DataPlane] Remove Policy called for %s" , policyKey )
603578
604579 if dp .netPolInBackground {
605580 // make sure to not add this NetPol if we're deleting it
@@ -675,12 +650,10 @@ func (dp *DataPlane) RemovePolicy(policyKey string) error {
675650// UpdatePolicy takes in updated policy object, calculates the delta and applies changes
676651// onto dataplane accordingly
677652func (dp * DataPlane ) UpdatePolicy (policy * policies.NPMNetworkPolicy ) error {
678- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
679- // klog.Infof("[DataPlane] Update Policy called for %s", policy.PolicyKey)
653+ klog .Infof ("[DataPlane] Update Policy called for %s" , policy .PolicyKey )
680654 ok := dp .policyMgr .PolicyExists (policy .PolicyKey )
681655 if ! ok {
682- // TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
683- // klog.Infof("[DataPlane] Policy %s is not found.", policy.PolicyKey)
656+ klog .Infof ("[DataPlane] Policy %s is not found." , policy .PolicyKey )
684657 return dp .AddPolicy (policy )
685658 }
686659
0 commit comments