feat(cortex-postgres): add suffix gX to postgresql#939
Conversation
📝 WalkthroughWalkthroughThis PR adds PostgreSQL instance suffix support to enable re-provisioning and credential rotation across three Cortex bundles. The ChangesPostgreSQL instance suffix rotation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Coverage ReportTest Coverage 📊: 69.6% |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
helm/bundles/cortex-nova/values.yaml (1)
280-282:⚠️ Potential issue | 🟠 Major | ⚡ Quick winMissing
instanceSuffixin both Nova and Manila bundle configurations.Both
helm/bundles/cortex-nova/values.yamlandhelm/bundles/cortex-manila/values.yamldefinecortex-postgressubchart values withfullnameOverrideandmajor, but omitinstanceSuffix. The corresponding secret templates in both bundles reference(index .Values "cortex-postgres" "instanceSuffix"), which requires this value to be explicitly defined to ensure reliable template rendering and to match the updated service hostnames (e.g.,cortex-nova-postgresql-v18-g0).Add
instanceSuffix: "g0"to thecortex-postgressection in both files.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@helm/bundles/cortex-nova/values.yaml` around lines 280 - 282, The cortex-postgres chart values are missing the instanceSuffix key required by the secret templates that reference (index .Values "cortex-postgres" "instanceSuffix"); update the cortex-postgres value blocks where fullnameOverride: cortex-nova-postgresql and major: "18" are defined to also include instanceSuffix: "g0" (and make the analogous change in the cortex-manila bundle) so templates render the expected hostnames like cortex-nova-postgresql-v18-g0.helm/bundles/cortex-cinder/values.yaml (1)
139-141:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winMissing
instanceSuffixconfiguration breaks template rendering and runtime resource discovery.The root cause is that
instanceSuffix: "g0"is not defined in thecortex-postgresconfiguration invalues.yaml:139-141. This causes three cascading failures:
In
values.yaml:41: The hardcodedpostgres.hostvalue includes-g0, but there's no correspondinginstanceSuffixconfiguration to generate that suffix.In
templates/secrets.yaml:7: The secret template references(index .Values "cortex-postgres" "instanceSuffix")which is undefined, causing Helm template rendering to fail with a nil pointer or undefined value error.In
Tiltfile:199(and lines 224, 241 for Manila/Cinder): The k8s_resource referencescortex-nova-postgresql-v18-g0, but the Helm chart cannot create a StatefulSet with that name because the template fails.The same missing configuration applies to all three bundles (Nova, Manila, Cinder) based on the PR scope.
🔧 Fix for all three bundles
Add the
instanceSuffixvalue to each bundle'svalues.yaml:helm/bundles/cortex-nova/values.yaml:
cortex-postgres: fullnameOverride: cortex-nova-postgresql major: "18" + instanceSuffix: "g0"helm/bundles/cortex-manila/values.yaml:
cortex-postgres: fullnameOverride: cortex-manila-postgresql major: "18" + instanceSuffix: "g0"helm/bundles/cortex-cinder/values.yaml:
cortex-postgres: fullnameOverride: cortex-cinder-postgresql major: "18" + instanceSuffix: "g0"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@helm/bundles/cortex-cinder/values.yaml` around lines 139 - 141, Add the missing instanceSuffix key (e.g. instanceSuffix: "g0") to the cortex-postgres section in values.yaml so templates that reference (index .Values "cortex-postgres" "instanceSuffix") resolve; do the same for the other two bundles (cortex-nova and cortex-manila) values.yaml files to match the hardcoded host/resource names (e.g. postgres.host and Tiltfile k8s_resource names like cortex-nova-postgresql-v18-g0) so Helm templates in templates/secrets.yaml and the StatefulSet names referenced by Tiltfile lines (199/224/241) render without nil/undefined errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@helm/bundles/cortex-cinder/values.yaml`:
- Line 41: The postgres.host entry is hardcoded to
"cortex-cinder-postgresql-v18-g0" while the chart expects
.Values."cortex-postgres"."instanceSuffix" (used in templates/secrets.yaml:7),
causing a render failure; fix by making host derive from the cortex-postgres
values (remove the trailing "-g0" hardcode) or add an explicit
cortex-postgres.instanceSuffix value to values.yaml that matches the suffix used
in the host; ensure the keys involved are postgres.host and
cortex-postgres.instanceSuffix so the secret template can access
.Values."cortex-postgres"."instanceSuffix" successfully.
---
Outside diff comments:
In `@helm/bundles/cortex-cinder/values.yaml`:
- Around line 139-141: Add the missing instanceSuffix key (e.g. instanceSuffix:
"g0") to the cortex-postgres section in values.yaml so templates that reference
(index .Values "cortex-postgres" "instanceSuffix") resolve; do the same for the
other two bundles (cortex-nova and cortex-manila) values.yaml files to match the
hardcoded host/resource names (e.g. postgres.host and Tiltfile k8s_resource
names like cortex-nova-postgresql-v18-g0) so Helm templates in
templates/secrets.yaml and the StatefulSet names referenced by Tiltfile lines
(199/224/241) render without nil/undefined errors.
In `@helm/bundles/cortex-nova/values.yaml`:
- Around line 280-282: The cortex-postgres chart values are missing the
instanceSuffix key required by the secret templates that reference (index
.Values "cortex-postgres" "instanceSuffix"); update the cortex-postgres value
blocks where fullnameOverride: cortex-nova-postgresql and major: "18" are
defined to also include instanceSuffix: "g0" (and make the analogous change in
the cortex-manila bundle) so templates render the expected hostnames like
cortex-nova-postgresql-v18-g0.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fdf7ea33-25d7-47dc-9260-f72bd3ac2441
📒 Files selected for processing (11)
Tiltfilehelm/bundles/cortex-cinder/templates/secrets.yamlhelm/bundles/cortex-cinder/values.yamlhelm/bundles/cortex-manila/templates/secrets.yamlhelm/bundles/cortex-manila/values.yamlhelm/bundles/cortex-nova/templates/secrets.yamlhelm/bundles/cortex-nova/values.yamlhelm/library/cortex-postgres/templates/_helpers.tplhelm/library/cortex-postgres/templates/service.yamlhelm/library/cortex-postgres/templates/statefulset.yamlhelm/library/cortex-postgres/values.yaml
No description provided.