Skip to content

feat(gateway): add --enroll-method=kubernetes - #353

Open
bernie-g wants to merge 1 commit into
mainfrom
bernie/pam-341-add-kubernetes-auth-support-for-gateway-enrollment
Open

feat(gateway): add --enroll-method=kubernetes#353
bernie-g wants to merge 1 commit into
mainfrom
bernie/pam-341-add-kubernetes-auth-support-for-gateway-enrollment

Conversation

@bernie-g

@bernie-g bernie-g commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description 📣

Adds --enroll-method=kubernetes to infisical gateway start. The gateway reads its pod's projected service account token and exchanges it for a gateway access token; Infisical verifies it against the cluster's TokenReview API, so no credential has to be distributed to the cluster. Nothing is written to disk, so a fresh token is minted on every start. Rejected for systemd installs, since in-cluster gateways aren't systemd-managed.

Backend side: Infisical/infisical (same branch name). PAM-341.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

Ran in a local kind cluster via the Helm chart. Gateway authenticated, connected through a relay, and reported healthy. Also verified re-auth on pod restart, recovery after revoke, and rejection of wrong namespace / wrong service account / non-service-account / malformed tokens.

infisical gateway start my-gw --enroll-method=kubernetes --gateway-id=<gateway-id> --domain=https://app.infisical.com

@linear

linear Bot commented Aug 4, 2026

Copy link
Copy Markdown

PAM-341

@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-353-feat-gateway-add-enroll-method-kubernetes

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Kubernetes service-account-based enrollment for gateway startup without persisting the resulting access token.

  • Adds typed API request and response models for Kubernetes gateway login.
  • Reads the projected service-account token and exchanges it through the gateway login endpoint.
  • Integrates Kubernetes enrollment with gateway ID/domain persistence and runtime token selection.
  • Rejects Kubernetes enrollment for systemd installation and updates CLI help text.

Confidence Score: 5/5

The PR appears safe to merge with no concrete changed-code failures identified.

The Kubernetes enrollment path consistently resolves the gateway identity and projected token, exchanges it through the existing gateway login boundary, keeps the resulting access token in memory, and feeds it into the established gateway registration lifecycle.

Important Files Changed

Filename Overview
packages/cmd/gateway.go Wires Kubernetes enrollment into gateway startup, token selection, persistence of non-secret state, validation, and systemd rejection.
packages/gateway-v2/kubernetes_auth.go Reads and validates the projected service-account token before exchanging it for a gateway access token.
packages/api/api.go Adds the typed Kubernetes gateway login API operation using the shared HTTP client and error handling.
packages/api/model.go Adds request and response DTOs matching the Kubernetes gateway login exchange.
packages/gateway-v2/constants.go Adds the Kubernetes gateway enrollment-method discriminator.

Reviews (1): Last reviewed commit: "feat(gateway): add --enroll-method=kuber..." | Re-trigger Greptile

Reads the projected service account token of the pod the gateway runs in and
exchanges it for a gateway access token via POST /v3/gateways/login. Infisical
verifies the token against the cluster's TokenReview API, so nothing has to be
distributed to the cluster.

- New LoginGatewayWithKubernetes, with --service-account-token-path to override
  the default projected token mount.
- --enroll-method is now validated, so an unknown value fails with a clear
  message instead of silently falling through to the machine identity path.
- Like AWS auth, no token is written to disk: a fresh one is minted on every
  start, so only the gateway id and domain are persisted.
- Rejected for systemd installs, since in-cluster gateways are not managed by
  systemd, with a message pointing at the container command instead.
@bernie-g
bernie-g force-pushed the bernie/pam-341-add-kubernetes-auth-support-for-gateway-enrollment branch from 219198b to 32295a0 Compare August 4, 2026 17:54
bernie-g added a commit to Infisical/infisical that referenced this pull request Aug 4, 2026
Bumps image.tag from 0.43.84 to 0.43.118, and the two places the helm docs
mirror it. 0.43.118 does not exist yet: it is the next release after v0.43.117
and needs to be the one that carries Infisical/cli#353, so this has to be
confirmed when that release is cut.
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