From c86b48685809ebb179c123f1e66cc625b5c0a7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraci=20Paix=C3=A3o=20Kr=C3=B6hling?= Date: Fri, 27 Nov 2020 16:20:37 +0100 Subject: [PATCH] Bumped OpenTelemetry Collector to v0.15.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Juraci Paixão Kröhling --- CHANGELOG.md | 4 +++ pkg/collector/upgrade/v0_15_0.go | 13 +++++++ pkg/collector/upgrade/v0_15_0_test.go | 49 +++++++++++++++++++++++++++ pkg/collector/upgrade/versions.go | 4 +++ versions.txt | 4 +-- 5 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 pkg/collector/upgrade/v0_15_0.go create mode 100644 pkg/collector/upgrade/v0_15_0_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2487056143..59fe34a7e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Changes by Version ================== +0.15.0 (2020-11-27) +------------------- +* Bumped OpenTelemetry Collector to v0.15.0 ([#112](https://github.com/open-telemetry/opentelemetry-operator/pull/112), [@jpkrohling](https://github.com/jpkrohling)) + 0.14.0 (2020-11-09) ------------------- * Bumped OpenTelemetry Collector to v0.14.0 ([#112](https://github.com/open-telemetry/opentelemetry-operator/pull/112), [@jpkrohling](https://github.com/jpkrohling)) diff --git a/pkg/collector/upgrade/v0_15_0.go b/pkg/collector/upgrade/v0_15_0.go new file mode 100644 index 0000000000..188888b9e2 --- /dev/null +++ b/pkg/collector/upgrade/v0_15_0.go @@ -0,0 +1,13 @@ +package upgrade + +import ( + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/open-telemetry/opentelemetry-operator/api/v1alpha1" +) + +func upgrade0_15_0(cl client.Client, otelcol *v1alpha1.OpenTelemetryCollector) (*v1alpha1.OpenTelemetryCollector, error) { + delete(otelcol.Spec.Args, "--new-metrics") + delete(otelcol.Spec.Args, "--legacy-metrics") + return otelcol, nil +} diff --git a/pkg/collector/upgrade/v0_15_0_test.go b/pkg/collector/upgrade/v0_15_0_test.go new file mode 100644 index 0000000000..90e0218359 --- /dev/null +++ b/pkg/collector/upgrade/v0_15_0_test.go @@ -0,0 +1,49 @@ +package upgrade_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + + "github.com/open-telemetry/opentelemetry-operator/api/v1alpha1" + "github.com/open-telemetry/opentelemetry-operator/internal/version" + "github.com/open-telemetry/opentelemetry-operator/pkg/collector/upgrade" +) + +func TestRemoveMetricsTypeFlags(t *testing.T) { + // prepare + nsn := types.NamespacedName{Name: "my-instance", Namespace: "default"} + existing := v1alpha1.OpenTelemetryCollector{ + ObjectMeta: metav1.ObjectMeta{ + Name: nsn.Name, + Namespace: nsn.Namespace, + Labels: map[string]string{ + "app.kubernetes.io/managed-by": "opentelemetry-operator", + }, + }, + Spec: v1alpha1.OpenTelemetryCollectorSpec{ + Args: map[string]string{ + // this would not happen in the real world, as it's either one or another, but we aren't going that far + "--new-metrics": "true", + "--legacy-metrics": "true", + }, + }, + } + existing.Status.Version = "0.9.0" + + // sanity check + require.Contains(t, existing.Spec.Args, "--new-metrics") + require.Contains(t, existing.Spec.Args, "--legacy-metrics") + + // test + res, err := upgrade.ManagedInstance(context.Background(), logger, version.Get(), nil, existing) + assert.NoError(t, err) + + // verify + assert.NotContains(t, res.Spec.Args, "--new-metrics") + assert.NotContains(t, res.Spec.Args, "--legacy-metrics") +} diff --git a/pkg/collector/upgrade/versions.go b/pkg/collector/upgrade/versions.go index 81df33be85..da3feedcec 100644 --- a/pkg/collector/upgrade/versions.go +++ b/pkg/collector/upgrade/versions.go @@ -24,6 +24,10 @@ var ( Version: *semver.MustParse("0.9.0"), upgrade: upgrade0_9_0, }, + { + Version: *semver.MustParse("0.15.0"), + upgrade: upgrade0_15_0, + }, } // Latest represents the latest version that we need to upgrade. This is not necessarily the latest known version. diff --git a/versions.txt b/versions.txt index 44820f1033..eb4d9a3956 100644 --- a/versions.txt +++ b/versions.txt @@ -2,7 +2,7 @@ # by default with the OpenTelemetry Operator. This would usually be the latest # stable OpenTelemetry version. When you update this file, make sure to update the # the docs as well. -opentelemetry-collector=0.14.0 +opentelemetry-collector=0.15.0 # Represents the next release of the OpenTelemetry Operator. -operator=0.14.0 +operator=0.15.0