Skip to content

Establish Kubernetes permissions with one listing instead of twenty-six probes - #11

Merged
btriapitsyn merged 1 commit into
mainfrom
perf/rbac-single-listing
Aug 7, 2026
Merged

Establish Kubernetes permissions with one listing instead of twenty-six probes#11
btriapitsyn merged 1 commit into
mainfrom
perf/rbac-single-listing

Conversation

@btriapitsyn

Copy link
Copy Markdown
Collaborator

The readiness check took 5.4 seconds on Windows, and the Secure Workspaces settings page waits on it — so the page looked stuck every time it was opened.

Measured rather than guessed. The twenty-six kubectl auth can-i calls account for 3.6 of those seconds, and the cost is process creation, not the cluster:

one probe alone 276 ms
26 probes, concurrency 8 3595 ms
26 probes, concurrency 16 4246 ms
26 probes, concurrency 26 3883 ms
auth can-i --list, one call 251 ms

Raising the concurrency does not help, which is the evidence that there is nothing left to parallelise — the spawns themselves saturate.

Why parsing a human-readable table is acceptable here

It is used only to grant. A permission the parsed rules clearly cover is settled; anything else falls through to the explicit probe that was always there — an unfamiliar row, a wildcard shape the parser does not handle, or a listing that failed outright. A parse that understands less is slower, never wrong. An admin account's single *.* rule settles all twenty-six, so the common case makes one call and no probes.

Two shapes are deliberately not read as grants:

  • a row whose resource column is empty describes a URL path ([/healthz] [] [get]), not an API resource — reading it as one would hand out get on whatever was asked about;
  • a rule naming specific objects (secrets [] [one-secret] [get]) does not grant the verb on the resource in general.

Testing

Six tests over real admin output, a namespace-scoped role, and the shapes above, including that an unreadable listing settles nothing. Full suite on Windows: 157 passed, 3 skipped, 0 failed.

…ix probes

The readiness check took 5.4 seconds on Windows, and the settings page waits on
it, so Secure Workspaces looked stuck every time it was opened. Measured rather
than guessed: the twenty-six `auth can-i` calls account for 3.6 of those seconds.
Not the cluster — a single probe is 276ms and the round trips overlap — but
creating twenty-six processes. Raising the concurrency confirms it: 8 gives
3595ms, 16 gives 4246ms, 26 gives 3883ms. There is nothing left to parallelise.

`auth can-i --list` answers for all of them in one call, measured at 251ms.

That listing is a table meant for people, so it is used only to grant. A
permission its rules clearly cover is settled; anything else — an unfamiliar row,
a wildcard shape this parser does not handle, a call that failed outright — falls
through to the same explicit probe as before. A parse that understands less is
slower, never wrong, and an admin account's single wildcard rule settles all
twenty-six.

Two shapes are deliberately not read as grants: a row whose resource column is
empty describes a URL path rather than an API resource, and a rule naming
specific objects does not grant the verb on the resource in general.
@btriapitsyn
btriapitsyn merged commit b263b90 into main Aug 7, 2026
7 checks passed
@btriapitsyn
btriapitsyn deleted the perf/rbac-single-listing branch August 7, 2026 14:00
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.

2 participants