Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .chloggen/issue-4481.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: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
component: opamp

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "OpAMP Bridge: collector.DeepCopy() causes full spec updates → DaemonSet mode fails (should patch spec.config only)"

# One or more tracking issues related to the change
issues: [https://github.com/open-telemetry/opentelemetry-operator/pull/4482]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just provide an issue number here


# (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:
12 changes: 12 additions & 0 deletions cmd/operator-opamp-bridge/internal/operator/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,21 @@ func (c Client) Apply(name string, namespace string, configmap *protobufs.AgentC
if instance == nil {
return c.create(ctx, name, namespace, updatedCollector)
}


if instance.Spec.Mode == v1beta1.ModeDaemonSet {
return c.updateConfigOnly(ctx, instance, updatedCollector)
}
Comment on lines +107 to +109
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add to an existing e2e test to verify this change?

return c.update(ctx, instance, updatedCollector)
}

// patch ONLY spec.config on an existing CR
func (c Client) updateConfigOnly(ctx context.Context, existing *v1beta1.OpenTelemetryCollector, desired *v1beta1.OpenTelemetryCollector) error {
base := existing.DeepCopy()
existing.Spec.Config = desired.Spec.Config // only mutate spec.config
return c.k8sClient.Patch(ctx, existing, client.MergeFrom(base))
}

func (c Client) validateComponents(collectorConfig *v1beta1.Config) error {
if len(c.componentsAllowed) == 0 {
return nil
Expand Down