Skip to content

Restore Filter field in fluentd lifecycle configuration - #843

Merged
ricardobernardino2024 merged 1 commit into
release-17.0.0from
chunk/fix-fluentd-lifecycle-filter-regression
Sep 2, 2026
Merged

Restore Filter field in fluentd lifecycle configuration#843
ricardobernardino2024 merged 1 commit into
release-17.0.0from
chunk/fix-fluentd-lifecycle-filter-regression

Conversation

@circleci-app

@circleci-app circleci-app Bot commented Sep 2, 2026

Copy link
Copy Markdown

Summary

  • PR Fix fluentd lifecycle hook: wait for bucket existence, not just MinIO #841 fixed the bucket-waiting logic in the fluentd lifecycle hook but accidentally removed the "Filter":{} field that PR Fix fluentd lifecycle hook: add Filter field and pre-push delete #840 had added to the S3 lifecycle rule JSON
  • Newer MinIO versions strictly follow the AWS S3 spec, which requires a Filter element in each lifecycle rule even when empty; without it, put-bucket-lifecycle-configuration returns MalformedXML immediately
  • This caused the in-shell retry loop (5 attempts × 10 s sleep) to exhaust and exit with failure, which Kubernetes surfaced as BackoffLimitExceeded on the codacy-fluentd-lifecycle-policy-creator post-upgrade hook
  • Both the initial attempt and the retry in deploy_to_doks_from_chartmuseum failed identically (job 31156)

Root cause: regression introduced in f5b218f — the diff removed "Filter":{} while rewriting the wait/retry logic

Fix: re-add "Filter":{} to the lifecycle rule JSON, restoring the behaviour from PR #840

https://app.circleci.com/agents/gh/codacy/chat/abceb31f-1047-4954-b199-366bcff5d888

PR #841 accidentally removed the `"Filter":{}` field that PR #840 had
added to the S3 lifecycle rule JSON. Newer MinIO versions strictly follow
the AWS S3 spec and require a Filter element in each lifecycle rule (even
when empty). Without it, put-bucket-lifecycle-configuration returns
MalformedXML immediately, causing the in-shell retry loop to exhaust its
5 attempts and exit with failure, which Kubernetes surfaces as
BackoffLimitExceeded on the post-upgrade hook.

AI-Generated: true
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restores the Filter field to the S3 lifecycle configuration in the fluentd template to prevent MalformedXML errors in newer MinIO versions. While the inclusion of the field aligns with the AWS S3 specification, the use of an empty object {} as a value is likely to fail validation in many S3-compliant environments.

Codacy analysis indicates the project remains up to standards, but a specific implementation adjustment is recommended to ensure full compliance with the S3 V2 API requirements for lifecycle rules.

Test suggestions

  • Verify that the rendered Kubernetes Job manifest contains the 'Filter' field in the LIFECYCLE environment variable JSON.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that the rendered Kubernetes Job manifest contains the 'Filter' field in the LIFECYCLE environment variable JSON.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

ENDPOINT="http://{{ .Values.global.minio.location }}:{{ .Values.global.minio.port }}"
BUCKET="{{ .Values.fluentdoperator.bucketName }}"
LIFECYCLE='{"Rules":[{"Expiration":{"Days": {{ .Values.fluentdoperator.expirationDays }} },"ID":"Delete old logs","Status":"Enabled"}]}'
LIFECYCLE='{"Rules":[{"Expiration":{"Days": {{ .Values.fluentdoperator.expirationDays }} },"Filter":{},"ID":"Delete old logs","Status":"Enabled"}]}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Suggestion: The S3 Lifecycle V2 API requires the 'Filter' element to contain exactly one member (Prefix, Tag, or And). Using an empty object '{}' may cause validation errors. To apply the rule to all objects and ensure compliance with the specification, use an empty prefix.

Suggested change
LIFECYCLE='{"Rules":[{"Expiration":{"Days": {{ .Values.fluentdoperator.expirationDays }} },"Filter":{},"ID":"Delete old logs","Status":"Enabled"}]}'
LIFECYCLE='{"Rules":[{"Expiration":{"Days": {{ .Values.fluentdoperator.expirationDays }} },"Filter":{"Prefix": ""},"ID":"Delete old logs","Status":"Enabled"}]}'

@ricardobernardino2024
ricardobernardino2024 merged commit abee531 into release-17.0.0 Sep 2, 2026
9 checks passed
@ricardobernardino2024
ricardobernardino2024 deleted the chunk/fix-fluentd-lifecycle-filter-regression branch September 2, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant