Repository navigation
Let an instance be deployed as the control plane - #480
Merged
Merged
Conversation
Operational actions reach several clusters at once - a tenant's active and its standby - and today every client carries its own table of which hostname is which. That table belongs in one place. `actionbase.role` decides what an instance is. It defaults to `DATA`, so an existing deployment that sets nothing keeps behaving exactly as it does now, with no `/control` surface at all. Setting `CONTROL` adds the operational endpoints. One binary, two roles, deployed as separate processes with different config. A control instance carries storage drivers it never opens; that is the price of not maintaining a second artifact, image, and release, and the runtime isolation is the same either way. Topology is deployment config resolved at startup, so a relative or blank URL fails the boot rather than the first request. Fanout is opt-in and forgiving: asking for the standby on an unpaired tenant reaches the active only, since a caller should not have to know which tenants are paired. `/control` joins the read-only filter's prefixes so a future write there is refused in read-only mode. Nothing calls out to a cluster yet. Part of #370
ReadOnlyRequestFilterTest claims that adding an endpoint without classifying it breaks the build. It does not: EndpointScanner evaluates @conditional against a bare environment, so every conditionally registered controller drops out of the scan and the check passes by not looking. The /control endpoints escaped it, and so had thirteen HBase datastore endpoints since they were added - seven of them writes that a read-only instance must refuse. Satisfy the conditions in the scanner and classify what becomes visible. The control prefix also gets a filter test of its own, since every /control endpoint is a GET today and nothing else would notice if the prefix were dropped from the filter. Also: fail the boot when a CONTROL instance configures no tenants, same reasoning as the url checks; pin the unknown-tenant 400 over HTTP; move the topology model out of the api package, since env and side become authorization inputs and non-api code should not reach into api to get them; and note that namespace is declared rather than reconciled. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A control instance answering a graph query would run it against its own cluster rather than the one the caller meant, and a console pointed at the control plane could issue DDL there by accident. The routing layer was the only thing standing in the way, which leaves a direct hit on the pod unguarded. One filter, both directions: DATA refuses /control, CONTROL refuses the data prefixes, reads included. It refuses by data prefix rather than allowing only /control because health lives under /graph - an allowlist would fail readiness on every control pod and take the actuator endpoints with it. The prefix sets move to PathPrefixes so this filter and the read-only one cannot come to disagree about what the data plane is. The endpoint classification grows a CONTROL set, and both filter tests now decide against the same four sets, so the exhaustiveness check carries both. The http surface is all this gates. A control instance still opens the datastore and initializes the graph, because that configuration is required of every instance; that one is left for later. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Turning kc.graph.use-token on protected the data plane and left the control plane open: protectedPaths named /graph/v2 and /graph/v3 only, so /control/topology answered any caller with the tenant list, their environments and namespaces. An operator enabling auth has no reason to expect the newer surface to be exempt, and the cross-cluster operations that land under the same prefix next would inherit the exemption. The filter had no test. It has one now, including that the probes still answer unauthenticated - protecting those would fail readiness on every pod. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The token filter still spelled its prefixes out, which is how it came to disagree with the others about what is worth protecting in the first place. Splitting GRAPH from QUEUE names the slice each filter actually wants, and leaves the queue omission visible in the code rather than buried in a literal - a test pins it as a decision instead of an accident. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 task done
This was referenced Aug 6, 2026
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.
Summary
Operational actions reach several clusters at once — a tenant's active and its standby — and every client carries its own table of which hostname is which. That table belongs in one place.
actionbase.roledecides what an instance is. It defaults toDATA, so an existing deployment that sets nothing keeps behaving exactly as it does now, with no/controlsurface at all.CONTROLadds the operational endpoints.One binary, two roles, deployed as separate processes with different config. A control instance carries storage drivers it never opens; that buys us one artifact, one image, one release instead of two, and the runtime isolation is the same either way. This is a departure from the original sketch of a standalone
control-servermodule — the dependency argument for splitting turned out to be about image size, not correctness.Nothing calls out to a cluster yet.
Part of #370
Changes
ServerRoleand@ConditionalOnControlRole, mirroring@ConditionalOnHBaseDatastoreactionbase.control.tenants.*, resolved at startup so a relative or blank URL, or no tenants at all, fails the boot rather than the first requestGET /control/topologyand/control/topology/{tenant}ServerRoleRequestFilter: the two roles serve exclusive surfaces,DATArefusing/controlandCONTROLrefusing/graph/v2,/graph/v3and/queue/v1/controlto the read-only filter's prefixesFanout is opt-in and forgiving: asking for the standby on an unpaired tenant reaches the active only, since a caller should not have to know which tenants are paired.
Roles serve exclusive surfaces
A control instance answering a graph query would run it against its own cluster rather than the one the caller meant, and a console pointed at the control plane could issue DDL there by accident. Leaving that to the routing layer leaves a direct hit on the pod unguarded, so one filter enforces it in both directions, reads included.
It refuses by data prefix rather than allowing only
/control, because health lives at/graph/health: an allowlist would fail readiness on every control pod and take the actuator endpoints with it.PathPrefixesholds the prefix sets so this filter and the read-only one cannot come to disagree about what the data plane is.A hole in the read-only exhaustiveness check
ReadOnlyRequestFilterTestclaims that adding an endpoint without classifying it breaks the build. It did not.EndpointScannerevaluates@Conditionalagainst a bare environment, so every conditionally registered controller dropped out of the scan and the check passed by not looking.The
/controlendpoints escaped it, and so had thirteen HBase datastore endpoints since #478 and #479 added them — seven of them writes a read-only instance must refuse, includingDELETE /graph/v3/datastore/hbase/tables/{tableName}andPOST .../replication/enable. The scanner now satisfies the conditions, and everything it surfaces is classified. That part is a pre-existing gap rather than something this branch introduced, but it could not be fixed by halves.How to Test
DefaultRoleE2ETestpins the compatibility claim: no role configured meansDATAand a 404 on/control/topology.ControlRoleE2ETestpins the other side — a control instance 404s/graph/v3/databasesand still answers/graph/health/liveness.Not touched
Only the http surface is gated. A
CONTROLinstance still opens the datastore and initializes the graph, since that configuration is required of every instance; skipping it reaches into readiness and warm-up, and is better done once we know the deployment shape. Note thatkc.graph.warmupmust stay off on a control instance — it calls the data plane it is refused.AI Assistance