Skip to content

Commit

Permalink
Fix tests + sidecars
Browse files Browse the repository at this point in the history
  • Loading branch information
psav committed Dec 18, 2024
1 parent c9aa70b commit 528c2bb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
11 changes: 11 additions & 0 deletions controllers/cloud.redhat.com/providers/sidecar/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions tests/kuttl/test-sidecars/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 0 additions & 8 deletions tests/kuttl/test-sidecars/01-pods.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions tests/kuttl/test-sidecars/02-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 528c2bb

Please sign in to comment.