Restore Filter field in fluentd lifecycle configuration - #843
Conversation
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
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
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"}]}' |
There was a problem hiding this comment.
🟡 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.
| 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"}]}' |
Summary
"Filter":{}field that PR Fix fluentd lifecycle hook: add Filter field and pre-push delete #840 had added to the S3 lifecycle rule JSONFilterelement in each lifecycle rule even when empty; without it,put-bucket-lifecycle-configurationreturnsMalformedXMLimmediatelyBackoffLimitExceededon thecodacy-fluentd-lifecycle-policy-creatorpost-upgrade hookdeploy_to_doks_from_chartmuseumfailed identically (job 31156)Root cause: regression introduced in f5b218f — the diff removed
"Filter":{}while rewriting the wait/retry logicFix: re-add
"Filter":{}to the lifecycle rule JSON, restoring the behaviour from PR #840https://app.circleci.com/agents/gh/codacy/chat/abceb31f-1047-4954-b199-366bcff5d888