-
Notifications
You must be signed in to change notification settings - Fork 69
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
feature/add-multi-dc-for-pg #655
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes update the PostgreSQL application's Helm configuration. The chart version is incremented from 0.8.0 to 0.9.0, and the versions_map file is revised with a fixed commit hash for 0.8.0 and a new entry for 0.9.0. Additionally, a new parameter Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant H as Helm
participant T as Template Engine
participant D as Deployment Spec
U->>H: Run helm install using values.yaml
H->>T: Render templates (db.yaml)
T->>T: Check if topologySpreadConstraints exists
alt Parameter provided
T->>D: Insert topologySpreadConstraints into deployment spec
else Not provided
T->>D: Omit topologySpreadConstraints
end
T-->>H: Return rendered manifest
H->>K: Deploy manifest to Kubernetes
Possibly related PRs
Suggested labels
Suggested reviewers
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: 1
🧹 Nitpick comments (3)
packages/apps/postgres/values.schema.json (1)
105-109
: Schema definition could be more specificThe
items
field is currently empty, which means any array items would be validated against an empty schema. Consider enhancing this to properly validate the structure of Kubernetes topology spread constraints."topologySpreadConstraints": { "type": "array", "description": "The topologySpreadConstraints", "default": [], - "items": {} + "items": { + "type": "object", + "properties": { + "maxSkew": { + "type": "integer", + "description": "The degree to which pods may be unevenly distributed" + }, + "topologyKey": { + "type": "string", + "description": "The key of node labels" + }, + "whenUnsatisfiable": { + "type": "string", + "description": "How to deal with a pod if it doesn't satisfy the spread constraint", + "enum": ["DoNotSchedule", "ScheduleAnyway"] + } + } + }packages/apps/postgres/README.md (2)
63-63
: Typo in Backup Parameter DescriptionThere is a typo in the description for
backup.enabled
("Enable pereiodic backups"). Please correct "pereiodic" to "periodic" for clarity.
71-71
: Reconsider Parameter Placement and DescriptionThe newly added
topologySpreadConstraints
parameter is inserted under the "Backup parameters" section. Given its purpose for dynamic deployment configuration, consider either:
- Moving it to a more appropriate section (e.g., "Deployment Parameters"), or
- Updating its description to clarify its role within backup or broader deployment settings.
This will help users better understand its function and context.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/apps/postgres/Chart.yaml
(1 hunks)packages/apps/postgres/README.md
(1 hunks)packages/apps/postgres/templates/db.yaml
(1 hunks)packages/apps/postgres/values.schema.json
(1 hunks)packages/apps/postgres/values.yaml
(1 hunks)packages/apps/versions_map
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/apps/postgres/Chart.yaml
🧰 Additional context used
🪛 YAMLlint (1.35.1)
packages/apps/postgres/templates/db.yaml
[error] 10-10: syntax error: could not find expected ':'
(syntax)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: pre-commit
🔇 Additional comments (2)
packages/apps/versions_map (1)
72-73
: Version updates look good!The changes properly version the postgres package, fixing version 0.8.0 to a specific commit hash and correctly setting 0.9.0 to track HEAD.
packages/apps/postgres/values.yaml (1)
80-85
: Well-structured configuration with helpful examplesThe addition of the
topologySpreadConstraints
parameter with commented examples provides clear guidance for users who want to configure topology spread constraints.
{{ if .Values.topologySpreadConstraints }} | ||
topologySpreadConstraints: | ||
{{- toYaml .Values.topologySpreadConstraints | nindent 4 }} | ||
{{- end }} |
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.
Fix YAML indentation to ensure proper parsing
The static analysis tool reports a syntax error on line 10. While the templating logic is correct, there might be an indentation issue with how the topologySpreadConstraints
key is placed relative to other spec fields.
spec:
instances: {{ .Values.replicas }}
enableSuperuserAccess: true
- {{ if .Values.topologySpreadConstraints }}
- topologySpreadConstraints:
- {{- toYaml .Values.topologySpreadConstraints | nindent 4 }}
- {{- end }}
+ {{- if .Values.topologySpreadConstraints }}
+ topologySpreadConstraints:
+ {{- toYaml .Values.topologySpreadConstraints | nindent 4 }}
+ {{- end }}
postgresql:
parameters:
The issue is with the whitespace handling in the templating. Using {{-
instead of {{
at the beginning of the if statement will properly trim whitespace and prevent YAML parsing errors.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
{{ if .Values.topologySpreadConstraints }} | |
topologySpreadConstraints: | |
{{- toYaml .Values.topologySpreadConstraints | nindent 4 }} | |
{{- end }} | |
spec: | |
instances: {{ .Values.replicas }} | |
enableSuperuserAccess: true | |
{{- if .Values.topologySpreadConstraints }} | |
topologySpreadConstraints: | |
{{- toYaml .Values.topologySpreadConstraints | nindent 4 }} | |
{{- end }} | |
postgresql: | |
parameters: |
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 10-10: syntax error: could not find expected ':'
(syntax)
Summary by CodeRabbit
New Features
Chores