Skip to content

Commit

Permalink
Include opamp bridge headers in configmap generation (open-telemetry#…
Browse files Browse the repository at this point in the history
…2414)

* add headers to opamp bridge spec and pass through to configmap generation

* run make generate

* add changelog

* run make bundle and make api-docs

* run 'VERSION="0.89.0" IMG="ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator" make bundle' from jacobs advice

* put these versions back

* rm another autogenned change

* rm this too

* rerun make bundle after pulling in main
  • Loading branch information
jdcrouse authored Dec 5, 2023
1 parent e6996e3 commit e58ce39
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .chloggen/opamp-bridge-headers-in-crd.yaml
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 Headers to opamp bridge spec and configmap generation

# 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:
4 changes: 4 additions & 0 deletions apis/v1alpha1/opampbridge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ type OpAMPBridgeSpec struct {
// OpAMP backend Server endpoint
// +required
Endpoint string `json:"endpoint"`
// Headers is an optional map of headers to use when connecting to the OpAMP Server,
// typically used to set access tokens or other authorization headers.
// +optional
Headers map[string]string `json:"headers,omitempty"`
// Capabilities supported by the OpAMP Bridge
// +required
Capabilities map[OpAMPBridgeCapability]bool `json:"capabilities"`
Expand Down
7 changes: 7 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ metadata:
categories: Logging & Tracing,Monitoring
certified: "false"
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
createdAt: "2023-12-05T15:43:53Z"
createdAt: "2023-12-05T18:09:19Z"
description: Provides the OpenTelemetry components, including the Collector
operators.operatorframework.io/builder: operator-sdk-v1.29.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
Expand Down
7 changes: 7 additions & 0 deletions bundle/manifests/opentelemetry.io_opampbridges.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,13 @@ spec:
x-kubernetes-map-type: atomic
type: object
type: array
headers:
additionalProperties:
type: string
description: Headers is an optional map of headers to use when connecting
to the OpAMP Server, typically used to set access tokens or other
authorization headers.
type: object
hostNetwork:
description: HostNetwork indicates if the pod should run in the host
networking namespace.
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/opentelemetry.io_opampbridges.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,13 @@ spec:
x-kubernetes-map-type: atomic
type: object
type: array
headers:
additionalProperties:
type: string
description: Headers is an optional map of headers to use when connecting
to the OpAMP Server, typically used to set access tokens or other
authorization headers.
type: object
hostNetwork:
description: HostNetwork indicates if the pod should run in the host
networking namespace.
Expand Down
7 changes: 7 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3697,6 +3697,13 @@ OpAMPBridgeSpec defines the desired state of OpAMPBridge.
List of sources to populate environment variables on the OpAMPBridge Pods.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>headers</b></td>
<td>map[string]string</td>
<td>
Headers is an optional map of headers to use when connecting to the OpAMP Server, typically used to set access tokens or other authorization headers.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>hostNetwork</b></td>
<td>boolean</td>
Expand Down
4 changes: 4 additions & 0 deletions internal/manifests/opampbridge/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func ConfigMap(params manifests.Params) (*corev1.ConfigMap, error) {
config["endpoint"] = params.OpAMPBridge.Spec.Endpoint
}

if len(params.OpAMPBridge.Spec.Headers) > 0 {
config["headers"] = params.OpAMPBridge.Spec.Headers
}

if params.OpAMPBridge.Spec.Capabilities != nil {
config["capabilities"] = params.OpAMPBridge.Spec.Capabilities
}
Expand Down
3 changes: 3 additions & 0 deletions internal/manifests/opampbridge/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ componentsAllowed:
receivers:
- otlp
endpoint: ws://opamp-server:4320/v1/opamp
headers:
authorization: access-12345-token
`}

opampBridge := v1alpha1.OpAMPBridge{
Expand All @@ -69,6 +71,7 @@ endpoint: ws://opamp-server:4320/v1/opamp
Spec: v1alpha1.OpAMPBridgeSpec{
Image: "ghcr.io/open-telemetry/opentelemetry-operator/operator-opamp-bridge:0.69.0",
Endpoint: "ws://opamp-server:4320/v1/opamp",
Headers: map[string]string{"authorization": "access-12345-token"},
Capabilities: map[v1alpha1.OpAMPBridgeCapability]bool{
v1alpha1.OpAMPBridgeCapabilityReportsStatus: true,
v1alpha1.OpAMPBridgeCapabilityAcceptsRemoteConfig: true,
Expand Down

0 comments on commit e58ce39

Please sign in to comment.