Budgets, cluster nodes, knowledge

This month's work is about limits and visibility. You can cap what each project spends, see a Kubernetes cluster's nodes from Docks, and give AI agents read-only access to documentation stored outside Shipyard.

A daily budget per project

A project that answers every alert with a diagnostic run can burn through a model budget overnight. A policy block on the project sets the limits:

projects:
  - id: my-app
    repository: you/my-app
    policy:
      kinds: [diagnostic, pipeline]
      max_runs_per_day: 50
      max_cost_per_day_usd: 5

kinds lists the run kinds the project accepts. The two limits count over a rolling 24 hours. Each new run goes through the checks in a fixed order, whoever asked for it:

Diagram of the run policy checks: project enabled, kind allowed, runs in 24 hours and cost in 24 hours, each with its refusal code, ending in a queued run that stores policy_version and policy_reason

A refused kind answers 403 policy_denied. A used-up budget answers 429 budget_exceeded. Retries, Alertmanager diagnostics and health-check pipelines follow the same policy; a refused alert is logged and not queued.

Every admitted run keeps the version of the policy that let it in and the reason in plain words, such as kind pipeline allowed; daily run limit 50; daily cost limit $5.00. The run panel in the console shows both. When you change the policy later, past runs keep the version they had.

Cost comes from the model prices you configure (input_usd_per_mtok, output_usd_per_mtok). Calls without a price add nothing, so set prices before you rely on a cost limit.

One ship that reads the whole cluster

Node ships report on one machine each. For a cluster-wide view, run one ship with SHIP_KUBERNETES=in-cluster from deploy/kubernetes/ship-cluster.yaml. It reads the Kubernetes API as its pod's ServiceAccount and answers the new clusterNodes task:

Example clusterNodes result: four nodes with Ready status, cordon, kubelet version and pressure conditions, next to a note that the ship may only get and list nodes

The result lists every node with its Ready status, cordon, kubelet version, roles and the pressure conditions that are true. Labels, annotations, addresses and capacity stay in the cluster. A cluster with more than 200 nodes returns the first 200 and marks the result as truncated.

The ServiceAccount's role allows get and list on nodes and nothing else: no secrets, no pods, no exec, no writes. The token is read again on every call, so a rotated token is picked up without a restart.

Knowledge bases for AI agents

Agents often need documentation that lives somewhere else, such as the API reference of another application. infra.knowledge connects external MDDB servers and names the collections agents may search:

infra:
  enabled: true
  knowledge:
    - name: docs
      type: mddb
      url: https://kb.example
      api_key_env: DOCS_MDDB_KEY
      description: Product documentation and API reference
      mode: hybrid
      collections: [api, guides]

Access is per principal. A token needs the knowledge.read scope with a grant that names the knowledge base or one of its collections, so two clients on one Shipyard can see different knowledge bases. Anything not granted answers 404, the same as a name that does not exist.

Shipyard only searches. It never writes to, reindexes or deletes from a knowledge base. Hits pass through the credential redactor, are cut to 4000 bytes each, and are returned as cited data that never counts as an instruction. Docks → Knowledge bases shows whether each one answers right now.

Where to read more