-
Couldn't load subscription status.
- Fork 127
fix cnpg alerts templating #574
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
Conversation
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
WalkthroughThe pull request modifies the Postgres Operator's alert configuration files. In Changes
Sequence DiagramsequenceDiagram
participant Helm as Helm Templating Engine
participant AlertDir as /alerts Directory
participant OutputYAML as Consolidated Alerts YAML
Helm->>AlertDir: Scan for YAML files
AlertDir-->>Helm: Return list of alert files
loop For Each Alert File
Helm->>AlertDir: Read file contents
AlertDir-->>Helm: Provide file content
Helm->>OutputYAML: Generate document with source file comment
end
Possibly related PRs
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/system/postgres-operator/templates/alerts.yaml (1)
1-1: Consider adding a null check for empty directory.While the current implementation works, it might be good to handle the case where no alert files are found.
-{{- $files := .Files.Glob "alerts/*.yaml" -}} +{{- $files := .Files.Glob "alerts/*.yaml" -}} +{{- if $files }} {{- range $path, $file := $files }} --- # from: {{ $path }} {{ toString $file }} {{- end -}} +{{- else }} +# No alert configurations found in alerts directory +{{- end }}🧰 Tools
🪛 yamllint (1.35.1)
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/system/postgres-operator/alerts/cnpg-default-alerts.yaml(8 hunks)packages/system/postgres-operator/templates/alerts.yaml(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/system/postgres-operator/alerts/cnpg-default-alerts.yaml
🧰 Additional context used
🪛 yamllint (1.35.1)
packages/system/postgres-operator/templates/alerts.yaml
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
🔇 Additional comments (1)
packages/system/postgres-operator/templates/alerts.yaml (1)
1-7: LGTM! Clean implementation of modular alert configuration.The templating approach is well-structured and follows Helm best practices:
- Uses
.Files.Globfor dynamic file inclusion- Properly separates documents with YAML document separator
- Adds source file comments for better traceability
Let's verify the alerts directory structure and file contents:
✅ Verification successful
Verified: Alert configurations are properly structured and templated
The alerts directory contains a well-formatted
cnpg-default-alerts.yamlwith properly quoted template expressions and consistent alert definitions. The new templating approach will correctly include these alerts while maintaining YAML structure and traceability.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the alerts directory structure and YAML validity # Check if alerts directory exists and list its contents ls -la packages/system/postgres-operator/alerts/ # Verify YAML syntax of alert files fd -e yaml . packages/system/postgres-operator/alerts/ -x yamllint {} # Check for any template expressions in alert files that might need quoting rg -l '{{.*}}' packages/system/postgres-operator/alerts/Length of output: 490
Script:
#!/bin/bash # View the content of the alerts file cat packages/system/postgres-operator/alerts/cnpg-default-alerts.yaml # Check for template expressions with proper regex rg -l '\{\{.*\}\}' packages/system/postgres-operator/alerts/Length of output: 4537
🧰 Tools
🪛 yamllint (1.35.1)
[error] 1-1: syntax error: expected the node content, but found '-'
(syntax)
fix regression introduced in cozystack#558 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Updated label formatting in PostgreSQL operator default alerts configuration - Enhanced alert template generation to dynamically include multiple alert configurations from separate files <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
fix regression introduced in #558
Summary by CodeRabbit