-
Notifications
You must be signed in to change notification settings - Fork 12
Add Auto-configure curator retention rule for indexPerNamespace #2887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Auto-configure curator retention rule for indexPerNamespace #2887
Conversation
fa9e0f5 to
078bef4
Compare
AlbinB97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work Joy 👍
Added some comments that needs to be addressed.
|
Could you also add this pattern when indexPerNamespace is enabled? - pattern: .orphaned*
ageDays: xxx
sizeGB: yyyThese indexes usually pop up when namespaces are removed, and since they start with |
Sure, I will make an implementation for that pattern. |
eee8515 to
1c755bb
Compare
|
Xartos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Great job 👍 Only nit, I'd change the kind from feature to improvement in the PR description
shafi-elastisys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! LGTM 🚀
AlbinB97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, as Fredrik wrote, please change the kind of PR to improvement instead of feature before merging
👍
Warning
This is a public repository, ensure not to disclose:
What kind of PR is this?
Required: Mark one of the following that is applicable:
Optional: Mark one or more of the following that are applicable:
Important
Breaking changes should be marked
kind/admin-changeorkind/dev-changedepending on typeCritical security fixes should be marked with
kind/securityWhat does this PR do / why do we need this PR?
Automatically configures an OpenSearch Curator retention rule for all non-system indices when
indexPerNamespaceis enabled, removing a manual configuration step that is easy to miss.When
indexPerNamespaceis enabled, logs are indexed by Kubernetes namespace instead of fixed patterns. This requires a retention rule to clean up non-system indices (^[^.].*pattern). Previously, users had to manually add this rule to their configuration insc-config.yaml/common-config.yaml.The Solution:
Automatically adds the
^[^.].*pattern whenopensearch.indexPerNamespaceis true.Uses configurable defaults exposed in
sc-config.yaml:opensearch.curator.indexPerNamespaceDefaultSizeGB→ default 5000opensearch.curator.indexPerNamespaceDefaultAgeDays→ default 30Preserves all existing user-configured retention rules (they are appended after the auto-generated non-system rule).
Keeps behaviour unchanged when
indexPerNamespaceis `false.Information to reviewers
The change is transparent for environments where
indexPerNamespaceis disabled.When
indexPerNamespaceis enabled, a previously required manual step is now automated but still configurable viasc-config.yaml.How to test
Pre-condition: Ensure your environment is on a matching Welkin Apps version (no version mismatch between cluster/config/repository) before running these commands.
Test with
indexPerNamespacedisabledVerify current setting (indexPerNamespace is false/not set):
Apply changes
Inspect Curator ConfigMap
Expected:
Only the retention rules explicitly configured under
opensearch.curator.retentionare present.No
^[^.].*pattern is injected.Test with
indexPerNamespaceenabled:Enable indexPerNamespace
Optionally override defaults (to verify configurability):
Apply changes
Inspect Curator ConfigMap
Expected:
A retention rule with pattern
^[^.].*appears first, using:disk_space=indexPerNamespaceDefaultSizeGB(default 5000)age filter =
indexPerNamespaceDefaultAgeDays(default 30)All existing user-defined patterns (e.g.
kubernetes-*,kubeaudit-*,other-*,authlog-*,security-auditlog-*) are still present and evaluated after the non-system rule.Verify curator CronJob exists and is valid::
Expected behavior:
indexPerNamespaceis false: Only user-configured retention rules are appliedindexPerNamespaceis true: The ^[^.].* rule is added first with defaults, then user-configured rulesTechnical Details
Changes include:
helmfile.d/values/opensearch/curator.yaml.gotmplSwitch from static retention configuration to logic that derives retention rules from:
opensearch.curator.retentionopensearch.indexPerNamespaceopensearch.curator.indexPerNamespaceDefaultSizeGBopensearch.curator.indexPerNamespaceDefaultAgeDayshelmfile.d/charts/opensearch/curator/values.yamlconfig/schemas/config.yamlAdd schema entries under
opensearch.curator:indexPerNamespaceDefaultSizeGB(number, default5000)indexPerNamespaceDefaultAgeDays(number, default30)This ensures the new values are validated, documented, and configurable via
sc-config.yaml.Checklist