Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize CreateAndFetch authToken implementation #33797

Draft
wants to merge 3 commits into
base: misteriaud/ASCII-2580-fix-race-condition-in-auth-token-creation
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/dogstatsd/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions cmd/otel-agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions cmd/process-agent/command/main_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()),
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-agent/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions cmd/security-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)),
Expand Down
2 changes: 1 addition & 1 deletion cmd/systray/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"golang.org/x/sys/windows"

"github.com/DataDog/datadog-agent/comp/aggregator/diagnosesendermanager/diagnosesendermanagerimpl"
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/collector/collector"
"github.com/DataDog/datadog-agent/comp/core"
noopAutodiscover "github.com/DataDog/datadog-agent/comp/core/autodiscovery/noopimpl"
Expand Down
4 changes: 2 additions & 2 deletions cmd/trace-agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {}),
Expand Down
Loading