-
Notifications
You must be signed in to change notification settings - Fork 162
K8SPSMDB-1518: allow specifying logrotate configuration #2151
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
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.
Pull request overview
This PR adds support for customizable logrotate configuration in the Percona Server MongoDB Operator. It introduces new API fields to allow users to specify custom logrotate configurations either inline or via external ConfigMaps, and refactors the logrotate container code into a dedicated package for better organization.
Key changes:
- Added
LogRotateSpectype withConfigurationandExtraConfigfields to the API - Refactored logrotate container creation from
pkg/psmdb/logcollector/container.goto new packagepkg/psmdb/logcollector/logrotate - Enhanced configuration hash calculation to include logrotate configurations for pod restart triggers
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/apis/psmdb/v1/psmdb_types.go | Adds LogRotateSpec type with configuration fields |
| pkg/apis/psmdb/v1/zz_generated.deepcopy.go | Auto-generated deep copy methods for LogRotateSpec |
| pkg/psmdb/logcollector/logrotate/container.go | New package with logrotate container creation logic and volume mounts |
| pkg/psmdb/logcollector/container.go | Removes logRotationContainer function, delegates to logrotate package |
| pkg/psmdb/statefulset.go | Adds logrotate config params, volumes, and enhanced hash calculation |
| pkg/controller/perconaservermongodb/statefulset.go | Retrieves logrotate configs and passes to statefulset creation |
| pkg/controller/perconaservermongodb/psmdb_controller.go | Adds reconcileLogRotateConfigMaps for managing logrotate ConfigMap |
| build/logcollector/entrypoint.sh | Adds support for custom logrotate config directory in entrypoint script |
| config/crd/bases/psmdb.percona.com_perconaservermongodbs.yaml | Updates CRD schema with logRotate fields |
| deploy/crd.yaml | Updates CRD schema with logRotate fields |
| deploy/bundle.yaml | Updates CRD schema with logRotate fields |
| deploy/cw-bundle.yaml | Updates CRD schema with logRotate fields |
| e2e-tests/version-service/conf/crd.yaml | Updates CRD schema with logRotate fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
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.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
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.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pkg/apis/psmdb/v1/psmdb_types.go
Outdated
| // ExtraConfig allows specifying logrotate configuration file in addition to the main configuration file. | ||
| // This should be a reference to a ConfigMap in the same namespace. |
Copilot
AI
Dec 22, 2025
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.
The documentation states that ExtraConfig should reference a ConfigMap in the same namespace, but does not specify the required structure or key names within that ConfigMap. The entrypoint script expects a file named 'custom.conf' (line 15 of build/logcollector/entrypoint.sh), but when a ConfigMap is projected into a volume, each key in the ConfigMap becomes a filename. Users need to know they must create a ConfigMap with a key named 'custom.conf' for this feature to work correctly. Consider adding this requirement to the field documentation.
| // ExtraConfig allows specifying logrotate configuration file in addition to the main configuration file. | |
| // This should be a reference to a ConfigMap in the same namespace. | |
| // ExtraConfig allows specifying a logrotate configuration file in addition to the main configuration file. | |
| // This should be a reference to a ConfigMap in the same namespace. | |
| // The referenced ConfigMap must contain a key named "custom.conf"; when the ConfigMap is mounted as a volume, | |
| // that key becomes a file named "custom.conf" that is loaded as the extra logrotate configuration. |
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
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.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
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.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name string | ||
| cr *api.PerconaServerMongoDB | ||
| rsName string | ||
| component string | ||
| ls map[string]string | ||
| crUpdate func(cr *api.PerconaServerMongoDB) | ||
| additonalObjs []client.Object |
Copilot
AI
Dec 23, 2025
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.
There's a spelling error in the variable name: "additonalObjs" should be "additionalObjs" (missing 'i').
| name string | |
| cr *api.PerconaServerMongoDB | |
| rsName string | |
| component string | |
| ls map[string]string | |
| crUpdate func(cr *api.PerconaServerMongoDB) | |
| additonalObjs []client.Object | |
| name string | |
| cr *api.PerconaServerMongoDB | |
| rsName string | |
| component string | |
| ls map[string]string | |
| crUpdate func(cr *api.PerconaServerMongoDB) | |
| additionalObjs []client.Object |
| Schedule: "0 0 */2 * *", | ||
| } | ||
| }, | ||
| additonalObjs: []client.Object{ |
Copilot
AI
Dec 23, 2025
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.
There's a spelling error in the variable name: "additonalObjs" should be "additionalObjs" (missing 'i').
| }) | ||
| } | ||
|
|
||
| mockObjs = append(mockObjs, tt.additonalObjs...) |
Copilot
AI
Dec 23, 2025
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.
There's a spelling error in the variable name: "additonalObjs" should be "additionalObjs" (missing 'i').
| mockObjs = append(mockObjs, tt.additonalObjs...) | |
| mockObjs = append(mockObjs, tt.additionalObjs...) |
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mayank Shah <[email protected]>
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
commit: 37812f2 |
CHANGE DESCRIPTION
Allows specifying custom configuration for logrotate:
Examples:
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability