Skip to content

Commit

Permalink
fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
rayaisaiah committed Mar 5, 2025
1 parent b72bec7 commit 821c9ef
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 75 deletions.
24 changes: 12 additions & 12 deletions npm/pkg/controlplane/controllers/v2/namespaceController.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ func (nsc *NamespaceController) Run(stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer nsc.workqueue.ShutDown()

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Info("Starting Namespace controller\n")
// klog.Info("Starting workers")
// Launch workers to process namespace resources
go wait.Until(nsc.runWorker, time.Second, stopCh)

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Info("Started workers")
<-stopCh
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Info("Shutting down workers")
}

Expand Down Expand Up @@ -212,7 +212,7 @@ func (nsc *NamespaceController) processNextWorkItem() bool {
// Finally, if no error occurs we Forget this item so it does not
// get queued again until another change happens.
nsc.workqueue.Forget(obj)
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Successfully synced '%s'", key)
return nil
}(obj)
Expand Down Expand Up @@ -325,7 +325,7 @@ func (nsc *NamespaceController) syncAddNamespace(nsObj *corev1.Namespace) error
// Add the namespace to its label's ipset list.
for nsLabelKey, nsLabelVal := range nsObj.ObjectMeta.Labels {
nsLabelKeyValue := util.GetIpSetFromLabelKV(nsLabelKey, nsLabelVal)
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Adding namespace %s to ipset list %s and %s", nsObj.ObjectMeta.Name, nsLabelKey, nsLabelKeyValue)
labelIPSets := []*ipsets.IPSetMetadata{
ipsets.NewIPSetMetadata(nsLabelKey, ipsets.KeyLabelOfNamespace),
Expand All @@ -349,7 +349,7 @@ func (nsc *NamespaceController) syncAddNamespace(nsObj *corev1.Namespace) error
func (nsc *NamespaceController) syncUpdateNamespace(newNsObj *corev1.Namespace) (metrics.OperationKind, error) {
var err error
newNsName, newNsLabel := newNsObj.ObjectMeta.Name, newNsObj.ObjectMeta.Labels
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("NAMESPACE UPDATING:\n namespace: [%s/%v]", newNsName, newNsLabel)

// If previous syncAddNamespace failed for some reasons
Expand Down Expand Up @@ -379,7 +379,7 @@ func (nsc *NamespaceController) syncUpdateNamespace(newNsObj *corev1.Namespace)
}
toBeRemoved := []*ipsets.IPSetMetadata{ipsets.NewIPSetMetadata(newNsName, ipsets.Namespace)}

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Deleting namespace %s from ipset list %s", newNsName, nsLabelVal)
if err = nsc.dp.RemoveFromList(labelSet, toBeRemoved); err != nil {
metrics.SendErrorLogAndMetric(util.NSID, "[UpdateNamespace] Error: failed to delete namespace %s from ipset list %s with err: %v", newNsName, nsLabelVal, err)
Expand All @@ -396,7 +396,7 @@ func (nsc *NamespaceController) syncUpdateNamespace(newNsObj *corev1.Namespace)

// Add the namespace to its label's ipset list.
for _, nsLabelVal := range addToIPSets {
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Adding namespace %s to ipset list %s", newNsName, nsLabelVal)

var labelSet []*ipsets.IPSetMetadata
Expand Down Expand Up @@ -430,13 +430,13 @@ func (nsc *NamespaceController) syncUpdateNamespace(newNsObj *corev1.Namespace)

// cleanDeletedNamespace handles deleting namespace from ipset.
func (nsc *NamespaceController) cleanDeletedNamespace(cachedNsKey string) error {
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("NAMESPACE DELETING: [%s]", cachedNsKey)
cachedNsObj, exists := nsc.npmNamespaceCache.NsMap[cachedNsKey]
if !exists {
return nil
}
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("NAMESPACE DELETING cached labels: [%s/%v]", cachedNsKey, cachedNsObj.LabelsMap)

var err error
Expand All @@ -445,7 +445,7 @@ func (nsc *NamespaceController) cleanDeletedNamespace(cachedNsKey string) error
for nsLabelKey, nsLabelVal := range cachedNsObj.LabelsMap {

labelKey := ipsets.NewIPSetMetadata(nsLabelKey, ipsets.KeyLabelOfNamespace)
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Deleting namespace %s from ipset list %s", cachedNsKey, labelKey)
if err = nsc.dp.RemoveFromList(labelKey, toBeDeletedNs); err != nil {
metrics.SendErrorLogAndMetric(util.NSID, "[DeleteNamespace] Error: failed to delete namespace %s from ipset list %s with err: %v", cachedNsKey, labelKey, err)
Expand All @@ -454,7 +454,7 @@ func (nsc *NamespaceController) cleanDeletedNamespace(cachedNsKey string) error

labelIpsetName := util.GetIpSetFromLabelKV(nsLabelKey, nsLabelVal)
labelKeyValue := ipsets.NewIPSetMetadata(labelIpsetName, ipsets.KeyValueLabelOfNamespace)
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Deleting namespace %s from ipset list %s", cachedNsKey, labelIpsetName)
if err = nsc.dp.RemoveFromList(labelKeyValue, toBeDeletedNs); err != nil {
metrics.SendErrorLogAndMetric(util.NSID, "[DeleteNamespace] Error: failed to delete namespace %s from ipset list %s with err: %v", cachedNsKey, labelIpsetName, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ func (c *NetworkPolicyController) Run(stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer c.workqueue.ShutDown()

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Starting Network Policy worker")
go wait.Until(c.runWorker, time.Second, stopCh)

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Started Network Policy worker")
<-stopCh
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Info("Shutting down Network Policy workers")
}

Expand Down Expand Up @@ -193,7 +193,7 @@ func (c *NetworkPolicyController) processNextWorkItem() bool {
// Finally, if no error occurs we Forget this item so it does not
// get queued again until another change happens.
c.workqueue.Forget(obj)
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Successfully synced '%s'", key)
return nil
}(obj)
Expand Down
38 changes: 19 additions & 19 deletions npm/pkg/controlplane/controllers/v2/podController.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (c *PodController) deletePod(obj interface{}) {
}
}

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("[POD DELETE EVENT] for %s in %s", podObj.Name, podObj.Namespace)
if isHostNetworkPod(podObj) {
return
Expand All @@ -192,14 +192,14 @@ func (c *PodController) Run(stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer c.workqueue.ShutDown()

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Starting Pod worker")
go wait.Until(c.runWorker, time.Second, stopCh)

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Info("Started Pod workers")
<-stopCh
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Info("Shutting down Pod workers")
}

Expand Down Expand Up @@ -238,7 +238,7 @@ func (c *PodController) processNextWorkItem() bool {
// Finally, if no error occurs we Forget this item so it does not
// get queued again until another change happens.
c.workqueue.Forget(obj)
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Successfully synced '%s'", key)
return nil
}(obj)
Expand Down Expand Up @@ -352,7 +352,7 @@ func (c *PodController) syncPod(key string) error {
}

func (c *PodController) syncAddedPod(podObj *corev1.Pod) error {
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("POD CREATING: [%s/%s/%s/%s/%+v/%s]", string(podObj.GetUID()), podObj.Namespace,
// podObj.Name, podObj.Spec.NodeName, podObj.Labels, podObj.Status.PodIP)

Expand All @@ -375,7 +375,7 @@ func (c *PodController) syncAddedPod(podObj *corev1.Pod) error {
namespaceSet := []*ipsets.IPSetMetadata{ipsets.NewIPSetMetadata(podObj.Namespace, ipsets.Namespace)}

// Add the pod ip information into namespace's ipset.
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Adding pod %s (ip : %s) to ipset %s", podKey, podObj.Status.PodIP, podObj.Namespace)
if err = c.dp.AddToSets(namespaceSet, podMetadata); err != nil {
return fmt.Errorf("[syncAddedPod] Error: failed to add pod to namespace ipset with err: %w", err)
Expand All @@ -394,7 +394,7 @@ func (c *PodController) syncAddedPod(podObj *corev1.Pod) error {
targetSetKeyValue := ipsets.NewIPSetMetadata(labelKeyValue, ipsets.KeyValueLabelOfPod)
allSets := []*ipsets.IPSetMetadata{targetSetKey, targetSetKeyValue}

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Creating ipsets %+v and %+v if they do not exist", targetSetKey, targetSetKeyValue)
// klog.Infof("Adding pod %s (ip : %s) to ipset %s and %s", podKey, npmPodObj.PodIP, labelKey, labelKeyValue)
if err = c.dp.AddToSets(allSets, podMetadata); err != nil {
Expand All @@ -404,7 +404,7 @@ func (c *PodController) syncAddedPod(podObj *corev1.Pod) error {
}

// Add pod's named ports from its ipset.
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Adding named port ipsets")
containerPorts := common.GetContainerPortList(podObj)
if err = c.manageNamedPortIpsets(containerPorts, podKey, npmPodObj.PodIP, podObj.Spec.NodeName, addNamedPort); err != nil {
Expand Down Expand Up @@ -439,7 +439,7 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
c.npmNamespaceCache.Unlock()

cachedNpmPod, exists := c.podMap[podKey]
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("[syncAddAndUpdatePod] updating Pod with key %s", podKey)
// No cached npmPod exists. start adding the pod in a cache
if !exists {
Expand All @@ -456,17 +456,17 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
// NPM should clean up existing references of cached pod obj and its IP.
// then, re-add new pod obj.
if cachedNpmPod.PodIP != newPodObj.Status.PodIP {
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Pod (Namespace:%s, Name:%s, newUid:%s), has cachedPodIp:%s which is different from PodIp:%s",
// newPodObj.Namespace, newPodObj.Name, string(newPodObj.UID), cachedNpmPod.PodIP, newPodObj.Status.PodIP)

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Deleting cached Pod with key:%s first due to IP Mistmatch", podKey)
if er := c.cleanUpDeletedPod(podKey); er != nil {
return metrics.UpdateOp, er
}

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Adding back Pod with key:%s after IP Mistmatch", podKey)
return metrics.UpdateOp, c.syncAddedPod(newPodObj)
}
Expand All @@ -481,7 +481,7 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
cachedPodMetadata := dataplane.NewPodMetadata(podKey, cachedNpmPod.PodIP, newPodMetadata.NodeName)
// Delete the pod from its label's ipset.
for _, removeIPSetName := range deleteFromIPSets {
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Deleting pod %s (ip : %s) from ipset %s", podKey, cachedNpmPod.PodIP, removeIPSetName)

var toRemoveSet *ipsets.IPSetMetadata
Expand All @@ -504,7 +504,7 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
// Add the pod to its label's ipset.
for _, addIPSetName := range addToIPSets {

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Creating ipset %s if it doesn't already exist", addIPSetName)

var toAddSet *ipsets.IPSetMetadata
Expand All @@ -514,7 +514,7 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper
toAddSet = ipsets.NewIPSetMetadata(addIPSetName, ipsets.KeyLabelOfPod)
}

// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Adding pod %s (ip : %s) to ipset %s", podKey, newPodObj.Status.PodIP, addIPSetName)
if err = c.dp.AddToSets([]*ipsets.IPSetMetadata{toAddSet}, newPodMetadata); err != nil {
return metrics.UpdateOp, fmt.Errorf("[syncAddAndUpdatePod] Error: failed to add pod to label ipset with err: %w", err)
Expand Down Expand Up @@ -558,7 +558,7 @@ func (c *PodController) syncAddAndUpdatePod(newPodObj *corev1.Pod) (metrics.Oper

// cleanUpDeletedPod cleans up all ipset associated with this pod
func (c *PodController) cleanUpDeletedPod(cachedNpmPodKey string) error {
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("[cleanUpDeletedPod] deleting Pod with key %s", cachedNpmPodKey)
// If cached npmPod does not exist, return nil
cachedNpmPod, exist := c.podMap[cachedNpmPodKey]
Expand All @@ -579,7 +579,7 @@ func (c *PodController) cleanUpDeletedPod(cachedNpmPodKey string) error {
// Get lists of podLabelKey and podLabelKey + podLavelValue ,and then start deleting them from ipsets
for labelKey, labelVal := range cachedNpmPod.Labels {
labelKeyValue := util.GetIpSetFromLabelKV(labelKey, labelVal)
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("Deleting pod %s (ip : %s) from ipsets %s and %s", cachedNpmPodKey, cachedNpmPod.PodIP, labelKey, labelKeyValue)
if err = c.dp.RemoveFromSets(
[]*ipsets.IPSetMetadata{
Expand Down Expand Up @@ -613,7 +613,7 @@ func (c *PodController) manageNamedPortIpsets(portList []corev1.ContainerPort, p
return nil
}
for _, port := range portList {
// TODO: Refactor non-error/warning klogs with Vap and set the following logs to "debug" level
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("port is %+v", port)
if port.Name == "" {
continue
Expand Down
Loading

0 comments on commit 821c9ef

Please sign in to comment.