From e6350d3d45096030f43b4d38d768291a56d2214c Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Mon, 28 Feb 2022 16:52:30 +0000 Subject: [PATCH 1/2] monitor: Fix build options Removed redundant and duplicated build options to build `kata-monitor` the same way as the other components: - `CGO_ENABLED=0` is not necessary. - `-buildmode=exe` is not necessary since `BUILDFLAGS` already sets the build mode. Signed-off-by: James O. D. Hunt --- src/runtime/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/Makefile b/src/runtime/Makefile index 73805741ed..9446c1dc12 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -552,8 +552,8 @@ $(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && go build -ldflags "$(KATA_LDFLAGS)" $(BUILDFLAGS) -o $@ .) $(MONITOR_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) .git-commit - $(QUIET_BUILD)(cd $(MONITOR_DIR)/ && CGO_ENABLED=0 go build \ - --ldflags "-X main.GitCommit=$(shell cat .git-commit)" $(BUILDFLAGS) -buildmode=exe -o $@ .) + $(QUIET_BUILD)(cd $(MONITOR_DIR)/ && go build \ + --ldflags "-X main.GitCommit=$(shell cat .git-commit)" $(BUILDFLAGS) -o $@ .) .PHONY: \ check \ From e64c54a2ad766d034a853b4a23e0b8f39d5a8d4c Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Mon, 28 Feb 2022 17:15:31 +0000 Subject: [PATCH 2/2] monitor: Listen to localhost only by default Change `kata-monitor` to listen to port `8090` on the local interface only by default. > **Note:** > > This is a breaking change as previously it listened on all interfaces. Fixes: #3795. Signed-off-by: James O. D. Hunt --- src/runtime/cmd/kata-monitor/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/cmd/kata-monitor/main.go b/src/runtime/cmd/kata-monitor/main.go index c0001cdc2f..a3fc86cfd5 100644 --- a/src/runtime/cmd/kata-monitor/main.go +++ b/src/runtime/cmd/kata-monitor/main.go @@ -18,7 +18,9 @@ import ( "github.com/sirupsen/logrus" ) -var monitorListenAddr = flag.String("listen-address", ":8090", "The address to listen on for HTTP requests.") +const defaultListenAddress = "127.0.0.1:8090" + +var monitorListenAddr = flag.String("listen-address", defaultListenAddress, "The address to listen on for HTTP requests.") var runtimeEndpoint = flag.String("runtime-endpoint", "/run/containerd/containerd.sock", `Endpoint of CRI container runtime service. (default: "/run/containerd/containerd.sock")`) var logLevel = flag.String("log-level", "info", "Log level of logrus(trace/debug/info/warn/error/fatal/panic).")