feat: add opt-in gitops mode for deterministic rendering (plane-enterprise + plane-ce)#244
feat: add opt-in gitops mode for deterministic rendering (plane-enterprise + plane-ce)#244sfasching wants to merge 1 commit into
Conversation
WalkthroughAdds a ChangesGitOps Deterministic Rendering
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
bump - what's the word on this? I would really like to get plane added to my gitops flow, but the helm chart as it stands today is gitops hostle. |
…prise + plane-ce) Adds a gitops.enabled flag (default false) to both charts. When false they render byte-for-byte as today. When true, the per-render timestamp pod annotation is omitted and migration Job names are keyed to planeVersion (instead of a wall-clock timestamp in plane-enterprise / .Release.Revision in plane-ce), so Argo CD/Flux get a deterministic render: no perpetual drift and no immutable-Job patch errors. Relates to makeplane#158, makeplane#206, makeplane#207. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
218525e to
3f350da
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@charts/plane-ce/templates/workloads/migrator.job.yaml`:
- Line 6: The migrator Job name sanitization only handles dots, pluses, and
casing, so `planeVersion` values with other invalid DNS-1123 characters can
still render an invalid name. Update the name generation in the migrator job
template to normalize all remaining non-[a-z0-9-] characters or otherwise
restrict `planeVersion` to a safe format, using the existing
`planeVersion`/`.Release.Name` branch as the place to fix it.
🪄 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: 3c179468-b9c0-482d-aaae-f9ef5e945af9
📒 Files selected for processing (31)
charts/plane-ce/templates/workloads/admin.deployment.yamlcharts/plane-ce/templates/workloads/api.deployment.yamlcharts/plane-ce/templates/workloads/beat-worker.deployment.yamlcharts/plane-ce/templates/workloads/live.deployment.yamlcharts/plane-ce/templates/workloads/migrator.job.yamlcharts/plane-ce/templates/workloads/minio.stateful.yamlcharts/plane-ce/templates/workloads/space.deployment.yamlcharts/plane-ce/templates/workloads/web.deployment.yamlcharts/plane-ce/templates/workloads/worker.deployment.yamlcharts/plane-ce/values.yamlcharts/plane-enterprise/templates/workloads/admin.deployment.yamlcharts/plane-enterprise/templates/workloads/api.deployment.yamlcharts/plane-enterprise/templates/workloads/automation-consumer.deployment.yamlcharts/plane-enterprise/templates/workloads/beat-worker.deployment.yamlcharts/plane-enterprise/templates/workloads/email.deployment.yamlcharts/plane-enterprise/templates/workloads/iframely.deployment.yamlcharts/plane-enterprise/templates/workloads/live.deployment.yamlcharts/plane-enterprise/templates/workloads/migrator.job.yamlcharts/plane-enterprise/templates/workloads/minio.stateful.yamlcharts/plane-enterprise/templates/workloads/monitor.stateful.yamlcharts/plane-enterprise/templates/workloads/outbox-poller.deployment.yamlcharts/plane-enterprise/templates/workloads/pi-api.deployment.yamlcharts/plane-enterprise/templates/workloads/pi-beat.deployment.yamlcharts/plane-enterprise/templates/workloads/pi-migrator.job.yamlcharts/plane-enterprise/templates/workloads/pi-worker.deployment.yamlcharts/plane-enterprise/templates/workloads/runner.deployment.yamlcharts/plane-enterprise/templates/workloads/silo.deployment.yamlcharts/plane-enterprise/templates/workloads/space.deployment.yamlcharts/plane-enterprise/templates/workloads/web.deployment.yamlcharts/plane-enterprise/templates/workloads/worker.deployment.yamlcharts/plane-enterprise/values.yaml
✅ Files skipped from review due to trivial changes (2)
- charts/plane-ce/templates/workloads/web.deployment.yaml
- charts/plane-enterprise/templates/workloads/pi-api.deployment.yaml
🚧 Files skipped from review as they are similar to previous changes (21)
- charts/plane-enterprise/templates/workloads/pi-worker.deployment.yaml
- charts/plane-enterprise/templates/workloads/worker.deployment.yaml
- charts/plane-ce/templates/workloads/api.deployment.yaml
- charts/plane-enterprise/templates/workloads/outbox-poller.deployment.yaml
- charts/plane-enterprise/templates/workloads/runner.deployment.yaml
- charts/plane-ce/templates/workloads/worker.deployment.yaml
- charts/plane-ce/templates/workloads/space.deployment.yaml
- charts/plane-enterprise/templates/workloads/pi-migrator.job.yaml
- charts/plane-enterprise/templates/workloads/monitor.stateful.yaml
- charts/plane-enterprise/templates/workloads/pi-beat.deployment.yaml
- charts/plane-ce/templates/workloads/live.deployment.yaml
- charts/plane-enterprise/templates/workloads/iframely.deployment.yaml
- charts/plane-ce/values.yaml
- charts/plane-ce/templates/workloads/minio.stateful.yaml
- charts/plane-ce/templates/workloads/admin.deployment.yaml
- charts/plane-ce/templates/workloads/beat-worker.deployment.yaml
- charts/plane-enterprise/templates/workloads/beat-worker.deployment.yaml
- charts/plane-enterprise/templates/workloads/automation-consumer.deployment.yaml
- charts/plane-enterprise/templates/workloads/silo.deployment.yaml
- charts/plane-enterprise/templates/workloads/email.deployment.yaml
- charts/plane-enterprise/values.yaml
| metadata: | ||
| namespace: {{ .Release.Namespace }} | ||
| name: {{ .Release.Name }}-api-migrate-{{ .Release.Revision }} | ||
| name: {{ .Release.Name }}-api-migrate-{{ if $.Values.gitops.enabled }}{{ .Values.planeVersion | replace "." "-" | replace "+" "-" | lower }}{{ else }}{{ .Release.Revision }}{{ end }} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Broaden planeVersion sanitization for the Job name. replace "." "-" | replace "+" "-" | lower still leaves other DNS-1123-invalid characters, so an underscore or space in planeVersion would make the rendered Job name invalid. Normalize the remaining non [a-z0-9-] characters or constrain the accepted version format.
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 6-6: syntax error: expected , but found ''
(syntax)
🤖 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 `@charts/plane-ce/templates/workloads/migrator.job.yaml` at line 6, The
migrator Job name sanitization only handles dots, pluses, and casing, so
`planeVersion` values with other invalid DNS-1123 characters can still render an
invalid name. Update the name generation in the migrator job template to
normalize all remaining non-[a-z0-9-] characters or otherwise restrict
`planeVersion` to a safe format, using the existing
`planeVersion`/`.Release.Name` branch as the place to fix it.
Summary
Adds an opt-in
gitops.enabledflag (defaultfalse) to bothplane-enterpriseandplane-ce, so the charts render deterministically for declarative GitOps tools (Argo CD, Flux) — without changing anything for existinghelm install/helm upgradeusers.gitops.enabled: false(default): renders byte-for-byte identical to today.gitops.enabled: true: omits the per-rendertimestamp: {{ now | quote }}pod annotation, and keys migration Job names to.Values.planeVersion(instead of a wall-clock timestamp in plane-enterprise /.Release.Revisionin plane-ce).Why
Several workload templates inject
timestamp: {{ now | quote }}intospec.template.metadata.annotations, and the migration Jobs derivemetadata.namefrom a per-render value. Under a GitOps reconciler this is fatal:Synced; rolls every pod on every reconcile — each Deployment's pod template differs on each render.field is immutable— Argo CD tries to patch the existing Job, butJob.spec.templateis immutable.Reported in #158 (closed "intentional; couldn't reproduce the migrator breakage") and #206 (the exact immutable-Job failure), then worked around in #207 by making the plane-enterprise Job name timestamp-unique — which avoids the immutable error but runs the migration on every sync and orphans a Job each time. This fixes the root cause while preserving the intended default.
Design — non-breaking, opt-in
nowforces a rollout on everyhelm upgrade— reasonable for imperative users, so it stays the default; only opted-in GitOps users change behavior:gitops.enabled: false(default)gitops.enabled: truetimestampannotationnow/.Release.Revision)planeVersionVersion-keyed Job names are deterministic per release, re-run cleanly on a version bump (new name → new Job; Argo CD prunes the old one), and never hit the immutable-Job patch. The charts already ship
reloader.stakater.com/autoon some workloads — the deterministic, config-driven rollout mechanism — so GitOps users don't lose config-change rollouts by dropping thenowannotation.Proof it doesn't change the default
helm templatewith default values is identical to the current chart (modulo thenowvalues that already differ between any two renders), for both charts:With
gitops.enabled=true, repeated renders are identical and contain nonow:Scope
charts/plane-enterpriseandcharts/plane-ce— thetimestampannotation in their workload templates, version-keyed migration Job names, and thegitops.enabledvalues flag. No default-behavior change in either chart.Relates to #158, #206, #207.
Summary by CodeRabbit
New Features
gitopsconfiguration option to support deterministic Helm rendering across Plane charts.Configuration
gitopsblock (default: disabled). When enabled, per-workloadtimestamppod annotation values are omitted, and migration job naming switches to a version-based scheme (instead of timestamp/revision-based naming) for more repeatable deployments.