From ca263f309a95b5f1cb7d28dc7c6836545dd56b04 Mon Sep 17 00:00:00 2001 From: Tomoki Sugiura Date: Fri, 2 Aug 2024 15:44:06 +0900 Subject: [PATCH] Add info logs to egress Signed-off-by: Tomoki Sugiura --- v2/cmd/coil-egress/sub/run.go | 6 ++++-- v2/controllers/pod_watcher.go | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/v2/cmd/coil-egress/sub/run.go b/v2/cmd/coil-egress/sub/run.go index ec7195a7..9845d2ca 100644 --- a/v2/cmd/coil-egress/sub/run.go +++ b/v2/cmd/coil-egress/sub/run.go @@ -2,7 +2,6 @@ package sub import ( "errors" - "fmt" "net" "os" "strings" @@ -89,21 +88,24 @@ func subMain() error { return err } + setupLog.Info("initialize FoU tunnel", "port", config.port, "ipv4", ipv4.String(), "ipv6", ipv6.String()) ft := founat.NewFoUTunnel(config.port, ipv4, ipv6, nil) if err := ft.Init(); err != nil { return err } + setupLog.Info("initialize Egress", "ipv4", ipv4.String(), "ipv6", ipv6.String()) eg := founat.NewEgress("eth0", ipv4, ipv6) if err := eg.Init(); err != nil { return err } + setupLog.Info("setup Pod watcher") if err := controllers.SetupPodWatcher(mgr, myNS, myName, ft, config.enableSportAuto, eg, nil); err != nil { return err } - setupLog.Info(fmt.Sprintf("starting manager (version: %s)", v2.Version())) + setupLog.Info("starting manager", "version", v2.Version()) if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { setupLog.Error(err, "problem running manager") return err diff --git a/v2/controllers/pod_watcher.go b/v2/controllers/pod_watcher.go index 61a3d588..71bd8649 100644 --- a/v2/controllers/pod_watcher.go +++ b/v2/controllers/pod_watcher.go @@ -188,6 +188,8 @@ func (r *podWatcher) addPod(pod *corev1.Pod, logger logr.Logger) error { r.mu.Lock() defer r.mu.Unlock() + logger.Info("add pod", "pod", pod.Name, "namespace", pod.Namespace) + key := pod.Namespace + "/" + pod.Name existing := r.podAddrs[key] podIPs := make([]net.IP, len(pod.Status.PodIPs))