Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTelemetry Collector instance is not showing properly the version after upgrade #1802

Closed
iblancasa opened this issue Jun 5, 2023 · 0 comments · Fixed by #1803
Closed
Labels
area:collector Issues for deploying collector bug Something isn't working

Comments

@iblancasa
Copy link
Contributor

Depending on the source version you upgrade the OpenTelemetry Operator, the OpenTelemetry Collector will upgrade its version properly or not.

Steps to reproduce

  1. Deploy OpenTelemetry Operator 0.63.1:
    $ kubectl create -f https://github.com/open-telemetry/opentelemetry-operator/releases/download/v0.63.1/opentelemetry-operator.yaml
  2. Deploy one OpenTelemetry Collector instance
  3. Upgrade the OpenTelemetry Operator version:
    $ kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/download/v0.78.0/opentelemetry-operator.yaml
  4. Wait until the upgrade process is triggered in the operator
  5. Check the OTEL Collector version:
$ kubectl get otelcol
NAME       MODE         VERSION   AGE
simplest   deployment   0.63.1    20m

# Check if the image was updated
$ kubectl get deployment simplest-collector -o yaml
...
    spec:
      containers:
      - args:
        - --config=/conf/collector.yaml
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        image: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.78.0
...

As we can see, the image version was updated but not the OTEL Collector version.

Source of the problem

The error appears because this source code (pkg/collector/upgrade/upgrade.go):

	if instanceV.GreaterThan(&Latest.Version) {
		u.Log.Info("skipping upgrade for OpenTelemetry Collector instance, as it's newer than our latest version", "name", otelcol.Name, "namespace", otelcol.Namespace, "version", otelcol.Status.Version, "latest", Latest.Version.String())
		return otelcol, nil
	}

is before this one:

	otelcol.Status.Version = u.Version.OpenTelemetryCollector
iblancasa added a commit to iblancasa/opentelemetry-operator that referenced this issue Jun 5, 2023
@TylerHelmuth TylerHelmuth added bug Something isn't working area:collector Issues for deploying collector labels Jun 5, 2023
pavolloffay pushed a commit that referenced this issue Jun 8, 2023
* Fix version in status for OpenTelemetry Collector after upgrades #1802

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Add missing changelog

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Fix unit tests

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Add unit test to cover this use case

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Add new log message

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

---------

Signed-off-by: Israel Blancas <iblancasa@gmail.com>
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this issue May 1, 2024
…n-telemetry#1803)

* Fix version in status for OpenTelemetry Collector after upgrades open-telemetry#1802

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Add missing changelog

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Fix unit tests

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Add unit test to cover this use case

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

* Add new log message

Signed-off-by: Israel Blancas <iblancasa@gmail.com>

---------

Signed-off-by: Israel Blancas <iblancasa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:collector Issues for deploying collector bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants