diff --git a/.chloggen/fix-collector-container-log.yaml b/.chloggen/fix-collector-container-log.yaml new file mode 100755 index 0000000000..6bb25ee4df --- /dev/null +++ b/.chloggen/fix-collector-container-log.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) +component: operator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: fix error logging in collector container creation + +# One or more tracking issues related to the change +issues: [2420] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/internal/manifests/collector/container.go b/internal/manifests/collector/container.go index e4d826e68e..e347d0ce56 100644 --- a/internal/manifests/collector/container.go +++ b/internal/manifests/collector/container.go @@ -44,7 +44,10 @@ func Container(cfg config.Config, logger logr.Logger, otelcol v1alpha1.OpenTelem // build container ports from service ports ports, err := getConfigContainerPorts(logger, otelcol.Spec.Config) - logger.Error(err, "container ports config") + if err != nil { + logger.Error(err, "container ports config") + } + for _, p := range otelcol.Spec.Ports { ports[p.Name] = corev1.ContainerPort{ Name: p.Name,