Skip to content

Commit 295d1e0

Browse files
authored
Fix conversion (#2699)
1 parent eb6add6 commit 295d1e0

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.chloggen/fix-common-fields.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: bug_fix
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
5+
component: operator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: fixes an error in conversion from v1alpha1 to v1beta1
9+
10+
# One or more tracking issues related to the change
11+
issues: [2689]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

internal/api/convert/v1alpha.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func V1Alpha1to2(in v1alpha1.OpenTelemetryCollector) (v1beta1.OpenTelemetryColle
4040
out.Spec.OpenTelemetryCommonFields.ManagementState = v1beta1.ManagementStateType(copy.Spec.ManagementState)
4141
out.Spec.OpenTelemetryCommonFields.Resources = copy.Spec.Resources
4242
out.Spec.OpenTelemetryCommonFields.NodeSelector = copy.Spec.NodeSelector
43-
out.Spec.OpenTelemetryCommonFields.Args = copy.Spec.NodeSelector
43+
out.Spec.OpenTelemetryCommonFields.Args = copy.Spec.Args
4444
out.Spec.OpenTelemetryCommonFields.Replicas = copy.Spec.Replicas
4545

4646
if copy.Spec.Autoscaler != nil {

internal/api/convert/v1alpha_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,16 @@ service:
5252
cfgV1 := v1alpha1.OpenTelemetryCollector{
5353
Spec: v1alpha1.OpenTelemetryCollectorSpec{
5454
Config: config,
55+
Args: map[string]string{
56+
"test": "something",
57+
},
5558
},
5659
}
5760

5861
cfgV2, err := V1Alpha1to2(cfgV1)
5962
assert.Nil(t, err)
6063
assert.NotNil(t, cfgV2)
64+
assert.Equal(t, cfgV1.Spec.Args, cfgV2.Spec.Args)
6165

6266
yamlCfg, err := yaml.Marshal(&cfgV2.Spec.Config)
6367
assert.Nil(t, err)

0 commit comments

Comments
 (0)