Repository navigation
fix: admit Dynatron's Conduit clients in every instance to Phorge - #609
Merged
Merged
Conversation
Dynatron now runs one instance per git worktree in the shared k3d cluster: `dynatron` for the main checkout, `dynatron-<slug>` for each worktree. phorge-from-dev-apps selected kubernetes.io/metadata.name: dynatron, so only the main checkout reached web.phorge.svc.cluster.local and every worktree instance timed out. Select on dynamist.se/dev-app: dynatron instead, which every Dynatron namespace carries; the podSelector and port 80 stay as they were. The API server sets the namespace name, while anyone who can create a namespace can set this label, but in a local dev cluster those are the people who could edit the policy anyway. The isolation test now decides which namespaces are admitted by that label rather than by name, and the setup docs say which namespaces reach Phorge.
phorge-from-dev-apps admitted every pod in a namespace labelled dynamist.se/dev-app: dynatron, which includes each instance's postgres, valkey and object store. Only the hub and the worker call Conduit. One from entry now selects both: the namespace by app.kubernetes.io/part-of: dynatron, which every Dynatron instance carries, main or worktree, and the pod by app.kubernetes.io/name in [dynatron, worker]. dynamist.se/dev-app stays the label dev apps are discovered by and is no longer part of the policy. The comment and the setup docs say what that is worth: a namespace label is only as trustworthy as whoever may edit namespaces, and the pod selector narrows the grant, but anyone who can create pods in an admitted namespace can still claim an admitted name. probe_from takes pod labels. The probes from other namespaces now expect an unlabelled pod to be refused everywhere, and new tests in a scratch namespace labelled part-of: dynatron show that dynatron and worker are admitted and postgres is not, so they need no Dynatron deployed beside Phorge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
holmboe
force-pushed
the
dev-app-label-selector
branch
from
October 30, 2026 01:36
4a5b69e to
967f84a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Dynatron runs one instance per git worktree in the shared k3d cluster: namespace
dynatronfor the main checkout, and
dynatron-<slug>for each worktree.phorge-from-dev-appsselectedkubernetes.io/metadata.name: dynatron, so only the main checkout could reach Phorge athttp://web.phorge.svc.cluster.local/api/. Every worktree instance timed out. It also admittedevery pod in that namespace, including Postgres, Valkey and the object store, although only the
hub and the worker call Conduit.
Change
k8s/base/networkpolicy.yaml:phorge-from-dev-appshas onefromentry, and bothselectors in it must match:
app.kubernetes.io/part-of: dynatron, which every Dynatron instancecarries, main or worktree
app.kubernetes.io/name In [dynatron, worker], the hub and the workerThe podSelector on Phorge and port 80 are unchanged. The comment states the trade-off. A
namespace label is only as trustworthy as whoever may edit namespaces. The pod selector
narrows the grant, but anyone who can create pods in an admitted namespace can still give a pod
an admitted name. In a local dev cluster those are the people who could edit the policy anyway.
A production cluster would have to restrict who labels namespaces first.
dynamist.se/dev-appis no longer part of the policy. It stays the label dev apps arediscovered by, in
make destroy, the k8s workflow and the isolation test.tests/k8s/test_isolation.py:probe_fromtakes pod labels. The probes fromdefaultandthe other dev apps' namespaces now expect an unlabelled pod to be refused on all three ports.
New tests run in a scratch namespace labelled
app.kubernetes.io/part-of: dynatronand check:dynatronandworkerare admittedpostgresis refusedThe scratch namespace means the tests need no Dynatron deployed beside Phorge, which is the
case in CI.
docs/phorge-setup.md(the Phorge and in-cluster clients bullets) andCHANGELOG.mddescribe the new policy and its caveat.
Rollout: Dynatron already labels its namespaces
app.kubernetes.io/part-of: dynatronalongsidedynamist.se/dev-app: dynatron, so this can merge without waiting on Dynatron.Checks
make validate: both overlays valid, 17 resources eachuv run ruff check,ruff format,uv run mypy: cleanuv run pytest: 6416 passedDeploy and test Phorge stable in k3d(the PR islabelled
ci:k8s)This revision was not applied to the shared local cluster by hand. Before the revision, an
earlier version that selected only on the namespace label was checked live. Pods in
dynatron,dynatron-test-reportsanddynatron-handle-warningsreachedconduit.ping, and pods indefault,noodleand an unlabelled scratch namespace were refused.🤖 Generated with Claude Code