Skip to content
Merged
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/fix-version.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: target allocator, opamp

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix version not being updated after version upgrade.

# One or more tracking issues related to the change
issues: [4378]

# (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:
5 changes: 4 additions & 1 deletion internal/status/opampbridge/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ func HandleReconcileStatus(ctx context.Context, log logr.Logger, params manifest
}
changed := params.OpAMPBridge.DeepCopy()

if changed.Status.Version == "" {
// If the user provided a custom image we don't set the version.
// There is no guarantee that the custom image version matches the intended version.
if changed.Spec.Image == "" {
changed.Status.Version = version.OperatorOpAMPBridge()
}

statusPatch := client.MergeFrom(&params.OpAMPBridge)
if err := params.Client.Status().Patch(ctx, changed, statusPatch); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to apply status changes to the OpenTelemetry CR: %w", err)
Expand Down
7 changes: 5 additions & 2 deletions internal/status/targetallocator/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ const (

// HandleReconcileStatus handles updating the status of the CRDs managed by the operator.
func HandleReconcileStatus(ctx context.Context, log logr.Logger, params targetallocator.Params, err error) (ctrl.Result, error) {
log.V(2).Info("updating opampbridge status")
log.V(2).Info("updating target allocator status")
if err != nil {
params.Recorder.Event(&params.TargetAllocator, eventTypeWarning, reasonError, err.Error())
return ctrl.Result{}, err
}
changed := params.TargetAllocator.DeepCopy()

if changed.Status.Version == "" {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@swiatekm if the custom image is used the operator sets the version from the versions.txt

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

but after the upgrade the version was not updated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think if a user uses a custom image they should make sure it is compatible with the version that the operator expects. The expectation is that an operator version works well with a specific component version.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, but they could easily have their own build of it, with a different versioning scheme, that is nonetheless compatible. So I'd take the container image tag if the image isn't the default one. @jaronoff97 @frzifus WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

https://github.com/open-telemetry/opentelemetry-operator/blob/main/docs/compatibility.md#opentelemetry-operator-vs-opentelemetry-collector

By default, the OpenTelemetry Operator ensures consistent versioning between itself and the managed OpenTelemetryCollector resources. That is, if the OpenTelemetry Operator is based on version 0.40.0, it will create resources with an underlying OpenTelemetry Collector at version 0.40.0.

When a custom Spec.Image is used with an OpenTelemetryCollector resource, the OpenTelemetry Operator will not manage this versioning and upgrading. In this scenario, it is best practice that the OpenTelemetry Operator version should match the underlying core version. Given a OpenTelemetryCollector resource with a Spec.Image configured to a custom image based on underlying OpenTelemetry Collector at version 0.40.0, it is recommended that the OpenTelemetry Operator is kept at version 0.40.0.

// If the user provided a custom image we don't set the version.
// There is no guarantee that the custom image version matches the intended version.
if changed.Spec.Image == "" {
changed.Status.Version = version.TargetAllocator()
}

statusPatch := client.MergeFrom(&params.TargetAllocator)
if err := params.Client.Status().Patch(ctx, changed, statusPatch); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to apply status changes to the OpenTelemetry CR: %w", err)
Expand Down
Loading