forked from open-telemetry/opentelemetry-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
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 (open-telemetry#131)
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
- Loading branch information
1 parent
04e125a
commit 383b0b6
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