@@ -170,6 +170,8 @@ func (c *PodController) deletePod(obj interface{}) {
170170 }
171171 }
172172
173+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
174+ // klog.Infof("[POD DELETE EVENT] for %s in %s", podObj.Name, podObj.Namespace)
173175 if isHostNetworkPod (podObj ) {
174176 return
175177 }
@@ -190,9 +192,15 @@ func (c *PodController) Run(stopCh <-chan struct{}) {
190192 defer utilruntime .HandleCrash ()
191193 defer c .workqueue .ShutDown ()
192194
195+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
196+ // klog.Infof("Starting Pod worker")
193197 go wait .Until (c .runWorker , time .Second , stopCh )
194198
199+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
200+ // klog.Info("Started Pod workers")
195201 <- stopCh
202+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
203+ // klog.Info("Shutting down Pod workers")
196204}
197205
198206func (c * PodController ) runWorker () {
@@ -230,6 +238,8 @@ func (c *PodController) processNextWorkItem() bool {
230238 // Finally, if no error occurs we Forget this item so it does not
231239 // get queued again until another change happens.
232240 c .workqueue .Forget (obj )
241+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
242+ // klog.Infof("Successfully synced '%s'", key)
233243 return nil
234244 }(obj )
235245 if err != nil {
@@ -342,6 +352,10 @@ func (c *PodController) syncPod(key string) error {
342352}
343353
344354func (c * PodController ) syncAddedPod (podObj * corev1.Pod ) error {
355+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
356+ // klog.Infof("POD CREATING: [%s/%s/%s/%s/%+v/%s]", string(podObj.GetUID()), podObj.Namespace,
357+ // podObj.Name, podObj.Spec.NodeName, podObj.Labels, podObj.Status.PodIP)
358+
345359 if ! util .IsIPV4 (podObj .Status .PodIP ) {
346360 msg := fmt .Sprintf ("[syncAddedPod] warning: ADD POD [%s/%s/%s/%+v] ignored as the PodIP is not valid ipv4 address. ip: [%s]" , podObj .Namespace ,
347361 podObj .Name , podObj .Spec .NodeName , podObj .Labels , podObj .Status .PodIP )
@@ -361,6 +375,8 @@ func (c *PodController) syncAddedPod(podObj *corev1.Pod) error {
361375 namespaceSet := []* ipsets.IPSetMetadata {ipsets .NewIPSetMetadata (podObj .Namespace , ipsets .Namespace )}
362376
363377 // Add the pod ip information into namespace's ipset.
378+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
379+ // klog.Infof("Adding pod %s (ip : %s) to ipset %s", podKey, podObj.Status.PodIP, podObj.Namespace)
364380 if err = c .dp .AddToSets (namespaceSet , podMetadata ); err != nil {
365381 return fmt .Errorf ("[syncAddedPod] Error: failed to add pod to namespace ipset with err: %w" , err )
366382 }
@@ -378,13 +394,18 @@ func (c *PodController) syncAddedPod(podObj *corev1.Pod) error {
378394 targetSetKeyValue := ipsets .NewIPSetMetadata (labelKeyValue , ipsets .KeyValueLabelOfPod )
379395 allSets := []* ipsets.IPSetMetadata {targetSetKey , targetSetKeyValue }
380396
397+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
398+ // klog.Infof("Creating ipsets %+v and %+v if they do not exist", targetSetKey, targetSetKeyValue)
399+ // klog.Infof("Adding pod %s (ip : %s) to ipset %s and %s", podKey, npmPodObj.PodIP, labelKey, labelKeyValue)
381400 if err = c .dp .AddToSets (allSets , podMetadata ); err != nil {
382401 return fmt .Errorf ("[syncAddedPod] Error: failed to add pod to label ipset with err: %w" , err )
383402 }
384403 npmPodObj .AppendLabels (map [string ]string {labelKey : labelVal }, common .AppendToExistingLabels )
385404 }
386405
387406 // Add pod's named ports from its ipset.
407+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
408+ // klog.Infof("Adding named port ipsets")
388409 containerPorts := common .GetContainerPortList (podObj )
389410 if err = c .manageNamedPortIpsets (containerPorts , podKey , npmPodObj .PodIP , podObj .Spec .NodeName , addNamedPort ); err != nil {
390411 return fmt .Errorf ("[syncAddedPod] Error: failed to add pod to named port ipset with err: %w" , err )
@@ -418,6 +439,8 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
418439 c .npmNamespaceCache .Unlock ()
419440
420441 cachedNpmPod , exists := c .podMap [podKey ]
442+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
443+ // klog.Infof("[syncAddAndUpdatePod] updating Pod with key %s", podKey)
421444 // No cached npmPod exists. start adding the pod in a cache
422445 if ! exists {
423446 return metrics .CreateOp , c .syncAddedPod (newPodObj )
@@ -433,11 +456,18 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
433456 // NPM should clean up existing references of cached pod obj and its IP.
434457 // then, re-add new pod obj.
435458 if cachedNpmPod .PodIP != newPodObj .Status .PodIP {
459+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
460+ // klog.Infof("Pod (Namespace:%s, Name:%s, newUid:%s), has cachedPodIp:%s which is different from PodIp:%s",
461+ // newPodObj.Namespace, newPodObj.Name, string(newPodObj.UID), cachedNpmPod.PodIP, newPodObj.Status.PodIP)
436462
463+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
464+ // klog.Infof("Deleting cached Pod with key:%s first due to IP Mistmatch", podKey)
437465 if er := c .cleanUpDeletedPod (podKey ); er != nil {
438466 return metrics .UpdateOp , er
439467 }
440468
469+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
470+ // klog.Infof("Adding back Pod with key:%s after IP Mistmatch", podKey)
441471 return metrics .UpdateOp , c .syncAddedPod (newPodObj )
442472 }
443473
@@ -451,6 +481,8 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
451481 cachedPodMetadata := dataplane .NewPodMetadata (podKey , cachedNpmPod .PodIP , newPodMetadata .NodeName )
452482 // Delete the pod from its label's ipset.
453483 for _ , removeIPSetName := range deleteFromIPSets {
484+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
485+ // klog.Infof("Deleting pod %s (ip : %s) from ipset %s", podKey, cachedNpmPod.PodIP, removeIPSetName)
454486
455487 var toRemoveSet * ipsets.IPSetMetadata
456488 if util .IsKeyValueLabelSetName (removeIPSetName ) {
@@ -472,13 +504,18 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
472504 // Add the pod to its label's ipset.
473505 for _ , addIPSetName := range addToIPSets {
474506
507+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
508+ // klog.Infof("Creating ipset %s if it doesn't already exist", addIPSetName)
509+
475510 var toAddSet * ipsets.IPSetMetadata
476511 if util .IsKeyValueLabelSetName (addIPSetName ) {
477512 toAddSet = ipsets .NewIPSetMetadata (addIPSetName , ipsets .KeyValueLabelOfPod )
478513 } else {
479514 toAddSet = ipsets .NewIPSetMetadata (addIPSetName , ipsets .KeyLabelOfPod )
480515 }
481516
517+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
518+ // klog.Infof("Adding pod %s (ip : %s) to ipset %s", podKey, newPodObj.Status.PodIP, addIPSetName)
482519 if err = c .dp .AddToSets ([]* ipsets.IPSetMetadata {toAddSet }, newPodMetadata ); err != nil {
483520 return metrics .UpdateOp , fmt .Errorf ("[syncAddAndUpdatePod] Error: failed to add pod to label ipset with err: %w" , err )
484521 }
@@ -521,6 +558,8 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
521558
522559// cleanUpDeletedPod cleans up all ipset associated with this pod
523560func (c * PodController ) cleanUpDeletedPod (cachedNpmPodKey string ) error {
561+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
562+ // klog.Infof("[cleanUpDeletedPod] deleting Pod with key %s", cachedNpmPodKey)
524563 // If cached npmPod does not exist, return nil
525564 cachedNpmPod , exist := c .podMap [cachedNpmPodKey ]
526565 if ! exist {
@@ -540,6 +579,8 @@ func (c *PodController) cleanUpDeletedPod(cachedNpmPodKey string) error {
540579 // Get lists of podLabelKey and podLabelKey + podLavelValue ,and then start deleting them from ipsets
541580 for labelKey , labelVal := range cachedNpmPod .Labels {
542581 labelKeyValue := util .GetIpSetFromLabelKV (labelKey , labelVal )
582+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
583+ // klog.Infof("Deleting pod %s (ip : %s) from ipsets %s and %s", cachedNpmPodKey, cachedNpmPod.PodIP, labelKey, labelKeyValue)
543584 if err = c .dp .RemoveFromSets (
544585 []* ipsets.IPSetMetadata {
545586 ipsets .NewIPSetMetadata (labelKey , ipsets .KeyLabelOfPod ),
@@ -572,6 +613,8 @@ func (c *PodController) manageNamedPortIpsets(portList []corev1.ContainerPort, p
572613 return nil
573614 }
574615 for _ , port := range portList {
616+ // TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
617+ // klog.Infof("port is %+v", port)
575618 if port .Name == "" {
576619 continue
577620 }
0 commit comments