From 62508f90afc48cf5f92b998170923fc795512563 Mon Sep 17 00:00:00 2001 From: Maxime Riaud Date: Thu, 20 Feb 2025 18:00:38 +0100 Subject: [PATCH] migrate all agent start command to use createorfetch auth impl --- cmd/dogstatsd/subcommands/start/command.go | 2 +- cmd/otel-agent/subcommands/run/command.go | 6 +++--- cmd/process-agent/command/main_common.go | 4 ++-- cmd/security-agent/main_windows.go | 4 ++-- cmd/security-agent/subcommands/start/command.go | 4 ++-- cmd/trace-agent/subcommands/run/command.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/dogstatsd/subcommands/start/command.go b/cmd/dogstatsd/subcommands/start/command.go index 6c229a6fb04033..69f9de262f4c66 100644 --- a/cmd/dogstatsd/subcommands/start/command.go +++ b/cmd/dogstatsd/subcommands/start/command.go @@ -20,7 +20,7 @@ import ( "github.com/DataDog/datadog-agent/cmd/agent/common" "github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer" "github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer/demultiplexerimpl" - authtokenimpl "github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl" + authtokenimpl "github.com/DataDog/datadog-agent/comp/api/authtoken/createandfetchimpl" "github.com/DataDog/datadog-agent/comp/core/config" healthprobe "github.com/DataDog/datadog-agent/comp/core/healthprobe/def" healthprobefx "github.com/DataDog/datadog-agent/comp/core/healthprobe/fx" diff --git a/cmd/otel-agent/subcommands/run/command.go b/cmd/otel-agent/subcommands/run/command.go index 347e38f312ab03..9efffae33d1e36 100644 --- a/cmd/otel-agent/subcommands/run/command.go +++ b/cmd/otel-agent/subcommands/run/command.go @@ -18,7 +18,7 @@ import ( "github.com/DataDog/datadog-agent/cmd/agent/common" agentConfig "github.com/DataDog/datadog-agent/cmd/otel-agent/config" "github.com/DataDog/datadog-agent/cmd/otel-agent/subcommands" - "github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl" + "github.com/DataDog/datadog-agent/comp/api/authtoken/createandfetchimpl" coreconfig "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/configsync" "github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl" @@ -113,7 +113,7 @@ func runOTelAgentCommand(ctx context.Context, params *subcommands.GlobalParams, return log.ForDaemon(params.LoggerName, "log_file", pkgconfigsetup.DefaultOTelAgentLogFile) }), logfx.Module(), - fetchonlyimpl.Module(), + createandfetchimpl.Module(), configsyncimpl.Module(configsyncimpl.NewParams(params.SyncTimeout, true, params.SyncOnInitTimeout)), converterfx.Module(), fx.Provide(func(cp converter.Component, _ configsync.Component) confmap.Converter { @@ -135,7 +135,7 @@ func runOTelAgentCommand(ctx context.Context, params *subcommands.GlobalParams, fx.Provide(func(client *metricsclient.StatsdClientWrapper) statsd.Component { return statsd.NewOTelStatsd(client) }), - fetchonlyimpl.Module(), + createandfetchimpl.Module(), collectorfx.Module(), collectorcontribFx.Module(), converterfx.Module(), diff --git a/cmd/process-agent/command/main_common.go b/cmd/process-agent/command/main_common.go index 2510bd55b6eace..d3a69559bd2d3e 100644 --- a/cmd/process-agent/command/main_common.go +++ b/cmd/process-agent/command/main_common.go @@ -16,7 +16,7 @@ import ( "github.com/DataDog/datadog-agent/cmd/agent/common/misconfig" "github.com/DataDog/datadog-agent/comp/agent/autoexit" "github.com/DataDog/datadog-agent/comp/agent/autoexit/autoexitimpl" - "github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl" + "github.com/DataDog/datadog-agent/comp/api/authtoken/createandfetchimpl" "github.com/DataDog/datadog-agent/comp/core" "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl" @@ -151,7 +151,7 @@ func runApp(ctx context.Context, globalParams *GlobalParams) error { compstatsd.Module(), // Provide authtoken module - fetchonlyimpl.Module(), + createandfetchimpl.Module(), // Provide configsync module configsyncimpl.Module(configsyncimpl.NewDefaultParams()), diff --git a/cmd/security-agent/main_windows.go b/cmd/security-agent/main_windows.go index f06b917705267b..c0ce1ae9b47663 100644 --- a/cmd/security-agent/main_windows.go +++ b/cmd/security-agent/main_windows.go @@ -26,7 +26,7 @@ import ( "github.com/DataDog/datadog-agent/comp/agent/autoexit" "github.com/DataDog/datadog-agent/comp/agent/autoexit/autoexitimpl" "github.com/DataDog/datadog-agent/comp/api/authtoken" - "github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl" + "github.com/DataDog/datadog-agent/comp/api/authtoken/createandfetchimpl" "github.com/DataDog/datadog-agent/comp/core" "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl" @@ -165,7 +165,7 @@ func (s *service) Run(svcctx context.Context) error { statusimpl.Module(), - fetchonlyimpl.Module(), + createandfetchimpl.Module(), configsyncimpl.Module(configsyncimpl.NewDefaultParams()), autoexitimpl.Module(), fx.Provide(func(c config.Component) settings.Params { diff --git a/cmd/security-agent/subcommands/start/command.go b/cmd/security-agent/subcommands/start/command.go index 982375fac643a4..db7e1f5fa34d73 100644 --- a/cmd/security-agent/subcommands/start/command.go +++ b/cmd/security-agent/subcommands/start/command.go @@ -30,7 +30,7 @@ import ( "github.com/DataDog/datadog-agent/comp/agent/autoexit" "github.com/DataDog/datadog-agent/comp/agent/autoexit/autoexitimpl" "github.com/DataDog/datadog-agent/comp/api/authtoken" - "github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl" + "github.com/DataDog/datadog-agent/comp/api/authtoken/createandfetchimpl" "github.com/DataDog/datadog-agent/comp/core" "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl" @@ -173,7 +173,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command { }) }), statusimpl.Module(), - fetchonlyimpl.Module(), + createandfetchimpl.Module(), configsyncimpl.Module(configsyncimpl.NewDefaultParams()), autoexitimpl.Module(), fx.Supply(pidimpl.NewParams(params.pidfilePath)), diff --git a/cmd/trace-agent/subcommands/run/command.go b/cmd/trace-agent/subcommands/run/command.go index 4df84a00f7a232..09f3c0894e1f91 100644 --- a/cmd/trace-agent/subcommands/run/command.go +++ b/cmd/trace-agent/subcommands/run/command.go @@ -17,7 +17,7 @@ import ( "github.com/DataDog/datadog-agent/cmd/trace-agent/subcommands" "github.com/DataDog/datadog-agent/comp/agent/autoexit" "github.com/DataDog/datadog-agent/comp/agent/autoexit/autoexitimpl" - "github.com/DataDog/datadog-agent/comp/api/authtoken/fetchonlyimpl" + "github.com/DataDog/datadog-agent/comp/api/authtoken/createandfetchimpl" coreconfig "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/configsync/configsyncimpl" log "github.com/DataDog/datadog-agent/comp/core/log/def" @@ -111,7 +111,7 @@ func runTraceAgentProcess(ctx context.Context, cliParams *Params, defaultConfPat }), zstdfx.Module(), trace.Bundle(), - fetchonlyimpl.Module(), + createandfetchimpl.Module(), configsyncimpl.Module(configsyncimpl.NewDefaultParams()), // Force the instantiation of the components fx.Invoke(func(_ traceagent.Component, _ autoexit.Component) {}),