Skip to content

Commit

Permalink
Bumped OpenTelemetry Collector to v0.15.0
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
  • Loading branch information
jpkrohling committed Nov 27, 2020
1 parent 737dc02 commit c86b486
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
13 changes: 13 additions & 0 deletions pkg/collector/upgrade/v0_15_0.go
Original file line number Diff line number Diff line change
@@ -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
}
49 changes: 49 additions & 0 deletions pkg/collector/upgrade/v0_15_0_test.go
Original file line number Diff line number Diff line change
@@ -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")
}
4 changes: 4 additions & 0 deletions pkg/collector/upgrade/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c86b486

Please sign in to comment.