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

Bumped OpenTelemetry Collector to v0.15.0 #131

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
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 ([#131](https://github.com/open-telemetry/opentelemetry-operator/pull/131), [@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