Skip to content

refactor(prod): make j26-scoutid-sync self-contained (isolate from dev base) - #48

Merged
scriptcoded merged 2 commits into
mainfrom
prod/scoutid-sync-selfcontained
Jul 5, 2026
Merged

refactor(prod): make j26-scoutid-sync self-contained (isolate from dev base)#48
scriptcoded merged 2 commits into
mainfrom
prod/scoutid-sync-selfcontained

Conversation

@hakan-persson

Copy link
Copy Markdown
Member

Converts the production j26-scoutid-sync overlay from a dev-base overlay into a standalone package, so a dev-side change can no longer silently reach production.

Why

Prod overlays inherit the dev base (resources: ../../app-manifest/…) with targetRevision: main. For scoutid-sync that meant the assignment config (config.yml, config-participants.yml) and the group-mapping CSVs — which drive ~18k prod Keycloak memberships — were inherited verbatim. A dev edit to those would flow straight to prod on the next sync, with no prod review gate. This is the highest-blast-radius instance of the coupling documented in issue #37.

What

Every file the overlay used to inherit is now a prod-owned copy:

  • Env ConfigMaps carry the prod Keycloak host + parent group directly (no more configMapGenerator … merge that only covered named keys).
  • SecretProviderClasses are full copies pointing at the prod KV objects.
  • CronJobs have the prod schedules baked in (staff :15, participants :45).
  • config/CSV bundles are prod copies.
  • No ../../app-manifest reference remains.

Safety

  • Renders byte-identically to the previous overlay (kubectl kustomize diff is empty).
  • Matches the running cluster — the only kubectl diff -k delta is ArgoCD's own tracking-id annotations, which ArgoCD injects. So this is a no-op for the cluster; ArgoCD sees nothing to change.

Tradeoff (accepted)

Prod no longer auto-inherits dev fixes to these files. Genuine dev changes are carried over deliberately, tracked via the dev-PR review routine. This is the intended posture going into camp: prod changes only when prod is deliberately changed.

Companion change: platsbank + scoutin-2 get the same treatment in #39.

🤖 Generated with Claude Code

Convert the prod scoutid-sync overlay to a standalone package so no dev-side
change can silently reach production. This is the highest-value isolation:
the app's assignment config (config.yml, config-participants.yml) and the
group-mapping CSVs drive ~18k prod Keycloak memberships, and were previously
inherited verbatim from the dev base — a dev edit would flow straight to prod
on the next sync with no review gate.

Each prod file is now a copy: the two env ConfigMaps carry the prod Keycloak
host + parent group directly (no configMapGenerator merge), the two SPCs use
the prod KV objects, schedules are baked in (staff :15, participants :45),
and the config/CSV bundles are prod-owned. Renders byte-identically to the
previous overlay; matches the running cluster (only ArgoCD tracking-id
annotations differ, which ArgoCD adds itself).

Tradeoff: genuine dev fixes to these files must now be carried over
deliberately (tracked via the dev-PR review routine).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hakan-persson
hakan-persson requested a review from a team as a code owner July 4, 2026 20:51
Copilot AI review requested due to automatic review settings July 4, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown

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 refactors the k8s/app-manifest-prod/j26-scoutid-sync production overlay to be fully self-contained (no longer inheriting from the dev base), preventing dev-side manifest/config changes—especially the assignment rules and CSV mappings that drive large-scale prod Keycloak memberships—from flowing into prod without an explicit prod change.

Changes:

  • Replace the prod overlay’s ../../app-manifest/j26-scoutid-sync dependency with prod-owned copies of all manifests and config/CSV bundles.
  • Inline prod-specific schedules directly in the CronJob manifests (staff :15, participants :45) and remove the schedule patches.
  • Replace SecretProviderClass patches with full prod-owned SecretProviderClass resources pointing at the intended KV objects.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
k8s/app-manifest-prod/j26-scoutid-sync/kustomization.yaml Removes dev-base reference; lists all prod-owned resources and generators.
k8s/app-manifest-prod/j26-scoutid-sync/cron-job.yaml Adds standalone staff CronJob with prod schedule.
k8s/app-manifest-prod/j26-scoutid-sync/cron-job-participants.yaml Adds standalone participants CronJob with prod schedule and config mount mapping.
k8s/app-manifest-prod/j26-scoutid-sync/configmap.yaml Adds prod env ConfigMap for staff sync.
k8s/app-manifest-prod/j26-scoutid-sync/configmap-participants.yaml Adds prod env ConfigMap for participants sync.
k8s/app-manifest-prod/j26-scoutid-sync/secret-provider-class.yaml Adds prod-owned SecretProviderClass for staff sync secrets.
k8s/app-manifest-prod/j26-scoutid-sync/secret-provider-class-participants.yaml Adds prod-owned SecretProviderClass for participants sync secrets.
k8s/app-manifest-prod/j26-scoutid-sync/secret-provider-class-patch.yaml Removed: no longer patching dev-base SecretProviderClass.
k8s/app-manifest-prod/j26-scoutid-sync/secret-provider-class-participants-patch.yaml Removed: no longer patching dev-base participants SecretProviderClass.
k8s/app-manifest-prod/j26-scoutid-sync/config.yml Adds prod-owned staff assignment rules config.
k8s/app-manifest-prod/j26-scoutid-sync/config-participants.yml Adds prod-owned participants assignment rules config.
k8s/app-manifest-prod/j26-scoutid-sync/function_slugs.csv Adds prod-owned function slug mapping CSV.
k8s/app-manifest-prod/j26-scoutid-sync/group_mappings.csv Adds prod-owned group→village/district mapping CSV.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread k8s/app-manifest-prod/j26-scoutid-sync/configmap.yaml Outdated
Comment thread k8s/app-manifest-prod/j26-scoutid-sync/configmap-participants.yaml Outdated
@hakan-persson
hakan-persson requested a review from scriptcoded July 4, 2026 21:00
Address Copilot on #48: order the two env ConfigMaps as
apiVersion/kind/metadata/data (they were extracted from rendered output,
which alphabetizes keys). Cosmetic only — rendered manifests are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@scriptcoded
scriptcoded merged commit e242471 into main Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants