-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bumped OpenTelemetry Collector to v0.15.0
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
- Loading branch information
1 parent
737dc02
commit c86b486
Showing
5 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters