Skip to content
Skip to Content
Authentication

Authentication

kobe uses AccessPolicy CRDs for both authentication (who can call the API) and authorization (which pools, at what TTL, how many concurrent leases).

Each AccessPolicy configures one authentication method. You can have several policies in the same watch namespace for different teams or identity providers.

Auth methods

MethodUse case
oidcGitHub Actions, Clerk, Auth0, or any OIDC provider
sshDeveloper workstations using an SSH agent (Ed25519)
tokenBearer token stored in a Kubernetes Secret

The CRD also has an auth.serviceAccount field. The operator does not authenticate Kubernetes ServiceAccount tokens today. In-cluster callers use a static token or OIDC.

AccessPolicy structure

apiVersion: kobe.kunobi.ninja/v1alpha1
kind: AccessPolicy
metadata:
  name: github-ci
  namespace: kobe-system
spec:
  # Authentication method — exactly one should be set.
  auth:
    oidc:
      issuer: https://token.actions.githubusercontent.com
      audience: ["kobe-system"]

  # Identity template — interpolated from JWT claims.
  # Defaults to "{sub}". Ignored for token auth.
  identity: "{repository}:{ref}"

  # Authorization rules — first matching rule wins.
  rules:
    - match:
        claim: repository
        value: my-org/my-repo
      pools:
        - "ci-*"
      maxTtl: 1h
      maxConcurrentLeases: 3
      maxExtensions: 2
      # Optional and kind-specific. Omitting this block denies Sandbox APIs
      # without changing the Cluster lease grant above.
      sandbox:
        pools: ["agent-*"]
        verbs: [lease, exec, logs, port-forward, release]
        maxTtl: 2h
        maxConcurrentLeases: 2
        maxExtensions: 2
        resourceCeiling:
          maxCpu: "4"
          maxMemory: 8Gi

Place the object in the operator watch namespace (operatorNamespace on the chart).

Authorization rules

FieldDescription
poolsPool name patterns. * suffix wildcard (for example ci-*) and literal * for all pools.
maxTtlMaximum TTL the caller can request. Longer requests are capped.
maxConcurrentLeasesHow many active cluster leases this identity can hold at once.
maxExtensionsHow many times a cluster lease can be extended via PATCH /v1/leases/:id.
sandboxOptional, independent Sandbox grant. Missing means Sandbox access is denied.

The sandbox block scopes SandboxPool names and verbs separately from cluster pools. lease permits create plus read/list of the caller's own Sandbox leases; release is independently revocable. exec, logs, and port-forward are consumed by the restricted Sandbox execution API.

The Sandbox block carries its own maxExtensions, defaulting to 2, governing PATCH /v1/sandbox-leases/:id. An extension can never move expiry past maxTtl measured from readiness. Set 0 to forbid extension.

sandbox.maxIdle changes that ceiling. Absent, lifetime is age from readiness. Present, each extension is bounded by now + maxIdle, so a box that is still being used lives and an abandoned one is reclaimed. maxExtensions does not apply while maxIdle is set. The effective window is the lower of this grant and the pool's maxIdle.

resourceCeiling.maxCpu and maxMemory are Kubernetes quantities compared against the sum of all container limits in the selected SandboxPool. Invalid quantities fail closed. Sandbox concurrency is counted separately from ClusterLease concurrency. A quarantined Sandbox keeps consuming its quota until cleanup is proven.

For OIDC policies, a match clause applies different rules to different roles or repositories. The first rule whose match clause passes is used. Rules without match always apply.

Identity template

The identity field controls how kobe derives a stable identity string from the authenticated caller. That string is stored on the lease and used for concurrency tracking.

# GitHub Actions: include the repo and ref
identity: "{repository}:{ref}"

# Clerk: use the user ID
identity: "{sub}"

# Multi-level claim (dot-path)
identity: "{private_metadata.team}:{sub}"

For token auth, identity is the AccessPolicy name. The identity field is ignored.

Available for:
Apple macOS logomacOSMicrosoft Windows logoWindowsLinux logoLinux
Download Kunobi