Remove configauth
default, use nil in configgrpc
default
#12271
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The
configauth.NewDefaultAuthentication
returns a zero-initializedAuthentication
value (link), which is used inconfiggrpc.NewDefaultClientConfig
(link) andconfiggrpc.NewDefaultServerConfig
(link). However, this default value is problematic, as it will cause the Collector to crash on startup with the errorError: cannot start pipelines: failed to resolve authenticator "": authenticator not found
.There is no way for the
Authentication
struct to represent "no authentication" (which is presumably the intended default). Theconfiggrpc
code uses anil
*Authentication
pointer to represent that case (link).Regarding the use of these APIs:
configauth.NewDefaultAuthentication
is not used outside ofconfiggrpc
.configgrpc.NewDefaultServerConfig
on Github, andconfiggrpc.NewDefaultClientConfig
has one use in the Elastic OTel components repo, although I suspect theAuth
field may get overriden anyway, so the crash may never actually occur.ClientConfig
/ServerConfig
manually instead of using those functions, leaving theAuth
fieldnil
, which is why the crash does not occur there either.Description
This PR:
configauth.NewDefaultAuthentication
since there doesn't seem to be a useful "default" value for this struct. Because it doesn't seem to be used outside this repo, I decided to skip the deprecation step.configgrpc.NewDefaultClient/NewDefaultServerConfig
bynil
. I think this would be considered a bug fix rather than a breaking change, since the current value causes an error if not overriden.Link to tracking issue
Resolves #12223 (the original issue was about making the function signature more consistent, but removing the function entirely makes it no longer an issue I would say)
Testing
I experimentally confirmed that the above crash occurs with default config if we change the OTLP receiver's
createDefaultConfig
to useconfiggrpc.NewDefaultServerConfig
, and that the above fix to said function prevents the crash.