Skip to content

Commit 231a5ae

Browse files
pedjakclaude
andcommitted
fix: collect operator pod logs across restarts and rolling updates
Serial tests (HA, TLS, proxy scenarios) patch operator-controller and catalogd Deployments, triggering rolling updates that delete the original pods. The support bundle collected at the end only captures replacement pod logs, so parallel test failure logs are lost. Deploy Fluent Bit (gated on ARTIFACT_PATH) to continuously persist olmv1-system container logs to the node filesystem. A copyFromHost collector in the support bundle extracts these persisted logs into the operator-logs/ directory, preserving the complete log history across all pod generations including deleted and restarted instances. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 255f5de commit 231a5ae

3 files changed

Lines changed: 77 additions & 1 deletion

File tree

Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,18 @@ wait-%: lint-deployed-%
383383
KUBECONFIG=$(E2E_KUBECONFIG) kubectl wait --for=condition=Available --namespace=$(CATD_NAMESPACE) deployment/catalogd-controller-manager --timeout=60s
384384
KUBECONFIG=$(E2E_KUBECONFIG) kubectl wait --for=condition=Ready --namespace=$(CATD_NAMESPACE) certificate/catalogd-service-cert
385385

386+
.PHONY: fluentbit-%
387+
fluentbit-%: wait-% $(HELM)
388+
ifeq ($(strip $(ARTIFACT_PATH)),)
389+
@echo "ARTIFACT_PATH unset; skipping fluent-bit deployment"
390+
else
391+
KUBECONFIG=$(E2E_KUBECONFIG) $(HELM) upgrade --install fluent-bit oci://ghcr.io/fluent/helm-charts/fluent-bit \
392+
--namespace $(FLUENTBIT_NAMESPACE) --create-namespace \
393+
--version $(FLUENTBIT_CHART_VERSION) \
394+
-f testdata/fluentbit/values.yaml \
395+
--wait --timeout 2m
396+
endif
397+
386398
.PHONY: prometheus-%
387399
prometheus-%: wait-% $(HELM)
388400
ifeq ($(strip $(E2E_SUMMARY_OUTPUT)),)
@@ -401,7 +413,7 @@ endif
401413

402414
.PHONY: e2e-run-%
403415
e2e-run-%: GODOG_ARGS ?=
404-
e2e-run-%: prometheus-%
416+
e2e-run-%: prometheus-% fluentbit-%
405417
ifeq ($(strip $(GODOG_ARGS)),)
406418
E2E_PROMETHEUS_PORT=$$(grep -A1 'containerPort: 30900' $(KIND_CONFIG) | grep hostPort | awk '{print $$2}'); \
407419
if [[ -z "$$E2E_PROMETHEUS_PORT" ]]; then echo "error: failed to extract prometheus hostPort from $(KIND_CONFIG)" >&2; exit 1; fi; \
@@ -628,6 +640,8 @@ run-experimental: wait-$(KIND_CLUSTER_NAME) #HELP Build the operator-controller
628640
CATD_NAMESPACE := olmv1-system
629641
PROMETHEUS_NAMESPACE := olmv1-system
630642
PROMETHEUS_CHART_VERSION := 86.2.2
643+
FLUENTBIT_NAMESPACE := fluent-bit
644+
FLUENTBIT_CHART_VERSION := 0.57.9
631645

632646
.PHONY: docker-build
633647
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.

test/e2e/support-bundle.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ spec:
77
- clusterResources: {}
88
- clusterInfo: {}
99
- logs: {}
10+
- copyFromHost:
11+
collectorName: "persisted-operator-logs"
12+
image: "busybox:1"
13+
hostPath: "/var/log/fluentbit/output/"
14+
name: "operator-logs"
15+
extractArchive: true
16+
timeout: "120s"

testdata/fluentbit/values.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Fluent Bit values for e2e log persistence.
2+
# Tails operator-controller and catalogd container logs and writes them
3+
# to the node filesystem so they survive pod deletion during serial tests.
4+
resources:
5+
limits:
6+
cpu: 100m
7+
memory: 128Mi
8+
requests:
9+
cpu: 50m
10+
memory: 64Mi
11+
config:
12+
service: |
13+
[SERVICE]
14+
Flush 5
15+
Log_Level warn
16+
Daemon off
17+
HTTP_Server On
18+
inputs: |
19+
[INPUT]
20+
Name tail
21+
Path /var/log/containers/*_olmv1-system_*.log
22+
multiline.parser cri
23+
Tag <namespace_name>/<pod_name>.<container_name>
24+
Tag_Regex (?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-[a-z0-9]{64}\.log$
25+
Read_from_Head true
26+
Skip_Long_Lines On
27+
Skip_Empty_Lines On
28+
Mem_Buf_Limit 10MB
29+
DB /var/log/fluentbit/tail.db
30+
filters: ""
31+
outputs: |
32+
[OUTPUT]
33+
Name file
34+
Match *
35+
Path /var/log/fluentbit/output
36+
Mkdir true
37+
customParsers: ""
38+
extraVolumes:
39+
- name: fluentbit-output
40+
hostPath:
41+
path: /var/log/fluentbit
42+
type: DirectoryOrCreate
43+
extraVolumeMounts:
44+
- name: fluentbit-output
45+
mountPath: /var/log/fluentbit
46+
testFramework:
47+
enabled: false
48+
serviceMonitor:
49+
enabled: false
50+
prometheusRule:
51+
enabled: false
52+
dashboards:
53+
enabled: false
54+
networkPolicy:
55+
enabled: false

0 commit comments

Comments
 (0)