From 06e3773b22e6f5cfe72091c7fe8678e49827bdd5 Mon Sep 17 00:00:00 2001 From: yanggang Date: Thu, 7 Sep 2023 11:04:49 +0800 Subject: [PATCH] Fix node-agent missing metrics-addr parms to define the server start. Signed-off-by: yanggang --- changelogs/unreleased/7098-yanggangtony | 1 + pkg/cmd/cli/nodeagent/server.go | 18 ++++++++++-------- pkg/install/daemonset.go | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 changelogs/unreleased/7098-yanggangtony diff --git a/changelogs/unreleased/7098-yanggangtony b/changelogs/unreleased/7098-yanggangtony new file mode 100644 index 0000000000..8d63d94a18 --- /dev/null +++ b/changelogs/unreleased/7098-yanggangtony @@ -0,0 +1 @@ +Fix the node-agent missing metrics-address defines. \ No newline at end of file diff --git a/pkg/cmd/cli/nodeagent/server.go b/pkg/cmd/cli/nodeagent/server.go index 10df06f89e..105e370524 100644 --- a/pkg/cmd/cli/nodeagent/server.go +++ b/pkg/cmd/cli/nodeagent/server.go @@ -114,6 +114,7 @@ func NewServerCommand(f client.Factory) *cobra.Command { command.Flags().Var(formatFlag, "log-format", fmt.Sprintf("The format for log output. Valid values are %s.", strings.Join(formatFlag.AllowedValues(), ", "))) command.Flags().DurationVar(&config.resourceTimeout, "resource-timeout", config.resourceTimeout, "How long to wait for resource processes which are not covered by other specific timeout parameters. Default is 10 minutes.") command.Flags().DurationVar(&config.dataMoverPrepareTimeout, "data-mover-prepare-timeout", config.dataMoverPrepareTimeout, "How long to wait for preparing a DataUpload/DataDownload. Default is 30 minutes.") + command.Flags().StringVar(&config.metricsAddress, "metrics-address", config.metricsAddress, "The address to expose prometheus metrics") return command } @@ -193,14 +194,15 @@ func newNodeAgentServer(logger logrus.FieldLogger, factory client.Factory, confi } s := &nodeAgentServer{ - logger: logger, - ctx: ctx, - cancelFunc: cancelFunc, - fileSystem: filesystem.NewFileSystem(), - mgr: mgr, - config: config, - namespace: factory.Namespace(), - nodeName: nodeName, + logger: logger, + ctx: ctx, + cancelFunc: cancelFunc, + fileSystem: filesystem.NewFileSystem(), + mgr: mgr, + config: config, + namespace: factory.Namespace(), + nodeName: nodeName, + metricsAddress: config.metricsAddress, } // the cache isn't initialized yet when "validatePodVolumesHostPath" is called, the client returned by the manager cannot diff --git a/pkg/install/daemonset.go b/pkg/install/daemonset.go index 8e74e16da1..17580f05d6 100644 --- a/pkg/install/daemonset.go +++ b/pkg/install/daemonset.go @@ -105,6 +105,7 @@ func DaemonSet(namespace string, opts ...podTemplateOption) *appsv1.DaemonSet { { Name: "node-agent", Image: c.image, + Ports: containerPorts(), ImagePullPolicy: pullPolicy, Command: []string{ "/velero",