Skip to content

Commit a257a3d

Browse files
committed
bundle stufff
1 parent bbc91ea commit a257a3d

11 files changed

+128
-2
lines changed

apis/v1alpha1/opampbridge_types.go

+9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ type OpAMPBridgeSpec struct {
2323
// ComponentsAllowed is a list of allowed OpenTelemetry components for each pipeline type (receiver, processor, etc.)
2424
// +optional
2525
ComponentsAllowed map[string][]string `json:"componentsAllowed,omitempty"`
26+
// Description allows the customization of the non identifying attributes for the OpAMP Bridge.
27+
// +optional
28+
Description *AgentDescription `json:"description,omitempty"`
2629
// Resources to set on the OpAMPBridge pods.
2730
// +optional
2831
Resources v1.ResourceRequirements `json:"resources,omitempty"`
@@ -111,6 +114,12 @@ type OpAMPBridgeStatus struct {
111114
Version string `json:"version,omitempty"`
112115
}
113116

117+
type AgentDescription struct {
118+
// NonIdentifyingAttributes are a map of key-value pairs that may be specified to provide
119+
// extra information about the agent to the OpAMP server.
120+
NonIdentifyingAttributes map[string]string `json:"non_identifying_attributes"`
121+
}
122+
114123
// +kubebuilder:object:root=true
115124
// +kubebuilder:subresource:status
116125
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

apis/v1alpha1/zz_generated.deepcopy.go

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2025-03-05T15:50:41Z"
102+
createdAt: "2025-03-12T19:10:16Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

bundle/community/manifests/opentelemetry.io_opampbridges.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,15 @@ spec:
489489
type: string
490490
type: array
491491
type: object
492+
description:
493+
properties:
494+
non_identifying_attributes:
495+
additionalProperties:
496+
type: string
497+
type: object
498+
required:
499+
- non_identifying_attributes
500+
type: object
492501
endpoint:
493502
type: string
494503
env:

bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2025-03-05T15:50:41Z"
102+
createdAt: "2025-03-12T19:10:16Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

bundle/openshift/manifests/opentelemetry.io_opampbridges.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,15 @@ spec:
489489
type: string
490490
type: array
491491
type: object
492+
description:
493+
properties:
494+
non_identifying_attributes:
495+
additionalProperties:
496+
type: string
497+
type: object
498+
required:
499+
- non_identifying_attributes
500+
type: object
492501
endpoint:
493502
type: string
494503
env:

cmd/operator-opamp-bridge/config/config_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,17 @@ func TestGetDescription(t *testing.T) {
240240
Value: &protobufs.AnyValue_StringValue{StringValue: "custom-value"},
241241
}})
242242
}
243+
244+
func TestGetDescriptionNoneSet(t *testing.T) {
245+
got := NewConfig(logr.Discard())
246+
instanceId := uuid.New()
247+
got.instanceId = instanceId
248+
err := LoadFromFile(got, "./testdata/agent.yaml")
249+
require.NoError(t, err, fmt.Sprintf("Load(%v)", "./testdata/agent.yaml"))
250+
desc := got.GetDescription()
251+
assert.Len(t, desc.IdentifyingAttributes, 3)
252+
assert.Contains(t, desc.IdentifyingAttributes, &protobufs.KeyValue{Key: "service.instance.id", Value: &protobufs.AnyValue{
253+
Value: &protobufs.AnyValue_StringValue{StringValue: instanceId.String()},
254+
}})
255+
assert.Len(t, desc.NonIdentifyingAttributes, 2)
256+
}

config/crd/bases/opentelemetry.io_opampbridges.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,15 @@ spec:
486486
type: string
487487
type: array
488488
type: object
489+
description:
490+
properties:
491+
non_identifying_attributes:
492+
additionalProperties:
493+
type: string
494+
type: object
495+
required:
496+
- non_identifying_attributes
497+
type: object
489498
endpoint:
490499
type: string
491500
env:

docs/api/opampbridges.md

+35
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ OpAMPBridgeSpec defines the desired state of OpAMPBridge.
111111
ComponentsAllowed is a list of allowed OpenTelemetry components for each pipeline type (receiver, processor, etc.)<br/>
112112
</td>
113113
<td>false</td>
114+
</tr><tr>
115+
<td><b><a href="#opampbridgespecdescription">description</a></b></td>
116+
<td>object</td>
117+
<td>
118+
Description allows the customization of the non identifying attributes for the OpAMP Bridge.<br/>
119+
</td>
120+
<td>false</td>
114121
</tr><tr>
115122
<td><b><a href="#opampbridgespecenvindex">env</a></b></td>
116123
<td>[]object</td>
@@ -1919,6 +1926,34 @@ merge patch.<br/>
19191926
</table>
19201927

19211928

1929+
### OpAMPBridge.spec.description
1930+
<sup><sup>[↩ Parent](#opampbridgespec)</sup></sup>
1931+
1932+
1933+
1934+
Description allows the customization of the non identifying attributes for the OpAMP Bridge.
1935+
1936+
<table>
1937+
<thead>
1938+
<tr>
1939+
<th>Name</th>
1940+
<th>Type</th>
1941+
<th>Description</th>
1942+
<th>Required</th>
1943+
</tr>
1944+
</thead>
1945+
<tbody><tr>
1946+
<td><b>non_identifying_attributes</b></td>
1947+
<td>map[string]string</td>
1948+
<td>
1949+
NonIdentifyingAttributes are a map of key-value pairs that may be specified to provide
1950+
extra information about the agent to the OpAMP server.<br/>
1951+
</td>
1952+
<td>true</td>
1953+
</tr></tbody>
1954+
</table>
1955+
1956+
19221957
### OpAMPBridge.spec.env[index]
19231958
<sup><sup>[↩ Parent](#opampbridgespec)</sup></sup>
19241959

internal/manifests/opampbridge/configmap.go

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ func ConfigMap(params manifests.Params) (*corev1.ConfigMap, error) {
3939
config["componentsAllowed"] = params.OpAMPBridge.Spec.ComponentsAllowed
4040
}
4141

42+
if params.OpAMPBridge.Spec.Description != nil {
43+
config["description"] = map[string]any{
44+
"non_identifying_attributes": params.OpAMPBridge.Spec.Description.NonIdentifyingAttributes,
45+
}
46+
}
47+
4248
configYAML, err := yaml.Marshal(config)
4349
if err != nil {
4450
return &corev1.ConfigMap{}, err

internal/manifests/opampbridge/configmap_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ componentsAllowed:
4646
- memory_limiter
4747
receivers:
4848
- otlp
49+
description:
50+
non_identifying_attributes:
51+
hello: world
4952
endpoint: ws://opamp-server:4320/v1/opamp
5053
headers:
5154
authorization: access-12345-token
@@ -85,6 +88,11 @@ headers:
8588
Image: tc.image,
8689
Endpoint: "ws://opamp-server:4320/v1/opamp",
8790
Headers: map[string]string{"authorization": "access-12345-token"},
91+
Description: &v1alpha1.AgentDescription{
92+
NonIdentifyingAttributes: map[string]string{
93+
"hello": "world",
94+
},
95+
},
8896
Capabilities: map[v1alpha1.OpAMPBridgeCapability]bool{
8997
v1alpha1.OpAMPBridgeCapabilityReportsStatus: true,
9098
v1alpha1.OpAMPBridgeCapabilityAcceptsRemoteConfig: true,

0 commit comments

Comments
 (0)