forked from open-telemetry/opentelemetry-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to set headers in the opamp bridge config (open-telem…
…etry#2413) * add headers to bridge config and include test for parsing config from yaml * headers to own type and make translation method a method on the headers type * rename file to headers.go, s/ToHttpHeader/ToHTTPHeader * add changelog * add copyright header
- Loading branch information
Showing
7 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) | ||
component: bridge | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: adds request headers to the opamp bridge config | ||
|
||
# One or more tracking issues related to the change | ||
issues: [2410] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package config | ||
|
||
import "net/http" | ||
|
||
type Headers map[string]string | ||
|
||
func (h Headers) ToHTTPHeader() http.Header { | ||
newMap := make(map[string][]string) | ||
for key, value := range h { | ||
newMap[key] = []string{value} | ||
} | ||
return newMap | ||
} |
17 changes: 17 additions & 0 deletions
17
cmd/operator-opamp-bridge/config/testdata/agentwithheaders.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
endpoint: ws://127.0.0.1:4320/v1/opamp | ||
headers: | ||
authentication: "access-12345-token" | ||
my-header-key: "my-header-value" | ||
capabilities: | ||
AcceptsRemoteConfig: true | ||
ReportsEffectiveConfig: true | ||
AcceptsPackages: false | ||
ReportsPackageStatuses: false | ||
ReportsOwnTraces: true | ||
ReportsOwnMetrics: true | ||
ReportsOwnLogs: true | ||
AcceptsOpAMPConnectionSettings: true | ||
AcceptsOtherConnectionSettings: true | ||
AcceptsRestartCommand: true | ||
ReportsHealth: true | ||
ReportsRemoteConfig: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters