From 44b49eebf7ca1bee11c9b7dc03deb3ab663e51fb Mon Sep 17 00:00:00 2001 From: beegiik Date: Wed, 8 Jan 2025 12:17:06 +0000 Subject: [PATCH 01/11] WIP --- cmd/legacy/daemon.go | 16 +++++++--- pkg/hubble/common/mocks/mock_types.go | 5 +++ pkg/plugin/conntrack/conntrack_bpfel_x86.o | Bin 0 -> 1912 bytes pkg/plugin/dropreason/kprobe_bpfel_x86.o | Bin 0 -> 24384 bytes pkg/plugin/filter/filter_bpfel_x86.o | Bin 0 -> 2144 bytes pkg/plugin/mock/plugin.go | 29 +++++++++--------- .../packetforward/packetforward_bpfel_x86.o | Bin 0 -> 4504 bytes .../packetparser/packetparser_bpfel_x86.o | Bin 0 -> 55344 bytes 8 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 pkg/hubble/common/mocks/mock_types.go diff --git a/cmd/legacy/daemon.go b/cmd/legacy/daemon.go index 6e06ee73cc..47fdbf1e6e 100644 --- a/cmd/legacy/daemon.go +++ b/cmd/legacy/daemon.go @@ -104,11 +104,12 @@ func (d *Daemon) Start() error { } else { cfg, err = kcfg.GetConfig() if err != nil { - panic(err) + fmt.Println("Falling back to standalone mode") + cfg = nil } } - fmt.Println("api server: ", cfg.Host) + fmt.Println("api server: ", getHost(cfg)) fmt.Println("init logger") zl, err := log.SetupZapLogger(&log.LogOpts{ @@ -122,7 +123,7 @@ func (d *Daemon) Start() error { EnableTelemetry: daemonConfig.EnableTelemetry, }, zap.String("version", buildinfo.Version), - zap.String("apiserver", cfg.Host), + zap.String("apiserver", getHost(cfg)), zap.String("plugins", strings.Join(daemonConfig.EnabledPlugin, `,`)), zap.String("data aggregation level", daemonConfig.DataAggregationLevel.String()), ) @@ -151,7 +152,7 @@ func (d *Daemon) Start() error { mainLogger.Info("telemetry enabled", zap.String("applicationInsightsID", buildinfo.ApplicationInsightsID)) tel, err = telemetry.NewAppInsightsTelemetryClient("retina-agent", map[string]string{ "version": buildinfo.Version, - "apiserver": cfg.Host, + "apiserver": getHost(cfg), "plugins": strings.Join(daemonConfig.EnabledPlugin, `,`), }) if err != nil { @@ -323,3 +324,10 @@ func (d *Daemon) Start() error { mainLogger.Info("Network observability exiting. Till next time!") return nil } + +func getHost(cfg *rest.Config) string { + if cfg != nil { + return cfg.Host + } + return "running in standalone mode" +} diff --git a/pkg/hubble/common/mocks/mock_types.go b/pkg/hubble/common/mocks/mock_types.go new file mode 100644 index 0000000000..aa2b561a19 --- /dev/null +++ b/pkg/hubble/common/mocks/mock_types.go @@ -0,0 +1,5 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: decoder.go + +// Package mocks is a generated GoMock package. +package mocks diff --git a/pkg/plugin/conntrack/conntrack_bpfel_x86.o b/pkg/plugin/conntrack/conntrack_bpfel_x86.o index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b2adc2bab7291553f5f48aeb02930750f5b42b13 100644 GIT binary patch literal 1912 zcmbtVzi-n(6n;qq7$}AEn*}1lfGQNVP*n(ZaEnr@QYEU=r3mS8oJ(WXv5kF6lZg&U zEFd9P2D-2?bm9+yjh%^!iHU`+BYf|Cj#E=6p8DPU-n;kiJ>Olf&+02n+P%IZRj6{N6`Dg zX`l~`V>2hAcYtf)5R3b}k@Bpk$`owuYlY8d9{emvLRJm8!5iS*-wx0>d>8yBIK(=K z;Z4d*{GB#nqfREtkp+7Oe zFG6$D7XUKB-^uhF2K@1M={v)kYmgTx5@KO(ZDB(^Tz*s+>l>?eA;?vtH!HT}fRfl1 zUPR4Av0^ITfBOa6GC3%AA z23tY69grIaXv1;0L`N#8=_rR9Vd#@s?^a}-&K6S*AY&$8ROikmZ(@c4d_8f z>sb1=#q}k<;{Oe|kggxb!ZI`FajX~o>GjW@Y%}=H92I-i7~%Z=qr&e2=NEghO;EOf z#^kr|fY`8#J#j#r2gr*;!GcNih{@h?onVHl`F?)uSh!El&FW|VtMHAj{0^aZfT2vA d{9ELpQ{d&*7LA?u2yDeu_%A1XpHmTHHCyzP3tLHoZ;e^9+ zTl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cCE=FQ#FT}2hgzw805&vd$q0EnFY1r||A*9h0}YWW7t)x@3(@x}&vJS?7{9F6k1)^v4rYxHrnx zsiDA;UI*>}c*&Er z{thQL38c;H*Y^qCm#Ck=Id4|~38`P}Vf|dY!uq-PHmhIn=aZMHpW-}gV-T=T2_Z^NW))_*-OU#kBJ~I)Lj5c=%)dkOhxLVcSnBu7B(3?k-`XhAWktD9%rJgCwmXe6 zQRMvL|L0BXSNm-SFBl@5V|KL7v# literal 0 HcmV?d00001 diff --git a/pkg/plugin/filter/filter_bpfel_x86.o b/pkg/plugin/filter/filter_bpfel_x86.o index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..bf6c879c816f34c58c39471bdebc664f91e53879 100644 GIT binary patch literal 2144 zcmbtVJ8KkC6h6C&W;I4lREUwtfFM!ACL{>45H<^mh$-T$(89@NcQzR^nH^?lL*fI2 zAXwUnji6X*Wf{9ziG@GFA7CL^T4*7x-*@NU$?g~s@gv_ok9*F!=RS7wU}kPMpUa6s zPJYOaWxOIU_w48;rIw@@k(HreEt*?MvLGu%Kb5`xie8bPyvWa1t2LM@`UrD$ZEOFQ zwr}WOXcJEp@z3LnZ#fy%S?{n0c}lMZcfJdQHgnz3t<)4w3ECF=dqKT*69m^zHX)Pw9h0{aQb zb9e>M@tZD7 z*)`u;YCv1J-5`!Uw;`by1YWQtksEt~W7j-Cb|djZr&^6?~Fdab>c1f0UTZyRg1R42o&01z`lD) zUD_v5F!vbBU(ls~Rh>b6cl-q{D7iC?LLF#}M>`59G4`k3O7b?~V{Zia#=U&ho1{*% z9zmT`C6F-od}5~dLdFg=cApd@*H126Y31v)Mc#aJ7acd1J`LYrTebOa@GPZ>M-V%U zkQ=K?vL33)T)8}MPw4gjS4^XT`k-YBo!1{VC*#-0mUiAOct9kmQtJm$E5Sowkn&KZ@PaDfq3{AimCX0eobg^? zEK7)^J@Nb|dmu$@#b;86ve|GNi(=*fR+S2^+uLE+xM=&So=QKC4604~x4bW}Ysn|j@clx)h!uU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?n4A zvRxv566uvlf1lJRkv@s^N~FJ6Y$VbrkzR@P_lS)|`XtgTk(>KvusPBvDZLWG%Il`b zc8T;!q*o$0iHSt|B+@I9{vBc?kv@s^N~Hfrv5`ohM0zFC-!C>2>61vWM7Fa@zeKi6 zq)#Hf66x=g`XtgPkzR@P_lk`~`XtgTk^UaBkw~9JdLM|mR%eURwx=~&db|Z4S z_T#_hEu^>Duq&&%3L&|5lVgUHggCv`=Gf+rOzv`vYg#K3$fbuKna` z+NZW{`?)6VXU?$w$tLY*PSgH|)3pCdZr{$~bnRET{YAb`r1mesX4~&U Date: Wed, 8 Jan 2025 12:39:24 +0000 Subject: [PATCH 02/11] WIP 2 --- cmd/legacy/daemon.go | 131 +++++++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 60 deletions(-) diff --git a/cmd/legacy/daemon.go b/cmd/legacy/daemon.go index 47fdbf1e6e..44d77cdb0e 100644 --- a/cmd/legacy/daemon.go +++ b/cmd/legacy/daemon.go @@ -104,7 +104,7 @@ func (d *Daemon) Start() error { } else { cfg, err = kcfg.GetConfig() if err != nil { - fmt.Println("Falling back to standalone mode") + fmt.Println("KUBECONFIG not set. Falling back to standalone mode") cfg = nil } } @@ -209,36 +209,44 @@ func (d *Daemon) Start() error { } } - mgr, err := crmgr.New(cfg, mgrOption) - if err != nil { - mainLogger.Error("Unable to start manager", zap.Error(err)) - return fmt.Errorf("creating controller-runtime manager: %w", err) - } + // Setup RetinaEndpoint controller. + // TODO(mainred): This is to temporarily create a cache and pubsub for RetinaEndpoint, need to refactor this. + ctx := ctrl.SetupSignalHandler() + ctrl.SetLogger(zapr.NewLogger(zl.Logger.Named("controller-runtime"))) - //+kubebuilder:scaffold:builder + var cl *kubernetes.Clientset + var mgr crmgr.Manager + if cfg != nil { + mgr, err := crmgr.New(cfg, mgrOption) + if err != nil { + mainLogger.Error("Unable to start manager", zap.Error(err)) + return fmt.Errorf("creating controller-runtime manager: %w", err) + } - if healthCheckErr := mgr.AddHealthzCheck("healthz", healthz.Ping); healthCheckErr != nil { - mainLogger.Fatal("Unable to set up health check", zap.Error(healthCheckErr)) - } - if addReadyCheckErr := mgr.AddReadyzCheck("readyz", healthz.Ping); addReadyCheckErr != nil { - mainLogger.Fatal("Unable to set up ready check", zap.Error(addReadyCheckErr)) - } + //+kubebuilder:scaffold:builder + + if healthCheckErr := mgr.AddHealthzCheck("healthz", healthz.Ping); healthCheckErr != nil { + mainLogger.Fatal("Unable to set up health check", zap.Error(healthCheckErr)) + } + if addReadyCheckErr := mgr.AddReadyzCheck("readyz", healthz.Ping); addReadyCheckErr != nil { + mainLogger.Fatal("Unable to set up ready check", zap.Error(addReadyCheckErr)) + } - // k8s Client used for informers - cl := kubernetes.NewForConfigOrDie(mgr.GetConfig()) + // k8s Client used for informers + cl := kubernetes.NewForConfigOrDie(mgr.GetConfig()) - serverVersion, err := cl.Discovery().ServerVersion() - if err != nil { - mainLogger.Error("failed to get Kubernetes server version: ", zap.Error(err)) + serverVersion, err := cl.Discovery().ServerVersion() + if err != nil { + mainLogger.Error("failed to get Kubernetes server version: ", zap.Error(err)) + } else { + mainLogger.Infof("Kubernetes server version: %v", serverVersion) + } } else { - mainLogger.Infof("Kubernetes server version: %v", serverVersion) + cl = nil + mgr = nil + mainLogger.Info("Running in standalone mode. Kubernetes components will be disabled.") } - // Setup RetinaEndpoint controller. - // TODO(mainred): This is to temporarily create a cache and pubsub for RetinaEndpoint, need to refactor this. - ctx := ctrl.SetupSignalHandler() - ctrl.SetLogger(zapr.NewLogger(zl.Logger.Named("controller-runtime"))) - if daemonConfig.EnablePodLevel { pubSub := pubsub.New() controllerCache := controllercache.New(pubSub) @@ -252,48 +260,51 @@ func (d *Daemon) Start() error { enrich.Run() metricsModule := mm.InitModule(ctx, daemonConfig, pubSub, enrich, fm, controllerCache) - if !daemonConfig.RemoteContext { - mainLogger.Info("Initializing Pod controller") - - podController := pc.New(mgr.GetClient(), controllerCache) - if err := podController.SetupWithManager(mgr); err != nil { - mainLogger.Fatal("unable to create PodController", zap.Error(err)) + if cfg != nil { + if !daemonConfig.RemoteContext { + mainLogger.Info("Initializing Pod controller") + + podController := pc.New(mgr.GetClient(), controllerCache) + if err := podController.SetupWithManager(mgr); err != nil { + mainLogger.Fatal("unable to create PodController", zap.Error(err)) + } + } else if daemonConfig.EnableRetinaEndpoint { + mainLogger.Info("RetinaEndpoint is enabled") + mainLogger.Info("Initializing RetinaEndpoint controller") + + retinaEndpointController := kec.New(mgr.GetClient(), controllerCache) + if err := retinaEndpointController.SetupWithManager(mgr); err != nil { + mainLogger.Fatal("unable to create retinaEndpointController", zap.Error(err)) + } } - } else if daemonConfig.EnableRetinaEndpoint { - mainLogger.Info("RetinaEndpoint is enabled") - mainLogger.Info("Initializing RetinaEndpoint controller") - retinaEndpointController := kec.New(mgr.GetClient(), controllerCache) - if err := retinaEndpointController.SetupWithManager(mgr); err != nil { - mainLogger.Fatal("unable to create retinaEndpointController", zap.Error(err)) + mainLogger.Info("Initializing Node controller") + nodeController := nc.New(mgr.GetClient(), controllerCache) + if err := nodeController.SetupWithManager(mgr); err != nil { + mainLogger.Fatal("unable to create nodeController", zap.Error(err)) } - } - - mainLogger.Info("Initializing Node controller") - nodeController := nc.New(mgr.GetClient(), controllerCache) - if err := nodeController.SetupWithManager(mgr); err != nil { - mainLogger.Fatal("unable to create nodeController", zap.Error(err)) - } - - mainLogger.Info("Initializing Service controller") - svcController := sc.New(mgr.GetClient(), controllerCache) - if err := svcController.SetupWithManager(mgr); err != nil { - mainLogger.Fatal("unable to create svcController", zap.Error(err)) - } - if daemonConfig.EnableAnnotations { - mainLogger.Info("Initializing MetricsConfig namespaceController") - namespaceController := namespacecontroller.New(mgr.GetClient(), controllerCache, metricsModule) - if err := namespaceController.SetupWithManager(mgr); err != nil { - mainLogger.Fatal("unable to create namespaceController", zap.Error(err)) + mainLogger.Info("Initializing Service controller") + svcController := sc.New(mgr.GetClient(), controllerCache) + if err := svcController.SetupWithManager(mgr); err != nil { + mainLogger.Fatal("unable to create svcController", zap.Error(err)) } - go namespaceController.Start(ctx) - } else { - mainLogger.Info("Initializing MetricsConfig controller") - metricsConfigController := mcc.New(mgr.GetClient(), mgr.GetScheme(), metricsModule) - if err := metricsConfigController.SetupWithManager(mgr); err != nil { - mainLogger.Fatal("unable to create metricsConfigController", zap.Error(err)) + + if daemonConfig.EnableAnnotations { + mainLogger.Info("Initializing MetricsConfig namespaceController") + namespaceController := namespacecontroller.New(mgr.GetClient(), controllerCache, metricsModule) + if err := namespaceController.SetupWithManager(mgr); err != nil { + mainLogger.Fatal("unable to create namespaceController", zap.Error(err)) + } + go namespaceController.Start(ctx) + } else { + mainLogger.Info("Initializing MetricsConfig controller") + metricsConfigController := mcc.New(mgr.GetClient(), mgr.GetScheme(), metricsModule) + if err := metricsConfigController.SetupWithManager(mgr); err != nil { + mainLogger.Fatal("unable to create metricsConfigController", zap.Error(err)) + } } + } } From 43c6c8c424b1d0ec34f8e415c9dd01fb337005a0 Mon Sep 17 00:00:00 2001 From: beegiik Date: Wed, 8 Jan 2025 12:48:01 +0000 Subject: [PATCH 03/11] WIP 3 --- cmd/legacy/daemon.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/legacy/daemon.go b/cmd/legacy/daemon.go index 44d77cdb0e..848c008a8a 100644 --- a/cmd/legacy/daemon.go +++ b/cmd/legacy/daemon.go @@ -304,7 +304,6 @@ func (d *Daemon) Start() error { mainLogger.Fatal("unable to create metricsConfigController", zap.Error(err)) } } - } } @@ -328,8 +327,10 @@ func (d *Daemon) Start() error { mainLogger.Info("Started controller manager") // Start all registered controllers. This will block until container receives SIGTERM. - if err := mgr.Start(ctx); err != nil { - mainLogger.Fatal("unable to start manager", zap.Error(err)) + if mgr != nil { + if err := mgr.Start(ctx); err != nil { + mainLogger.Fatal("unable to start manager", zap.Error(err)) + } } mainLogger.Info("Network observability exiting. Till next time!") From e077bd933a12559abcff9f04e2b7b663dd9f8e8b Mon Sep 17 00:00:00 2001 From: beegiik Date: Wed, 8 Jan 2025 13:05:45 +0000 Subject: [PATCH 04/11] WIP 4 --- cmd/legacy/daemon.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/legacy/daemon.go b/cmd/legacy/daemon.go index 848c008a8a..44a691720c 100644 --- a/cmd/legacy/daemon.go +++ b/cmd/legacy/daemon.go @@ -327,12 +327,13 @@ func (d *Daemon) Start() error { mainLogger.Info("Started controller manager") // Start all registered controllers. This will block until container receives SIGTERM. - if mgr != nil { - if err := mgr.Start(ctx); err != nil { - mainLogger.Fatal("unable to start manager", zap.Error(err)) - } + if err := mgr.Start(ctx); err != nil { + mainLogger.Fatal("unable to start manager", zap.Error(err)) } + // Block the main thread until the context is canceled (e.g., SIGTERM). + <-ctx.Done() + mainLogger.Info("Network observability exiting. Till next time!") return nil } From 0b24052037f6ed18332a061176d65bf7b85ef13a Mon Sep 17 00:00:00 2001 From: beegiik Date: Thu, 9 Jan 2025 15:25:30 +0000 Subject: [PATCH 05/11] default config attempt --- cmd/legacy/daemon.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cmd/legacy/daemon.go b/cmd/legacy/daemon.go index 44a691720c..70089a49dc 100644 --- a/cmd/legacy/daemon.go +++ b/cmd/legacy/daemon.go @@ -105,11 +105,11 @@ func (d *Daemon) Start() error { cfg, err = kcfg.GetConfig() if err != nil { fmt.Println("KUBECONFIG not set. Falling back to standalone mode") - cfg = nil + cfg = loadStandaloneConfig() } } - fmt.Println("api server: ", getHost(cfg)) + fmt.Println("api server: ", cfg.Host) fmt.Println("init logger") zl, err := log.SetupZapLogger(&log.LogOpts{ @@ -123,7 +123,7 @@ func (d *Daemon) Start() error { EnableTelemetry: daemonConfig.EnableTelemetry, }, zap.String("version", buildinfo.Version), - zap.String("apiserver", getHost(cfg)), + zap.String("apiserver", cfg.Host), zap.String("plugins", strings.Join(daemonConfig.EnabledPlugin, `,`)), zap.String("data aggregation level", daemonConfig.DataAggregationLevel.String()), ) @@ -338,6 +338,17 @@ func (d *Daemon) Start() error { return nil } +func loadStandaloneConfig() *rest.Config { + return &rest.Config{ + Host: "http://localhost:8080", + APIPath: "/api", + ContentConfig: rest.ContentConfig{ + GroupVersion: nil, + NegotiatedSerializer: nil, + }, + } +} + func getHost(cfg *rest.Config) string { if cfg != nil { return cfg.Host From fb5b03b2ba463ee148b042729eb9e4b6e5f1617d Mon Sep 17 00:00:00 2001 From: beegiik Date: Thu, 9 Jan 2025 15:43:35 +0000 Subject: [PATCH 06/11] updated empty config --- cmd/legacy/daemon.go | 51 ++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/cmd/legacy/daemon.go b/cmd/legacy/daemon.go index 70089a49dc..72a379d281 100644 --- a/cmd/legacy/daemon.go +++ b/cmd/legacy/daemon.go @@ -95,7 +95,8 @@ func (d *Daemon) Start() error { fmt.Println("init client-go") var cfg *rest.Config - if kubeconfig := os.Getenv("KUBECONFIG"); kubeconfig != "" { + var kubeconfig = os.Getenv("KUBECONFIG") + if kubeconfig != "" { fmt.Println("KUBECONFIG set, using kubeconfig: ", kubeconfig) cfg, err = clientcmd.BuildConfigFromFlags("", kubeconfig) if err != nil { @@ -152,7 +153,7 @@ func (d *Daemon) Start() error { mainLogger.Info("telemetry enabled", zap.String("applicationInsightsID", buildinfo.ApplicationInsightsID)) tel, err = telemetry.NewAppInsightsTelemetryClient("retina-agent", map[string]string{ "version": buildinfo.Version, - "apiserver": getHost(cfg), + "apiserver": cfg.Host, "plugins": strings.Join(daemonConfig.EnabledPlugin, `,`), }) if err != nil { @@ -214,37 +215,31 @@ func (d *Daemon) Start() error { ctx := ctrl.SetupSignalHandler() ctrl.SetLogger(zapr.NewLogger(zl.Logger.Named("controller-runtime"))) - var cl *kubernetes.Clientset - var mgr crmgr.Manager - if cfg != nil { - mgr, err := crmgr.New(cfg, mgrOption) - if err != nil { - mainLogger.Error("Unable to start manager", zap.Error(err)) - return fmt.Errorf("creating controller-runtime manager: %w", err) - } + mgr, err := crmgr.New(cfg, mgrOption) + if err != nil { + mainLogger.Error("Unable to start manager", zap.Error(err)) + return fmt.Errorf("creating controller-runtime manager: %w", err) + } - //+kubebuilder:scaffold:builder + //+kubebuilder:scaffold:builder - if healthCheckErr := mgr.AddHealthzCheck("healthz", healthz.Ping); healthCheckErr != nil { - mainLogger.Fatal("Unable to set up health check", zap.Error(healthCheckErr)) - } - if addReadyCheckErr := mgr.AddReadyzCheck("readyz", healthz.Ping); addReadyCheckErr != nil { - mainLogger.Fatal("Unable to set up ready check", zap.Error(addReadyCheckErr)) - } + if healthCheckErr := mgr.AddHealthzCheck("healthz", healthz.Ping); healthCheckErr != nil { + mainLogger.Fatal("Unable to set up health check", zap.Error(healthCheckErr)) + } + if addReadyCheckErr := mgr.AddReadyzCheck("readyz", healthz.Ping); addReadyCheckErr != nil { + mainLogger.Fatal("Unable to set up ready check", zap.Error(addReadyCheckErr)) + } - // k8s Client used for informers - cl := kubernetes.NewForConfigOrDie(mgr.GetConfig()) + // k8s Client used for informers + cl := kubernetes.NewForConfigOrDie(mgr.GetConfig()) + if kubeconfig != "" { serverVersion, err := cl.Discovery().ServerVersion() if err != nil { mainLogger.Error("failed to get Kubernetes server version: ", zap.Error(err)) } else { mainLogger.Infof("Kubernetes server version: %v", serverVersion) } - } else { - cl = nil - mgr = nil - mainLogger.Info("Running in standalone mode. Kubernetes components will be disabled.") } if daemonConfig.EnablePodLevel { @@ -331,9 +326,6 @@ func (d *Daemon) Start() error { mainLogger.Fatal("unable to start manager", zap.Error(err)) } - // Block the main thread until the context is canceled (e.g., SIGTERM). - <-ctx.Done() - mainLogger.Info("Network observability exiting. Till next time!") return nil } @@ -348,10 +340,3 @@ func loadStandaloneConfig() *rest.Config { }, } } - -func getHost(cfg *rest.Config) string { - if cfg != nil { - return cfg.Host - } - return "running in standalone mode" -} From 151b0402cabf7f0c3d84ee726a5cde3edb9bed58 Mon Sep 17 00:00:00 2001 From: beegiik Date: Thu, 9 Jan 2025 17:14:40 +0000 Subject: [PATCH 07/11] add reading stateile logic --- pkg/enricher/enricher.go | 21 +++++ pkg/plugin/hnsstats/hnsstats_windows.go | 117 ++++++++++++++++++++++++ pkg/plugin/hnsstats/types_windows.go | 16 ++++ pkg/utils/attr_utils.go | 5 + 4 files changed, 159 insertions(+) diff --git a/pkg/enricher/enricher.go b/pkg/enricher/enricher.go index 98013cd2ca..86b193b3bd 100644 --- a/pkg/enricher/enricher.go +++ b/pkg/enricher/enricher.go @@ -14,6 +14,7 @@ import ( "github.com/microsoft/retina/pkg/common" "github.com/microsoft/retina/pkg/controllers/cache" "github.com/microsoft/retina/pkg/log" + "github.com/microsoft/retina/pkg/utils" "go.uber.org/zap" ) @@ -186,6 +187,26 @@ func (e *Enricher) Write(ev *v1.Event) { e.inputRing.Write(ev) } +func (e *Enricher) GetWindowLabels(ip string) *utils.LabelsInfo { + obj := e.cache.GetObjByIP(ip) + if obj == nil { + e.l.Debug("No object found for IP", zap.String("ip", ip)) + return nil + } + + switch o := obj.(type) { + case *common.RetinaEndpoint: + return &utils.LabelsInfo{ + Namespace: o.Namespace(), + PodName: o.Name(), + } + + default: + e.l.Debug("received unknown type from cache", zap.Any("obj", obj), zap.Any("type", reflect.TypeOf(obj))) + return nil + } +} + func (e *Enricher) ExportReader() *container.RingReader { return container.NewRingReader(e.outputRing, e.outputRing.OldestWrite()) } diff --git a/pkg/plugin/hnsstats/hnsstats_windows.go b/pkg/plugin/hnsstats/hnsstats_windows.go index a668dce4f9..994b9410e4 100644 --- a/pkg/plugin/hnsstats/hnsstats_windows.go +++ b/pkg/plugin/hnsstats/hnsstats_windows.go @@ -7,19 +7,27 @@ package hnsstats import ( "context" "encoding/json" + "fmt" + "os" "time" "github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim/hcn" v1 "github.com/cilium/cilium/pkg/hubble/api/v1" kcfg "github.com/microsoft/retina/pkg/config" + "github.com/microsoft/retina/pkg/exporter" "github.com/microsoft/retina/pkg/log" "github.com/microsoft/retina/pkg/metrics" "github.com/microsoft/retina/pkg/plugin/registry" "github.com/microsoft/retina/pkg/utils" + "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" ) +var ( + AdvWindowsGauge *prometheus.GaugeVec +) + const ( initialize = iota + 1 start @@ -85,6 +93,11 @@ func (h *hnsstats) Init() error { } h.endpointQuery.Filter = string(filter) + if h.cfg.EnablePodLevel { + h.l.Info("Creating advanced HNS stats metrics") + initializeAdvMetrics() + } + h.l.Info("Exiting hnsstats Init...") return nil } @@ -144,6 +157,7 @@ func pullHnsStats(ctx context.Context, h *hnsstats) error { if vfpcounters, err := parseVfpPortCounters(countersRaw); err == nil { // Attach VFP port counters hnsStatsData.vfpCounters = vfpcounters + hnsStatsData.Port = portguid h.l.Debug("Attached VFP port counters", zap.String(zapPortField, portguid)) // h.l.Info(vfpcounters.String()) } else { @@ -154,6 +168,7 @@ func pullHnsStats(ctx context.Context, h *hnsstats) error { } notifyHnsStats(h, hnsStatsData) + getAdvancedMetricLabels(h, hnsStatsData) } } } @@ -208,12 +223,114 @@ func notifyHnsStats(h *hnsstats, stats *HnsStatsData) { metrics.TCPFlagGauge.WithLabelValues(egressLabel, utils.RST).Set(float64(stats.vfpCounters.Out.TcpCounters.PacketCounters.RstPacketCount)) } +func getAdvancedMetricLabels(h *hnsstats, stats *HnsStatsData) { + if AdvWindowsGauge == nil { + h.l.Warn("Advanced windows metric is not initialized") + return + } + // if port is populated, vfp data exists + // labels := enricher.Instance().GetWindowLabels(stats.IPAddress) + labels, err := getStandaloneLabels(stats.IPAddress) + + if err != nil { + AdvWindowsGauge.WithLabelValues(PacketsReceived, stats.IPAddress, stats.Port, labels.Namespace, labels.PodName).Set(float64(stats.hnscounters.PacketsReceived)) + AdvWindowsGauge.WithLabelValues(PacketsSent, stats.IPAddress, stats.Port, labels.Namespace, labels.PodName).Set(float64(stats.hnscounters.PacketsSent)) + h.l.Info("updating advanced HNS stats metric", zap.String(PodName, labels.PodName), zap.String(Namespace, labels.Namespace)) + } +} + func (h *hnsstats) Start(ctx context.Context) error { h.l.Info("Start hnsstats plugin...") h.state = start return pullHnsStats(ctx, h) } +func cleanAdvMetrics() { + exporter.UnregisterMetric(exporter.AdvancedRegistry, metrics.ToPrometheusType(AdvWindowsGauge)) +} + +func initializeAdvMetrics() { + if AdvWindowsGauge != nil { + cleanAdvMetrics() + } + AdvWindowsGauge = exporter.CreatePrometheusGaugeVecForMetric( + exporter.AdvancedRegistry, + AdvHNSStatsName, + AdvHNSStatsDescription, + utils.Direction, + Ip, + Port, + Namespace, + PodName, + WorkloadKind, + WorkloadName, + ) +} + +type Endpoint struct { + ID string `json:"Id"` + IPAddresses []IPInfo `json:"IPAddresses"` + PODName string `json:"PODName"` + PODNameSpace string `json:"PODNameSpace"` +} + +type IPInfo struct { + IP string `json:"IP"` +} + +type Network struct { + ExternalInterfaces map[string]ExternalInterface `json:"ExternalInterfaces"` +} + +type ExternalInterface struct { + Networks map[string]NetworkInfo `json:"Networks"` +} + +type NetworkInfo struct { + Endpoints map[string]Endpoint `json:"Endpoints"` +} + +func getStandaloneLabels(ip string) (*utils.LabelsInfo, error) { + file, err := os.Open("C:/k/azure-vnet.json") + if err != nil { + return &utils.LabelsInfo{ + Namespace: "", + PodName: "", + }, fmt.Errorf("failed to open file: %w", err) + } + defer file.Close() + + // Decode JSON + var network Network + if err := json.NewDecoder(file).Decode(&network); err != nil { + return &utils.LabelsInfo{ + Namespace: "", + PodName: "", + }, fmt.Errorf("failed to decode JSON: %w", err) + } + + // Search for the IP in Endpoints + for _, iface := range network.ExternalInterfaces { + for _, network := range iface.Networks { + for _, endpoint := range network.Endpoints { + for _, ipAddr := range endpoint.IPAddresses { + if ipAddr.IP == ip { + return &utils.LabelsInfo{ + Namespace: endpoint.PODNameSpace, + PodName: endpoint.PODName, + }, nil + } + } + } + } + } + + return &utils.LabelsInfo{ + Namespace: "", + PodName: "", + }, fmt.Errorf("IP address not found") +} + func (d *hnsstats) Stop() error { d.l.Info("Entered hnsstats Stop...") if d.state != start { diff --git a/pkg/plugin/hnsstats/types_windows.go b/pkg/plugin/hnsstats/types_windows.go index ab8511d5d3..5eed46d257 100644 --- a/pkg/plugin/hnsstats/types_windows.go +++ b/pkg/plugin/hnsstats/types_windows.go @@ -10,6 +10,7 @@ import ( "github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim/hcn" kcfg "github.com/microsoft/retina/pkg/config" + "github.com/microsoft/retina/pkg/enricher" "github.com/microsoft/retina/pkg/log" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" @@ -20,6 +21,19 @@ import ( const ( name string = "hnsstats" HnsStatsEvent string = "hnsstatscount" + + // Advanced metric + AdvHNSStatsName string = "adv_windows_hns_stats" + AdvHNSStatsDescription string = "Include many different metrics from packets sent/received to closed connections" + + // Advanced metric labels + Ip string = "ip" + Port string = "port" + Namespace string = "namespace" + PodName string = "podname" + WorkloadKind string = "workload_kind" + WorkloadName string = "workload_name" + // From HNSStats API PacketsReceived string = "win_packets_recv_count" PacketsSent string = "win_packets_sent_count" @@ -73,12 +87,14 @@ type hnsstats struct { state int l *log.ZapLogger endpointQuery hcn.HostComputeQuery + enricher enricher.EnricherInterface } type HnsStatsData struct { hnscounters *hcsshim.HNSEndpointStats IPAddress string vfpCounters *VfpPortStatsData + Port string } // handles event signals such as incrementing a metric counter diff --git a/pkg/utils/attr_utils.go b/pkg/utils/attr_utils.go index 6826db74c9..4bac0a0d7c 100644 --- a/pkg/utils/attr_utils.go +++ b/pkg/utils/attr_utils.go @@ -87,6 +87,11 @@ var ( DNSResponseLabels = []string{"return_code", "query_type", "query", "response", "num_response"} ) +type LabelsInfo struct { + Namespace string + PodName string +} + func GetPluginEventAttributes(attrs []attribute.KeyValue, pluginName, eventName, timestamp string) []attribute.KeyValue { return append(attrs, pluginKey.String(pluginName), From 0d96602bec772799097c415742cdb503344eb0ee Mon Sep 17 00:00:00 2001 From: beegiik Date: Tue, 14 Jan 2025 11:31:18 +0000 Subject: [PATCH 08/11] WIP adding logs --- pkg/plugin/hnsstats/hnsstats_windows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/plugin/hnsstats/hnsstats_windows.go b/pkg/plugin/hnsstats/hnsstats_windows.go index 994b9410e4..ff595b63e3 100644 --- a/pkg/plugin/hnsstats/hnsstats_windows.go +++ b/pkg/plugin/hnsstats/hnsstats_windows.go @@ -230,7 +230,10 @@ func getAdvancedMetricLabels(h *hnsstats, stats *HnsStatsData) { } // if port is populated, vfp data exists // labels := enricher.Instance().GetWindowLabels(stats.IPAddress) + h.l.Info("New standalone feature") + labels, err := getStandaloneLabels(stats.IPAddress) + h.l.Info("Reading fields from CNI state file", zap.String(Ip, stats.IPAddress), zap.String(PodName, labels.PodName), zap.String(Namespace, labels.Namespace)) if err != nil { AdvWindowsGauge.WithLabelValues(PacketsReceived, stats.IPAddress, stats.Port, labels.Namespace, labels.PodName).Set(float64(stats.hnscounters.PacketsReceived)) @@ -262,8 +265,6 @@ func initializeAdvMetrics() { Port, Namespace, PodName, - WorkloadKind, - WorkloadName, ) } @@ -300,7 +301,6 @@ func getStandaloneLabels(ip string) (*utils.LabelsInfo, error) { } defer file.Close() - // Decode JSON var network Network if err := json.NewDecoder(file).Decode(&network); err != nil { return &utils.LabelsInfo{ From da431ac36f1fb06e40c8febf208c16c3922a2eb4 Mon Sep 17 00:00:00 2001 From: beegiik Date: Tue, 14 Jan 2025 11:59:03 +0000 Subject: [PATCH 09/11] WIP more logging --- cmd/legacy/daemon.go | 2 ++ pkg/managers/pluginmanager/pluginmanager.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cmd/legacy/daemon.go b/cmd/legacy/daemon.go index 72a379d281..fe6e17a07d 100644 --- a/cmd/legacy/daemon.go +++ b/cmd/legacy/daemon.go @@ -89,6 +89,8 @@ func (d *Daemon) Start() error { } daemonConfig, err := config.GetConfig(d.configFile) + fmt.Printf("config %+v\n", daemonConfig) + if err != nil { panic(err) } diff --git a/pkg/managers/pluginmanager/pluginmanager.go b/pkg/managers/pluginmanager/pluginmanager.go index 15d133382f..3e952e4344 100644 --- a/pkg/managers/pluginmanager/pluginmanager.go +++ b/pkg/managers/pluginmanager/pluginmanager.go @@ -59,6 +59,8 @@ func NewPluginManager(cfg *kcfg.Config, tel telemetry.Telemetry) (*PluginManager } for _, name := range cfg.EnabledPlugin { + fmt.Printf("Enabled plugins : %+v\n", name) + newPluginFn, ok := plugin.Get(name) if !ok { return nil, fmt.Errorf("plugin %s not found in registry", name) From 84cc18b9839b22d759f7ef6d6e1958c2cb370e5d Mon Sep 17 00:00:00 2001 From: beegiik Date: Thu, 16 Jan 2025 11:43:31 +0000 Subject: [PATCH 10/11] troubleshooting windows command --- pkg/plugin/hnsstats/hnsstats_windows.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/plugin/hnsstats/hnsstats_windows.go b/pkg/plugin/hnsstats/hnsstats_windows.go index ff595b63e3..a60309f992 100644 --- a/pkg/plugin/hnsstats/hnsstats_windows.go +++ b/pkg/plugin/hnsstats/hnsstats_windows.go @@ -93,10 +93,10 @@ func (h *hnsstats) Init() error { } h.endpointQuery.Filter = string(filter) - if h.cfg.EnablePodLevel { - h.l.Info("Creating advanced HNS stats metrics") - initializeAdvMetrics() - } + // if h.cfg.EnablePodLevel { + h.l.Info("Creating advanced HNS stats metrics") + initializeAdvMetrics() + // } h.l.Info("Exiting hnsstats Init...") return nil From 8813eecf8c698e85504f3852242570136dbbe025 Mon Sep 17 00:00:00 2001 From: beegiik Date: Mon, 20 Jan 2025 10:01:47 +0000 Subject: [PATCH 11/11] winpod --- winpod.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 winpod.yaml diff --git a/winpod.yaml b/winpod.yaml new file mode 100644 index 0000000000..1234d3db78 --- /dev/null +++ b/winpod.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: privileged-daemonset + namespace: kube-system + labels: + app: privileged-daemonset +spec: + selector: + matchLabels: + app: privileged-daemonset + template: + metadata: + labels: + app: privileged-daemonset + spec: + nodeSelector: + kubernetes.io/os: windows + securityContext: + windowsOptions: + hostProcess: true + runAsUserName: "NT AUTHORITY\\SYSTEM" + hostNetwork: true + containers: + - name: powershell + image: mcr.microsoft.com/powershell:lts-nanoserver-1809 # or lts-nanoserver-ltsc2022 + command: + - powershell.exe + - -Command + - Start-Sleep -Seconds 2147483 + terminationGracePeriodSeconds: 0