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

Report FQDN on host.name as opt-in, enabled by feature flag #2218

Merged
merged 101 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from 98 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
d03e0c7
wip
AndersonQ Feb 1, 2023
c5710c7
wip
AndersonQ Feb 2, 2023
2df1efd
wip
AndersonQ Feb 6, 2023
1d5c033
clean up
AndersonQ Feb 6, 2023
bf0e6b4
wip
AndersonQ Feb 10, 2023
8fefdf0
.
AndersonQ Feb 10, 2023
19a34bd
agent.name as fqdn
AndersonQ Feb 10, 2023
531a6a2
it works
AndersonQ Feb 10, 2023
2ea30e1
wip
AndersonQ Feb 13, 2023
dc8e84b
WIP - using fake input, created test, it seems to work
AndersonQ Feb 16, 2023
d5e1da8
finish test for feature flags
AndersonQ Feb 20, 2023
02c2c40
remove debug log
AndersonQ Feb 20, 2023
305fe9d
some clean up
AndersonQ Feb 20, 2023
eb980ad
mage check
AndersonQ Feb 21, 2023
a4988c6
fixing licenses
AndersonQ Feb 21, 2023
e2bd0c0
it works
AndersonQ Feb 22, 2023
17566eb
it works
AndersonQ Feb 24, 2023
acd6366
remove debug logs and comments
AndersonQ Feb 24, 2023
131a673
make notice
AndersonQ Feb 24, 2023
f613e1c
fake component and shipper are built by TestMain
AndersonQ Feb 24, 2023
9403d59
fixing tests
AndersonQ Feb 27, 2023
818f8c5
make notice
AndersonQ Feb 27, 2023
25df625
adjust tests
AndersonQ Feb 27, 2023
1952d4d
update elatic-agent-client
AndersonQ Feb 27, 2023
e4b0c9e
add .exe for win binaries
AndersonQ Feb 27, 2023
4ef7cd4
adjust fake components build
AndersonQ Feb 27, 2023
d0eca67
increase test timeout
AndersonQ Feb 28, 2023
f205b97
fix tests
AndersonQ Feb 28, 2023
213f9f6
adjust features pkg and don't send featuresFlag if nil
AndersonQ Mar 1, 2023
2682c34
it works
AndersonQ Mar 1, 2023
43d759f
make notice
AndersonQ Mar 1, 2023
2e5fcc2
revert some changes
AndersonQ Mar 1, 2023
5e4fd01
handle error properly
AndersonQ Mar 1, 2023
424075a
add TODO
AndersonQ Mar 2, 2023
748e2cd
Set FQDN for Vagrant elastic-agent VM
ycombinator Mar 9, 2023
e563f48
Undoing trivial formatting changes
ycombinator Mar 9, 2023
89d7912
Running mage fmt
ycombinator Mar 10, 2023
97d1332
Remove personal repo from NOTICE overrides
ycombinator Mar 10, 2023
7052991
Sorting imports
ycombinator Mar 10, 2023
d58f3d5
Fix error handling
ycombinator Mar 10, 2023
0ab90dc
Fixing access
ycombinator Mar 10, 2023
2abb79e
Fixing packaging of fake component
ycombinator Mar 10, 2023
370a065
Update logging
ycombinator Mar 10, 2023
6189367
Refactoring fake component
ycombinator Mar 10, 2023
4752fbe
Allowing fmt.Print* in TestMain
ycombinator Mar 10, 2023
2ec765c
Remove redundant return
ycombinator Mar 10, 2023
4a56161
Fixing typo in error message
ycombinator Mar 10, 2023
1974e4c
Undo unintentional changes
ycombinator Mar 20, 2023
141343c
Removing redundant TestMain file
ycombinator Mar 20, 2023
c10e22b
Add comment on FQDN to Vagrantfile
ycombinator Mar 20, 2023
6ebcb73
Remove debug logging statements
ycombinator Mar 20, 2023
7e01483
Making test pass
ycombinator Mar 21, 2023
2734619
Document feature flags configuration in reference config file
ycombinator Mar 21, 2023
01ab5a5
Adding CHANGELOG entry
ycombinator Mar 21, 2023
5ef5e06
Use convenience method
ycombinator Mar 21, 2023
9c03356
Formatting
ycombinator Mar 21, 2023
b2be47a
Use convenience method from elastic-agent-libs
ycombinator Mar 21, 2023
9d75525
Running mage update
ycombinator Mar 21, 2023
c401ea9
Fixing imports
ycombinator Mar 27, 2023
62a74ef
Reducing whitespace changes
ycombinator Mar 27, 2023
a175026
Reducing whitespace changes
ycombinator Mar 27, 2023
21ac963
Reducing whitespace changes
ycombinator Mar 27, 2023
a036065
Reducing whitespace changes
ycombinator Mar 27, 2023
4369e36
Restore timeout duration
ycombinator Mar 27, 2023
7edccc1
Move mutex inside struct
ycombinator Mar 27, 2023
542dd29
Prevent mutex copying
ycombinator Mar 27, 2023
cfcf6a9
Fixing state diagnostics test
ycombinator Mar 27, 2023
4a6db74
Fixing components diagnostics test
ycombinator Mar 27, 2023
ad0397a
Adding features.source to components golden file
ycombinator Mar 27, 2023
3707faa
More interesting diagnostics state test
ycombinator Mar 28, 2023
ec61ecb
Log error if FQDN lookup fails and fallback to OS-reported hostname
ycombinator Mar 28, 2023
fed6644
Bump up go-sysinfo dependency version
ycombinator Mar 28, 2023
d1fe608
Fix typos
ycombinator Mar 28, 2023
49a425a
Fixing compile errors
ycombinator Mar 28, 2023
1c656b1
Fix tests
ycombinator Mar 29, 2023
38d8fee
Fix imports
ycombinator Mar 29, 2023
c7acb4e
Fix issues lost in rebase
ycombinator Mar 29, 2023
cf2f10a
Fixing more imports
ycombinator Mar 29, 2023
00eebb7
Updating NOTICE.txt
ycombinator Mar 29, 2023
d2af128
Clarify features indentation
ycombinator Mar 30, 2023
b335ece
Remove replace directive
ycombinator Mar 30, 2023
d243a30
Bumping up version on elastic-agent-client dependency
ycombinator Mar 30, 2023
d206184
Adding test mocking DNS
ycombinator Mar 30, 2023
8f91e04
Initialize featuresIdx in same place as units' configIdx
ycombinator Mar 30, 2023
d012135
Updating NOTICE.txt
ycombinator Mar 30, 2023
74215ad
Remove unnecessary nil check
ycombinator Mar 30, 2023
766f2a3
Set features in state initially
ycombinator Mar 31, 2023
f3e5ca2
Update features in state from checkin observed message
ycombinator Mar 31, 2023
9eb46b7
Remove TODO
ycombinator Mar 31, 2023
81a4329
Updating elatic-agent.yml test fixture to enable FQDN feature flag
ycombinator Mar 31, 2023
663dc15
Try flipping the authoritative flag
ycombinator Mar 31, 2023
2b96bda
Remove unreliable DNS mocking test
ycombinator Mar 31, 2023
ef4bbc0
Set source
ycombinator Mar 31, 2023
e2aed94
Update test fixture
ycombinator Apr 1, 2023
16ad140
Change logger
ycombinator Apr 2, 2023
922543e
Fixing test case
ycombinator Apr 2, 2023
ef24d66
Omit feature flags serialization from state.yaml diag file
ycombinator Apr 3, 2023
0c65cea
Updating NOTICE.txt
ycombinator Apr 3, 2023
55972b0
Add descriptive comment on why Features is not being serialized as YAML
ycombinator Apr 3, 2023
ecabe78
Updating test fixture
ycombinator Apr 3, 2023
3187211
Inject logger into metadata methods
ycombinator Apr 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
319 changes: 94 additions & 225 deletions NOTICE.txt

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ Vagrant.configure("2") do |config|
config.vm.define "dev" do |nodeconfig|
nodeconfig.vm.box = "ubuntu/jammy64"

nodeconfig.vm.hostname = "elastic-agent-dev"
# We deliberately set a fully-qualified domain name for the VM; it helps
# test the FQDN feature flag.
nodeconfig.vm.hostname = "elastic-agent-dev.elastic.dev.internal"

nodeconfig.vm.network "private_network",
hostname: true,
Expand Down
7 changes: 7 additions & 0 deletions _meta/config/common.reference.p2.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ inputs:
# # period define how frequent we should look for changes in the configuration.
# period: 10s

# Feature Flags

# This section enables or disables feature flags supported by Agent and its components.
#agent.features:
# fqdn:
# enabled: false

# Logging

# There are four options for the log output: file, stderr, syslog, eventlog
Expand Down
34 changes: 34 additions & 0 deletions changelog/fragments/1679422558-feature-flags.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: feature

# Change summary; a 80ish characters long description of the change.
summary: feature-flags

# Long description; in case the summary is not enough to describe the change
# this field accommodate a description without length limits.
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
description: |
Add support for feature flags, starting with one to toggle FQDN reporting in
events generated by Agent components, via the `host.name` field.

# Affected component; a word indicating the component this changeset affects.
component: agent

# PR URL; optional; the PR number that added the changeset.
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
# Please provide it if you are adding a fragment for a different PR.
pr: https://github.com/elastic/elastic-agent/pull/2218

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
issue: https://github.com/elastic/elastic-agent/issues/2185
7 changes: 7 additions & 0 deletions elastic-agent.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ inputs:
# # period define how frequent we should look for changes in the configuration.
# period: 10s

# Feature Flags

# This section enables or disables feature flags supported by Agent and its components.
#agent.features:
# fqdn:
# enabled: false

# Logging

# There are four options for the log output: file, stderr, syslog, eventlog
Expand Down
25 changes: 12 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ module github.com/elastic/elastic-agent
go 1.19

require (
github.com/Microsoft/go-winio v0.5.2
github.com/Microsoft/go-winio v0.6.0
github.com/antlr/antlr4 v0.0.0-20200820155224-be881fa6b91d
github.com/billgraziano/dpapi v0.4.0
github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2
github.com/cavaliercoder/go-rpm v0.0.0-20190131055624-7a9c54e3d83e
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534
github.com/docker/go-units v0.4.0
github.com/docker/go-units v0.5.0
github.com/dolmen-go/contextio v0.0.0-20200217195037-68fc5150bcd5
github.com/elastic/e2e-testing v1.99.2-0.20221205111528-ade3c840d0c0
github.com/elastic/elastic-agent-autodiscover v0.2.1
github.com/elastic/elastic-agent-client/v7 v7.0.2-0.20221129150247-15881a8e64ef
github.com/elastic/elastic-agent-client/v7 v7.0.3-0.20230315204017-166fd1fd746f
github.com/elastic/elastic-agent-libs v0.3.6
github.com/elastic/elastic-agent-system-metrics v0.4.4
github.com/elastic/elastic-agent-system-metrics v0.4.6-0.20230308003052-ba171438211e
github.com/elastic/go-licenser v0.4.0
github.com/elastic/go-sysinfo v1.8.1
github.com/elastic/go-sysinfo v1.9.1-0.20230328042007-6dcfe88b8359
github.com/elastic/go-ucfg v0.8.6
github.com/gofrs/flock v0.8.1
github.com/gofrs/uuid v4.2.0+incompatible
github.com/google/go-cmp v0.5.6
github.com/google/go-cmp v0.5.9
github.com/gorilla/mux v1.8.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95
Expand All @@ -38,7 +38,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.27.0
github.com/shirou/gopsutil/v3 v3.21.12
github.com/sirupsen/logrus v1.8.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.3.0
github.com/stretchr/testify v1.8.2
github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b
Expand All @@ -48,8 +48,8 @@ require (
go.uber.org/zap v1.21.0
golang.org/x/crypto v0.5.0
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sys v0.4.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.6.0
golang.org/x/text v0.7.0
golang.org/x/time v0.3.0
golang.org/x/tools v0.1.12
Expand All @@ -69,12 +69,11 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/cavaliercoder/badio v0.0.0-20160213150051-ce5280129e9e // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/containerd/containerd v1.5.13 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dnephin/pflag v1.0.7 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.12+incompatible // indirect
github.com/docker/docker v20.10.22+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/elastic/go-structform v0.0.9 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
Expand Down Expand Up @@ -111,9 +110,10 @@ require (
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/santhosh-tekuri/jsonschema v1.2.4 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.9 // indirect
Expand All @@ -129,7 +129,6 @@ require (
golang.org/x/net v0.5.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/term v0.4.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220426171045-31bebdecfb46 // indirect
google.golang.org/grpc/examples v0.0.0-20220304170021-431ea809a767 // indirect
Expand Down