feat: isolate and enable repository creation #1718
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/enable-repository-creation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
create_repositoryshipped in PR #1716 (v0.1.706) but is inert: nothingconfigures the site-admin Forgejo credential it needs, and nothing runs
the isolated worker it's designed for. This PR wires the isolated side.
BINJOVI_RUNTIME=repo-creatormode configures only a narrowservice_operation_worker(claim_opts: [only: [{"forgejo", "repository","create"}]]) with a site-admin Forgejo credential readfrom its own mounted token. It needs no Kubernetes RBAC:
RepositoryIntakeonly ever queues a create for a name outside thestatic catalog, so
legacy_names/1always resolves to[]andServiceLegacyClientshort-circuits to"absent"without ever makinga request.
service_operation_workernow excludes that same{"forgejo","repository","create"}tuple, so it never attempts anoperation it structurally cannot hold the credential for.
ServiceOperationWorker.run_once/1threads the new:claim_optsthrough to
ServiceOperations.claim/3.ReleaseManifests.agent_release_manifest/2gains the patch block thatkeeps the new
binjovi-repo-creatorDeployment's image current onevery release, alongside every other companion agent — confirmed by
reading
ArgoRelease.publish/3directly: it fully replaces theArgoCD Application's
spec.sourceon every release from exactly thisfunction's output, so a new companion Deployment needs a block here to
keep receiving new images, not a patch in the seanfarm-side bootstrap
seed (that file is a one-time disaster-recovery snapshot, pinned to an
old commit — adding an orphan patch there for a resource that doesn't
exist in that commit's tree would break kustomize's build for a
from-scratch rebuild).
manifests/repo-creator.yaml): its own ServiceAccountwith
automountServiceAccountToken: falseand no Role or RoleBinding,an explicit
openbao-identityprojected volume for the oneaudience-scoped token OpenBao's own Kubernetes-auth method validates
independently, and a mount for its own
forgejo-repo-creatorSecret(delivered by the companion
sean/seanfarmPR). ItsCiliumNetworkPolicy allows only Forgejo, Postgres, OpenBao and DNS
egress — no kube-apiserver.
BINJOVI_MCP_POLICYgrantsbinjovi.repository.createto theexisting binding.
tests/runtime-deployment-contract.shasserts therepo-creator credential is reachable from no other Deployment, the
same way the codeberg credential is already guarded there.
Companion PR: sean/seanfarm#697 (the ForgejoUser/ForgejoToken/RBAC chain
that delivers the credential this release mounts). That PR should merge
and deploy first — this Deployment's Secret volume has nothing to mount
until it does.
Test plan
make check(full local equivalent, including postgres) — green,except one pre-existing, unrelated failure in
evidence_api_test.exs(confirmed via
git stashagainst unmodified trunk; last touched byan old, unrelated commit)
kubectl kustomize manifests/renders cleanly; new Deployment andCiliumNetworkPolicy verified in the output
create_repositoryMCP call creates a disposablerepo and its push-mirror (after sean/seanfarm#697 is live)
https://claude.ai/code/session_01JGe4pyhQ36AhgDfPJry4d3
Repository creation is inert in production: nothing configures the site-admin Forgejo credential it needs, and nothing runs the isolated worker it's designed for. This wires the isolated side: - A new BINJOVI_RUNTIME=repo-creator mode configures only a narrow service_operation_worker (claim_opts: only [{"forgejo","repository", "create"}]) with a site-admin credential read from its own mounted token. It needs no Kubernetes RBAC: RepositoryIntake only ever queues a create for a name outside the static catalog, so legacy_names/1 always resolves to [], and ServiceLegacyClient short-circuits to "absent" without a Kubernetes API call. - The main release's service_operation_worker now excludes that same {"forgejo","repository","create"} tuple, so it never attempts an operation it structurally cannot hold the credential for. - ServiceOperationWorker.run_once/1 threads the new :claim_opts through to ServiceOperations.claim/3. - ReleaseManifests.agent_release_manifest/2 gains the patch block that keeps the new binjovi-repo-creator Deployment's image current on every release, alongside every other companion agent. Claude-Session: https://claude.ai/code/session_01JGe4pyhQ36AhgDfPJry4d3