Skip to content

docs: authenticate to the Kubernetes Proxy with a service-account key or a PAT - #940

Draft
slayerjain wants to merge 1 commit into
mainfrom
docs/k8s-proxy-auth-service-accounts
Draft

slayerjain wants to merge 1 commit into
mainfrom
docs/k8s-proxy-auth-service-accounts

Conversation

@slayerjain

Copy link
Copy Markdown
Member

What

The Kubernetes Proxy REST API page told every caller, CI pipelines included, to exchange a personal access token for the cluster's shared token (POST /get-shared-token, or the Console's Get Shared Token button) and send that token on every call.

That token is the credential the proxy's own in-cluster components (node agents, the external replay runner) authenticate with. It names no user, so a copy held by a CI system carries cluster-wide authority with no owner and no per-consumer revocation. The proxy is being changed (keploy/k8s-proxy#1126) to accept the shared token only on the routes those in-cluster components call, in every RBAC mode, and to answer 403 everywhere else.

This PR moves the docs to the replacement, which the proxy already accepts today:

  • Authentication now sends a key straight in the Bearer header: a service-account key for CI and automation, or a PAT for a person. It covers what a key can call (per-route permissions, enforce vs. the default audit mode), setting up a service account for CI (ITG_RUNNER for keploy cloud replay, ATG_RUNNER for keploy test-suite --cloud, key expiry and rotation), the failure modes, and how long the proxy caches a validation.
  • The PAT to shared-token exchange is documented as deprecated, with the 403 the shared token now gets and how to migrate a script (send the key itself; drop the exchange and the tokenId caching).
  • The quick start, the endpoint reference and the static-deduplication example use the key directly.

Ordering

Sending a PAT or a service-account key directly already works on current proxy releases, so the new instructions are safe to publish before the proxy change. The "the shared token gets 403" statements become true with the k8s-proxy release that carries #1126; this PR should merge with or before it.

Open point for reviewers

Neither runner role a service account can hold includes starting or stopping a recording or an in-cluster replay (record:start, record:stop, replay:start, replay:stop). The page says so, and that under enforce those routes need the key of someone who holds them on the cluster (a cluster admin). Whether a CI pipeline that drives recordings should get a dedicated runner role is a product decision, not made here.

… or a PAT

The Kubernetes Proxy REST API page told callers, CI included, to trade a
personal access token for the cluster shared token and send that token on
every call. The shared token is the credential the proxy's own in-cluster
components use, and the proxy now accepts it only on the routes those
components call.

- Authentication now sends a service-account key (CI and automation) or a
  PAT (a person) straight in the Bearer header. It explains what a key can
  call (per-route permissions, enforce vs. the default audit mode), how to
  set up a service account for CI (ITG_RUNNER / ATG_RUNNER, key expiry and
  rotation), the failure modes, and how long the proxy caches a validation.
- The PAT -> shared-token exchange and the Console's Get Shared Token
  button are documented as deprecated, with the 403 the shared token now
  gets and how to migrate a script.
- The quick start, the endpoint reference and the static-deduplication
  example use the key directly.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>

This branch has not been deployed

No deployments
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.

1 participant