Repository navigation
feat: pull production image privately - #31
Conversation
darkmatteragent
left a comment
There was a problem hiding this comment.
I independently re-verified the analyze stage's approve and concur: the two-file diff is correct, correctly scoped, and introduces no provable defect. I kept zero findings, and I did not adopt any of the "unanswered question" gaps as findings because none is anchored to a demonstrated fault.
What I traced from the changed lines to their consumers:
-
Patch target matches exactly one resource.
ghcr-pull-secret.patch.yamlis a bare strategic-merge patch (registered underpatches:with onlypath:, notarget:), so kustomize matches it by apiVersion/kind/name. I enumerated every Deployment in the production overlay's resource closure (../../deploy/kubernetes/base+../../deploy/kubernetes/database): the only one namedagent-demo-webisops/deploy/kubernetes/base/web-deployment.yaml(apps/v1).web-service.yamlcarries the same name but kind Service, and the database overlay contains only a CNPG Cluster, ScheduledBackup, and NetworkPolicy — none can collide. So the build cannot fail on a missing or ambiguous target. -
No sibling-patch interaction.
replicas.patch.yamltouches onlyspec.replicas,resources.patch.yamlonlyspec.template.spec.containers[name=web].resources(a merge-by-name list, so it will not clobberimagePullSecrets), andruntime-config.patch.yamltargets a different kind (ConfigMapagent-demo-runtime). Strategic merges over disjoint fields are order-independent, so the new entry's first position in thepatcheslist is harmless. -
The private-image claim holds on the consumer side. Production rewrites
ghcr.io/example/agent-demo:replace-metoghcr.io/darkmatter/template@sha256:7985fb…, and.github/workflows/publish-production-image.yamlpublishes exactlyghcr.io/darkmatter/template. So the pull secret lands on the one workload that actually consumes the private package; the digest pin also satisfiesops/policies/security/image-policy.yaml. Dev/staging still use theghcr.io/example/agent-demoplaceholder, consistent with the PR body's "production-only" requirement, and the CNPG cluster image is public — nothing else needs the secret. -
The out-of-repo Secret is documented repo practice, not an invariant inversion. AGENTS.md (Secrets section) says environment compositions should reference secrets through their GitOps controller rather than copying values into
ops/environments/, andops/README.mdrecords the same model fortemplate-postgres-backup-r2, which is referenced by name inops/deploy/kubernetes/database/cluster.yamland provisioned indarkmatter/gitops.template-ghcr-pullfollows the same convention (and thetemplate-prefix). The PR body explicitly declares the companion PR and its required ordering, so raising "the Secret might be missing" would restate the declared dependency and speculate about a PR outside the evidence. -
No collateral breakage. The digest-pinning step in the publish workflow regex-matches
^ digest: sha256:[0-9a-f]{64}$; the added- path: ghcr-pull-secret.patch.yamlline is differently indented and does not disturb it.ops/bin/deployonly runskubectl kustomize, unchanged. The new file matches the sibling patches' YAML style, sobun run fmt:check(oxfmt, 80 width,ops/**not excluded) has nothing to reformat. The patch needs nometadata.namespace— unspecified namespace matches, and the overlay assignstemplate-productionto all resources.
Risks I considered and deliberately did not raise: (a) if the companion Secret is absent/misnamed, the rollout stalls in ImagePullBackOff — but that ordering is declared in the PR body, is recoverable once the Secret lands, and mirrors the accepted R2-credential precedent, so it is the documented design, not a defect; (b) adding imagePullSecrets mutates the pod template and rolls all three replicas — inherent, expected k8s behavior with the default RollingUpdate, not an outage; (c) CI has no kustomize overlay build and mergeable_state: unstable is undiagnosed — both pre-existing gaps outside this diff's lines and not reportable against it.
Conclusion: approve. The change is additive, production-only, credential-free, matches a live target, and follows the repo's documented GitOps secret-referencing model.
Summary
Configure only the production Deployment to use the namespace-local template-ghcr-pull imagePullSecret. The GHCR package remains private.
Dependency
The companion GitOps PR provisions the matching encrypted Kubernetes Secret before ArgoCD deploys this overlay.
Validation