-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Beats] Adding support for elastic-agent-autodiscovery v0.6.13 Introduce log message for not supported annotations #38213
Changes from 10 commits
6dba856
39b32e9
8c08dff
51728af
4009d15
6985610
e023e50
4661676
3e1e1fb
edb7c3a
3542df5
7d2c429
0e00df6
382ef5f
24b07fb
9a5ad55
bce8fc7
9decff6
e161254
0a40b85
2e6ad5f
142f1ac
dbd20e5
2d19a40
1c10c37
55451c6
e159e75
097b7ea
08f3c60
bf441cf
92c266b
05d71ef
95f30aa
ea50b00
f3b6f21
58da62a
e3ca45d
6e282d0
e0c255d
8ae7814
58f476f
63131b2
14815b2
7954069
7bfd450
7b5a9bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12313,11 +12313,11 @@ various licenses: | |
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/elastic/elastic-agent-autodiscover | ||
Version: v0.6.7 | ||
Version: v0.6.9 | ||
Licence type (autodetected): Apache-2.0 | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].7/LICENSE: | ||
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].9/LICENSE: | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,8 @@ | |
"github.com/elastic/elastic-agent-libs/logp" | ||
) | ||
|
||
var AllSupportedHints = []string{"enabled", "module", "metricsets", "host", "period", "timeout", "metricspath", "username", "password", "stream", "processors", "multiline", "json", "disable", "ssl", "metrics_filters", "raw", "include_lines", "exclude_lines", "fileset", "pipeline"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does where Also as I understand it is a merged list for the metricbeat and for the filebeat, correct? can you please add a comment for that? Is there any way to split it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed metricspath to metrics_path ! Nice catch, thanks Tania! Disable comes from this: https://github.com/elastic/elastic-agent-autodiscover/blob/7490558445cb8d3248462255edc8ac64bc18b8eb/utils/hints_test.go#L177 I have added a comment in 7d2c429 Currently we parse annotations based on the fact that start with the prefix (L209) and then we split with "/" symbol (L215) |
||
|
||
// Config for kubernetes autodiscover provider | ||
type Config struct { | ||
KubeConfig string `config:"kube_config"` | ||
|
@@ -57,7 +59,7 @@ | |
AddResourceMetadata *metadata.AddResourceMetadataConfig `config:"add_resource_metadata"` | ||
} | ||
|
||
// Public variable, so specific beats (as Filebeat) can set a different cleanup timeout if they need it. | ||
var DefaultCleanupTimeout time.Duration = 0 | ||
|
||
func defaultConfig() *Config { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,13 @@ | |
e["port"] = port | ||
} | ||
|
||
hints := utils.GenerateHints(annotations, "", s.config.Prefix) | ||
hints, incorrecthints := utils.GenerateHints(annotations, "", s.config.Prefix, AllSupportedHints) | ||
//We check whether the provided annotation follows the supported format and vocabulary. The check happens for annotations that have prefix co.elastic | ||
gizas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if len(incorrecthints) > 0 { | ||
for _, value := range incorrecthints { | ||
s.logger.Warnf("provided hint: %s/%s is not in the supported list", s.config.Prefix, value) | ||
} | ||
} | ||
s.logger.Debugf("Generated hints %+v", hints) | ||
|
||
if len(hints) != 0 { | ||
|
@@ -220,7 +226,7 @@ | |
} | ||
} | ||
|
||
var events []bus.Event | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was done in order to remove: |
||
for _, port := range svc.Spec.Ports { | ||
event := bus.Event{ | ||
"provider": s.uuid, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't know we call
GenerateHints
here. Looking on this use case, wondering if it wouldn't be a better option to introduce additionally smth likeGenerateHintsWithValidation
instead - maybe we should consider it in future for cases when signature is changedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here
GenerateHints
will actually return all hints as incorrect but we just ignore them. I think we should make it more clear. Maybe add a bool (validate
), which is then checked in GenerateHintsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: elastic/elastic-agent-autodiscover#89