diff --git a/controllers/cloud.redhat.com/providers/sidecar/default.go b/controllers/cloud.redhat.com/providers/sidecar/default.go index 15327aa32..3dfe42e92 100644 --- a/controllers/cloud.redhat.com/providers/sidecar/default.go +++ b/controllers/cloud.redhat.com/providers/sidecar/default.go @@ -99,6 +99,17 @@ func (sc *sidecarProvider) Provide(app *crd.ClowdApp) error { cont := getOtelCollector(app.Name) if cont != nil { cj.Spec.JobTemplate.Spec.Template.Spec.Containers = append(cj.Spec.JobTemplate.Spec.Template.Spec.Containers, *cont) + cj.Spec.JobTemplate.Spec.Template.Spec.Volumes = append(cj.Spec.JobTemplate.Spec.Template.Spec.Volumes, core.Volume{ + Name: fmt.Sprintf("%s-otel-config", app.Name), + VolumeSource: core.VolumeSource{ + ConfigMap: &core.ConfigMapVolumeSource{ + LocalObjectReference: core.LocalObjectReference{ + Name: fmt.Sprintf("%s-otel-config", app.Name), + }, + Optional: utils.TruePtr(), + }, + }, + }) } } default: diff --git a/tests/kuttl/test-sidecars/01-assert.yaml b/tests/kuttl/test-sidecars/01-assert.yaml index 70c7ba00f..249799e03 100644 --- a/tests/kuttl/test-sidecars/01-assert.yaml +++ b/tests/kuttl/test-sidecars/01-assert.yaml @@ -42,3 +42,15 @@ spec: - name: token-refresher - name: otel-collector image: ghcr.io/os-observability/redhat-opentelemetry-collector/redhat-opentelemetry-collector:0.107.0 + volumeMounts: + - mountPath: /etc/otelcol/config.yaml + name: puptoo-otel-config + volumes: + - name: config-secret + secret: + defaultMode: 420 + secretName: puptoo + - configMap: + defaultMode: 420 + name: puptoo-otel-config + name: puptoo-otel-config diff --git a/tests/kuttl/test-sidecars/01-pods.yaml b/tests/kuttl/test-sidecars/01-pods.yaml index 432c5f7e1..440d7ee62 100644 --- a/tests/kuttl/test-sidecars/01-pods.yaml +++ b/tests/kuttl/test-sidecars/01-pods.yaml @@ -57,14 +57,6 @@ spec: schedule: "*/1 * * * *" podSpec: image: quay.io/psav/clowder-hello - volumeMounts: - - name: puptoo-otel-config - mountPath: "/etc/otelcol/config.yaml" - readOnly: true - volumes: - - name: puptoo-otel-config - configMap: - name: puptoo-otel-config sidecars: - name: token-refresher enabled: true diff --git a/tests/kuttl/test-sidecars/02-assert.yaml b/tests/kuttl/test-sidecars/02-assert.yaml index 78a017f98..b280ac877 100644 --- a/tests/kuttl/test-sidecars/02-assert.yaml +++ b/tests/kuttl/test-sidecars/02-assert.yaml @@ -23,11 +23,8 @@ spec: serviceAccountName: puptoo-processor containers: - name: puptoo-processor - volumeMounts: - - name: puptoo-otel-config - mountPath: "/etc/otelcol/config.yaml" - readOnly: true volumes: - - name: puptoo-otel-config - configMap: - name: puptoo-otel-config + - name: config-secret + secret: + defaultMode: 420 + secretName: puptoo