Fleet docs v0.2.0-rc.448

A secret, from storage to one turn

A person stores a secret with fleet secret set. The server keeps it encrypted with sops and age. When a turn starts, the server decrypts the project's secrets that are set, the legacy keys that the project's secret_keys names, and the owner's keys. The turn gets them as environment variables, and FLEET_SECRET_KEYS holds their names. No API returns a value.

A project secret is declared by being set: before #357 only the keys in secret_keys reached a turn, so a FORGEJO_TOKEN set with fleet secret set --project reached no worker on any node. At turn start a worker runs fleet kit check [--need NAME,...]. It lists each given key as present or MISSING, and checks the needs it is given: env keys, and the box capabilities kubeconfig and secrets-store. When one is missing it reports the agent blocked with the reason and exits 1.

In a Kubernetes pod

Fact Value Code
Commands fleet secret ls|set|rm [--project P | --mine] [KEY]. The value comes on stdin, 1 MiB at most. fleet/internal/cli/secret.go
Who can write A project secret: a maintainer or an admin. A user secret: only its owner. An agent: nobody. fleet/internal/api/secrets.go
Storage <state>/secrets/values/<project|user>/<owner>/<KEY>.json, key <state>/age.key fleet/internal/secrets/secrets.go
Claude logins A different vault: <state>/creds/, key <state>/creds.age.key fleet/internal/creds/agevault.go
A missing project secret The agent waits secrets.go (ErrMissing)
No git name or email The turn is held secrets.go (ErrNoIdentity)
  • A turn gets no other variable of the parent process. The base environment is PATH, HOME, LANG and TERM (fleet/internal/runner/runner.go).
  • Logs show key names only, never values.
  • The turn gets the access token only. The refresh token stays on the server, so a worker cannot sign out the person on other machines.
  • The user secret GH_TOKEN always goes to the owner's turns, even if the project does not name it. The spec does not say this.
  • The design names a Kubernetes Secret for each turn. The code uses the env file instead, which is not in the Job spec.