Skip to content

Commit 1d14235

Browse files
mergify[bot]ycombinatorclaude
authored
[OpAMP] enable OpAMP endpoint by default (#6657) (#6662)
* feat: enable OpAMP feature flag by default Set EnableOpAMP to true in InitDefaults() so the OpAMP endpoint is enabled out of the box without requiring explicit configuration. * test: update config test to use defaultServer() for input-config case Replace the manually built Server struct with defaultServer() plus overrides so it picks up the new EnableOpAMP default. Remove unused helpers (defaultServerBulk, defaultServerGC, defaultPBKDF2). * test: clarify feature flag test case names Rename test cases to "explicitly disabled/enabled" to reflect that the flag now defaults to true. * docs: update reference config to reflect OpAMP enabled by default * docs: update OpAMP setup guide for default-enabled flag The feature flag is now enabled by default, so the docs now explain how to disable it rather than how to enable it. * e2e: remove redundant enable_opamp flag from OpAMP test template The flag now defaults to true, so explicitly setting it is unnecessary. * changelog: add fragment for OpAMP feature flag default change * chore: fix gofmt formatting in config_test.go --------- (cherry picked from commit fee63f0) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6294ce4 commit 1d14235

File tree

7 files changed

+64
-59
lines changed

7 files changed

+64
-59
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# REQUIRED
2+
# Kind can be one of:
3+
# - breaking-change: a change to previously-documented behavior
4+
# - deprecation: functionality that is being removed in a later release
5+
# - bug-fix: fixes a problem in a previous version
6+
# - enhancement: extends functionality but does not break or fix existing behavior
7+
# - feature: new functionality
8+
# - known-issue: problems that we are aware of in a given version
9+
# - security: impacts on the security of a product or a user’s deployment.
10+
# - upgrade: important information for someone upgrading from a prior version
11+
# - other: does not fit into any of the other categories
12+
kind: enhancement
13+
14+
# REQUIRED for all kinds
15+
# Change summary; a 80ish characters long description of the change.
16+
summary: Enable OpAMP feature flag by default
17+
18+
# REQUIRED for breaking-change, deprecation, known-issue
19+
# Long description; in case the summary is not enough to describe the change
20+
# this field accommodate a description without length limits.
21+
# description:
22+
23+
# REQUIRED for breaking-change, deprecation, known-issue
24+
# impact:
25+
26+
# REQUIRED for breaking-change, deprecation, known-issue
27+
# action:
28+
29+
# REQUIRED for all kinds
30+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
31+
component: fleet-server
32+
33+
# AUTOMATED
34+
# OPTIONAL to manually add other PR URLs
35+
# PR URL: A link the PR that added the changeset.
36+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
37+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
38+
# Please provide it if you are adding a fragment for a different PR.
39+
# pr: https://github.com/owner/repo/1234
40+
41+
# AUTOMATED
42+
# OPTIONAL to manually add other issue URLs
43+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
44+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
45+
# issue: https://github.com/owner/repo/1234

docs/opamp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ This section describes how to connect a OpenTelemetry Collector instance to Flee
99
```
1010
POST /_security/service/elastic/fleet-server/credential/token/opamp
1111
```
12-
3. Enable the OpAMP feature flag in the `fleet-server.yml` file by adding the following snippet to the `fleet-server` input
12+
3. The OpAMP endpoint is enabled by default. If you need to disable it, add the following to the `fleet-server` input
1313
section, as a sibling of the `policy.id` key:
1414
```yml
1515
server:
1616
feature_flags:
17-
enable_opamp: true
17+
enable_opamp: false
1818
```
1919
2020
4. Build the Fleet Server binary for your platform.

fleet-server.reference.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ fleet:
277277
# // POLICY_CHANGE actions need an explicit ack if this is set.
278278
# ignore_checkin_policy_id: false
279279
#
280-
# // enable OpAMP endpoint
281-
# enable_opamp: false
280+
# // enable OpAMP endpoint (enabled by default)
281+
# enable_opamp: true
282282
#
283283
# # monitor options are advanced configuration and should not be adjusted is most cases
284284
# monitor:

internal/pkg/api/handleOpAMP_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ func TestFeatureFlag(t *testing.T) {
1616
FeatureFlagEnabled bool
1717
WantEnabled bool
1818
}{
19-
"feature flag is disabled": {
19+
"feature flag is explicitly disabled": {
2020
FeatureFlagEnabled: false,
2121
WantEnabled: false,
2222
},
23-
"feature flag is enabled": {
23+
"feature flag is explicitly enabled": {
2424
FeatureFlagEnabled: true,
2525
WantEnabled: true,
2626
},

internal/pkg/config/config_test.go

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ import (
2424
)
2525

2626
func TestConfig(t *testing.T) {
27+
// Expected server config for the "input-config" test case.
28+
inputCfgServer := defaultServer()
29+
inputCfgServer.Host = "localhost"
30+
inputCfgServer.Port = 8888
31+
inputCfgServer.Timeouts.Read = 20 * time.Second
32+
inputCfgServer.Timeouts.Write = 5 * time.Second
33+
inputCfgServer.Timeouts.CheckinMaxPoll = 10 * time.Minute
34+
2735
testcases := map[string]struct {
2836
err string
2937
cfg *Config
@@ -109,38 +117,9 @@ func TestConfig(t *testing.T) {
109117
},
110118
Inputs: []Input{
111119
{
112-
Type: "fleet-server",
113-
Server: Server{
114-
Host: "localhost",
115-
Port: 8888,
116-
InternalPort: 8221,
117-
Timeouts: ServerTimeouts{
118-
Read: 20 * time.Second,
119-
ReadHeader: 5 * time.Second,
120-
Idle: 35 * time.Second,
121-
Write: 5 * time.Second,
122-
CheckinTimestamp: 30 * time.Second,
123-
CheckinLongPoll: 5 * time.Minute,
124-
CheckinJitter: 30 * time.Second,
125-
CheckinMaxPoll: 10 * time.Minute,
126-
Drain: 10 * time.Second,
127-
},
128-
Profiler: ServerProfiler{
129-
Enabled: false,
130-
Bind: "localhost:6060",
131-
},
132-
CompressionLevel: 1,
133-
CompressionThresh: 1024,
134-
Limits: generateServerLimits(0),
135-
Bulk: defaultServerBulk(),
136-
GC: defaultServerGC(),
137-
PGP: PGP{
138-
UpstreamURL: defaultPGPUpstreamURL,
139-
Dir: filepath.Join(retrieveExecutableDir(), defaultPGPDirectoryName),
140-
},
141-
PDKDF2: defaultPBKDF2(),
142-
},
143-
Cache: generateCache(0),
120+
Type: "fleet-server",
121+
Server: inputCfgServer,
122+
Cache: generateCache(0),
144123
Monitor: Monitor{
145124
FetchSize: defaultFetchSize,
146125
PollTimeout: defaultPollTimeout,
@@ -542,24 +521,6 @@ func generateServerLimits(maxAgents int) ServerLimits {
542521
return d
543522
}
544523

545-
func defaultServerBulk() ServerBulk {
546-
var d ServerBulk
547-
d.InitDefaults()
548-
return d
549-
}
550-
551-
func defaultServerGC() GC {
552-
var d GC
553-
d.InitDefaults()
554-
return d
555-
}
556-
557-
func defaultPBKDF2() PBKDF2 {
558-
var d PBKDF2
559-
d.InitDefaults()
560-
return d
561-
}
562-
563524
func defaultLogging() Logging {
564525
var d Logging
565526
d.InitDefaults()

internal/pkg/config/input.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type (
9999
// This setting restores previous behaviour where all POLICY_CHANGE actions need an explicit ack.
100100
IgnoreCheckinPolicyID bool `config:"ignore_checkin_policy_id"`
101101

102-
// EnableOpAMP when true will enable the OpAMP endpoint.
102+
// EnableOpAMP controls whether the OpAMP endpoint is enabled. Defaults to true.
103103
EnableOpAMP bool `config:"enable_opamp"`
104104
}
105105
)
@@ -119,6 +119,7 @@ func (c *Server) InitDefaults() {
119119
c.GC.InitDefaults()
120120
c.PGP.InitDefaults()
121121
c.PDKDF2.InitDefaults()
122+
c.Features.EnableOpAMP = true
122123
}
123124

124125
// BindEndpoints returns the binding address for the all HTTP server listeners.

testing/e2e/testdata/stand-alone-opamp.tpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ fleet.agent.id: e2e-test-id
88
inputs:
99
- type: fleet-server
1010
server:
11-
feature_flags:
12-
enable_opamp: true
1311
static_policy_tokens:
1412
enabled: true
1513
policy_tokens:

0 commit comments

Comments
 (0)