Documentation
¶
Overview ¶
Package install is what an install of Maku needs from its operator, as data (v4 D14): every Secret a component reads, by name, with its keys. The docs' table (docs/install-secrets.md), the umbrella chart's ExternalSecrets (templates/_seams.tpl, written by `task chart:seams`), the components' start-up messages, and step 7's `maku preflight` read this one list.
Index ¶
- Constants
- Variables
- func CheckFiles(read func(string) ([]byte, error), files ...string) error
- func CheckOut(dir string, force bool) error
- func FactoryObjects(in Inputs) (file map[string]any, manifests []byte, err error)
- func InClusterIssuer(issuer string) bool
- func Known(path string) (bool, error)
- func MakuTemplate() (string, error)
- func Names(umbrella map[string]any) map[string]string
- func OutDashSecrets(a Answers) []string
- func Pins(a Answers) map[string]string
- func ResolvePins(ctx context.Context, a Answers, ...) (map[string]string, error)
- func Ruleset(appID string) ([]byte, error)
- func Table() string
- func Template() (string, error)
- func ValidateValue(path string, v any) error
- func Values(in Inputs) (map[string]any, error)
- func Write(dir string, t Tree, force bool) error
- type Answers
- type AppInfo
- type Generated
- type Inputs
- type Key
- type Kind
- type Namespace
- type Question
- type ReadAs
- type Registry
- type Seam
- type Tree
Constants ¶
const ( TableStart = "<!-- seams:start (task chart:seams) -->" TableEnd = "<!-- seams:end -->" )
The markers between which docs/install-secrets.md holds Table's output; gen-seams writes between them.
Variables ¶
var Images = []string{"maku-broker", "maku-run-controller", "maku-harness", "maku-bridge", "maku-factory", "maku-slack"}
Images are the maku images an install pins, by the name an images.pins entry gives.
var Questions []Question
Questions are the wizard's questions, in the order it asks them (IN7). An answers file's keys are their ids; the README's next steps are written from the same answers.
var Seams = []Seam{ {ID: "databaseBroker", Component: "room-broker", Chart: "maku", Value: "broker.database.brokerSecret", Default: "rooms-broker-dsn", Namespace: Release, Keys: uri, ReadAs: Env, Generated: GeneratedPostgres, Doc: "The broker's DSN, as `rooms_broker` (`ROOMS_DATABASE_URL`)"}, {ID: "databaseOwner", Component: "room-broker (migrate)", Chart: "maku", Value: "broker.database.ownerSecret", Default: "rooms-owner-dsn", Namespace: Release, Keys: uri, ReadAs: Env, Optional: true, Generated: GeneratedPostgres, Doc: "The migrations' DSN, as `rooms_owner` (`ROOMS_MIGRATION_DATABASE_URL`); without it nothing is migrated"}, {ID: "databaseRetention", Component: "room-broker-retention", Chart: "maku", Value: "broker.database.retentionSecret", Default: "rooms-retention-dsn", Namespace: Release, Keys: uri, ReadAs: Env, Optional: true, Generated: GeneratedPostgres, Doc: "The retention CronJob's DSN, as `rooms_retention`; without it no CronJob renders"}, {ID: "databaseCA", Component: "room-broker", Chart: "maku", Value: "broker.database.caSecret", Namespace: Release, Keys: caCrt, ReadAs: File, MountPath: "/etc/room-broker/db-ca", Optional: true, Doc: "The database's CA, for `sslmode=verify-full&sslrootcert=/etc/room-broker/db-ca/ca.crt`"}, {ID: "databasePasswords", Component: "rooms-db (demo)", Chart: "agent-factory", Default: "rooms-db-passwords", Namespace: Release, Keys: []Key{{Name: "postgres", Required: true}, {Name: "rooms_owner", Required: true}, {Name: "rooms_broker", Required: true}, {Name: "rooms_retention", Required: true}}, ReadAs: Env, Generated: GeneratedPostgres, Doc: "The bundled Postgres's passwords (`postgres.enabled`, the demo only)"}, {ID: "brokerOIDC", Component: "room-broker", Chart: "maku", Value: "broker.oidc.existingSecret", Namespace: Release, Keys: []Key{{Name: "web-client-id", Required: true, From: "broker.oidc.keys.web", Doc: "oauth2-proxy's client id"}, {Name: "cli-client-id", From: "broker.oidc.keys.cli", Doc: "maku's client id"}, {Name: "project-id", From: "broker.oidc.keys.project", Doc: "the ZITADEL project id (preset zitadel)"}}, ReadAs: File, MountPath: "/etc/room-broker/oidc", Optional: true, Doc: "The OIDC client ids (ids, not secrets): `human.clientIDFile`, `roomctlClientIDFile`, `projectIDFile`"}, {ID: "githubLink", Component: "room-broker", Chart: "maku", Value: "broker.githubLink.existingSecret", Namespace: Release, Keys: []Key{{Name: "client_id", Required: true, From: "broker.githubLink.keys.clientID"}, {Name: "client_secret", Required: true, From: "broker.githubLink.keys.clientSecret"}}, ReadAs: File, MountPath: "/etc/room-broker/github-link", Optional: true, Doc: "The GitHub account link's OAuth client (`human.githubLink`): the factory App's, or an OAuth App's. Its state is bound by a per-flow nonce, so no key material is stored"}, {ID: "brokerTLS", Component: "room-broker", Chart: "maku", Value: "broker.tls.secretName", Default: "room-broker-tls", Namespace: Release, Keys: tlsPair, ReadAs: File, MountPath: "/etc/room-broker/tls", Generated: GeneratedUmbrella, Doc: "The broker's :8443 serving pair"}, {ID: "brokerCA", Component: "run-controller", Chart: "maku", Value: "broker.tls.caSecretName", Default: "room-broker-ca", Namespace: Release, Keys: caCrt, ReadAs: API, Generated: GeneratedUmbrella, Doc: "The CA of the broker's pair, which the run-controller hands each run's bridge"}, {ID: "factoryCA", Component: "room-broker", Chart: "maku", Value: "broker.factoryCA.secretName", Namespace: Release, Keys: caCrt, ReadAs: File, MountPath: "/etc/room-broker/factory-ca", Optional: true, Doc: "The CA of the factory's API certificate (`factoryCAFile`); empty is the system roots"}, {ID: "runModel", Component: "run pods", Chart: "maku", Value: "runController.modelSecret", Default: "agent-model", Namespace: Runs, Keys: []Key{{Name: "base_url", Required: true}, {Name: "model", Required: true}, {Name: "api_key", Required: true}, {Name: "judge_model"}}, ReadAs: Env, Generated: GeneratedDemoModel, Doc: "The runs' model, in `runController.model.mode` secret"}, {ID: "runGit", Component: "run pods", Chart: "maku", Value: "runController.gitSecret", Namespace: Runs, Keys: []Key{{Name: "token", Required: true}}, ReadAs: Env, Optional: true, Doc: "A laptop's one PAT, which every role mounts (demo-only: `demoValues`). Unset, each run mounts its own token, which the factory mints"}, {ID: "factoryApp", Component: "agent-factory", Chart: "maku-factory", Value: "apps.factory.existingSecret", Default: "agent-factory-github", Namespace: Release, Keys: githubApp, ReadAs: File, MountPath: "/etc/agent-factory-github", Generated: GeneratedDemoApp, Doc: "The factory App"}, {ID: "mergerApp", Component: "agent-factory", Chart: "maku-factory", Value: "apps.merger.existingSecret", Default: "agent-factory-merger", Namespace: Release, Keys: githubApp, ReadAs: File, MountPath: "/etc/agent-factory-merger", Optional: true, MountOptional: true, Doc: "The merger App (`apps.merger.mode` separate)"}, {ID: "agentsApp", Component: "agent-factory", Chart: "maku-factory", Value: "apps.agents.existingSecret", Namespace: Release, Keys: githubApp, ReadAs: File, MountPath: "/etc/agent-factory-agents", Optional: true, Doc: "The agents App: each run's token and the publisher's"}, {ID: "factoryOIDC", Component: "agent-factory", Chart: "maku-factory", Value: "oidcSecret", Default: "agent-factory-oidc", Namespace: Release, Keys: []Key{{Name: "<client>", Doc: "one key per file `config.api.clientIDFiles` names"}}, DynamicKeys: true, ReadAs: File, MountPath: "/etc/agent-factory-oidc", Doc: "The client ids the run API accepts human tokens from (ids, not secrets)"}, {ID: "intake", Component: "agent-factory", Chart: "maku-factory", Value: "intakeSecret", Default: "agent-factory-intake", Namespace: Release, Keys: []Key{{Name: "token", Required: true}}, ReadAs: File, MountPath: "/etc/agent-factory-intake", Optional: true, MountOptional: true, Doc: "The RunLore intake's bearer token (`config.runlore.tokenFile`)"}, {ID: "zitadelReader", Component: "agent-factory", Chart: "maku-factory", Value: "zitadelReaderSecret", Default: "agent-factory-zitadel-reader", Namespace: Release, Keys: []Key{{Name: "reader.json", Required: true, Doc: `{"pat", "githubIdpId"}`}}, ReadAs: File, MountPath: "/etc/agent-factory-zitadel-reader", Optional: true, MountOptional: true, Doc: "The ZITADEL reader (`config.api.access.readerFile`), until the GitHub link replaces it"}, {ID: "factorySponsored", Component: "agent-factory", Chart: "maku-factory", Value: "sponsoredSecret", Default: "agent-factory-sponsored", Namespace: Release, Keys: []Key{{Name: "<name>-client-id", Doc: "one per sponsored principal"}, {Name: "project-id", Doc: "preset zitadel"}}, DynamicKeys: true, ReadAs: File, MountPath: "/etc/agent-factory-sponsored", Optional: true, MountOptional: true, Doc: "The sponsored principals' client ids"}, {ID: "factoryBrokerCA", Component: "agent-factory", Chart: "maku-factory", Value: "brokerCASecret", Default: "openbao-ca", Namespace: Release, Keys: caCrt, ReadAs: File, MountPath: "/etc/agent-factory/openbao-ca", Generated: GeneratedUmbrella, Doc: "The CA of the broker's pair (`config.broker.caFile`)"}, {ID: "factoryAPITLS", Component: "agent-factory", Chart: "maku-factory", Value: "api.tls.secretName", Namespace: Release, Keys: tlsPair, ReadAs: File, MountPath: "/etc/agent-factory-api-tls", Optional: true, Generated: GeneratedCertManager, Doc: "The run API's serving pair (`api.tls`), cert-manager's when `issuerRef` is set"}, {ID: "webProxy", Component: "rooms-web-proxy", Chart: "agent-factory", Value: "webProxy.existingSecret", Namespace: Release, Keys: []Key{{Name: "client-id", Required: true, From: "webProxy.keys.clientID", Doc: "the web client"}, {Name: "client-secret", Required: true, From: "webProxy.keys.clientSecret"}, {Name: "cookie-secret", Required: true, From: "webProxy.keys.cookieSecret", Doc: "32 random bytes, base64url"}}, ReadAs: Env, Optional: true, Doc: "The web front door's client and cookie secret (`webProxy.enabled`)"}, {ID: "slackApp", Component: "factory-slack-app", Chart: "maku-slack", ValuesKey: "slack", Value: "slackSecret", Default: "factory-slack-app", Namespace: Release, Keys: []Key{{Name: "signing-secret", Required: true}, {Name: "bot-token", Required: true}, {Name: "bot-user-id", Required: true}}, ReadAs: File, MountPath: "/etc/factory-slack-app/slack", Optional: true, Doc: "The Slack App's signing secret and bot (`slack.enabled`)"}, {ID: "slackPrincipal", Component: "factory-slack-app", Chart: "maku-slack", ValuesKey: "slack", Value: "principalSecret", Default: "factory-slack-principal", Namespace: Release, Keys: []Key{{Name: "client-id", Required: true}, {Name: "client-secret", Required: true}, {Name: "project-id", Doc: "preset zitadel"}}, ReadAs: File, MountPath: "/etc/factory-slack-app/principal", Optional: true, Doc: "The Slack App's client credentials at the IdP: its sponsored principal"}, {ID: "slackWebhook", Component: "factory-slack-app, room-broker", Chart: "maku-slack", ValuesKey: "slack", Value: "webhookSecret", Default: "room-broker-webhook-slack-app", Namespace: Release, Keys: []Key{{Name: "signing-key", Required: true}}, ReadAs: File, MountPath: "/etc/factory-slack-app/webhook", Optional: true, Doc: "The key the broker signs the App's webhooks with; the broker mounts it too (`maku.broker.webhooks[slack-app].existingSecret`)"}, {ID: "gatewayProvider", Component: "maku-gateway", Chart: "maku-gateway", Value: "providers", Namespace: Release, Keys: []Key{{Name: "apiKey", Required: true, Doc: "renamed by the provider's `key`"}}, ReadAs: API, Optional: true, Instances: true, Doc: "Each model provider's key: `providers.<name>.existingSecret`; its ExternalSecret id is `gatewayProvider.<name>`"}, }
Seams is every Secret the charts and components read, in docs order.
Functions ¶
func CheckFiles ¶
CheckFiles refuses a file under a seam's mount that is missing or holds nothing but space, naming the seam, its Secret and the key. A file under no mount is another check's, and one under an optional mount is refused at use, as before. read is os.ReadFile outside tests.
func CheckOut ¶ added in v0.48.0
CheckOut refuses an output directory before anything is asked or created (IN6): a non-empty one without force, and one holding secrets/, which is never overwritten. The command calls it first, since the Apps' keys exist only once, in memory, until they are written.
func FactoryObjects ¶ added in v0.48.0
FactoryObjects is the factory's file and its objects (D8): the file goes into the values (maku-factory.config), the objects into factory/. Before the split the file must parse as the factory's own config, so what is written starts.
func InClusterIssuer ¶ added in v0.48.0
InClusterIssuer reports whether a ServiceAccount issuer is the in-cluster API server (kind, k3s, kubeadm): its JWKS is reachable only from inside, and only with the discovery binding.
func MakuTemplate ¶
MakuTemplate is charts/maku/templates/_seams.tpl: the maku chart's own seams, for its preflight's Secret checks (v4 D24), whose names the chart resolves from its own values.
func Names ¶
Names maps every Secret name an install with these umbrella values reads to its seam id: each seam's value (or its alias), else its default, and every provider's existingSecret.
func OutDashSecrets ¶ added in v0.48.0
OutDashSecrets is the Secrets `--out -` leaves to the user: the ones secrets/ would have held.
func ResolvePins ¶ added in v0.48.0
func ResolvePins(ctx context.Context, a Answers, digest func(ctx context.Context, image, tag string) (string, error)) (map[string]string, error)
ResolvePins fills the digests the answers do not give, for the images this install runs.
func Ruleset ¶ added in v0.48.0
Ruleset is the merge gate's ruleset (docs/factory.md#branch-protection-for-the-merge-gate): required for agent pull requests, bypassed on pull requests by the maintain, write and admin roles and by the factory App, which posts maku/merge-gate and merges (the merger folded in).
func Template ¶
Template is charts/agent-factory/templates/_seams.tpl: the seams as JSON, for the umbrella's ExternalSecrets.
func ValidateValue ¶ added in v0.48.0
ValidateValue checks v, the value a question writes at path, against every schema that judges it. The error is the schema's own, as `helm template` would print it.
Types ¶
type Answers ¶ added in v0.48.0
Answers is one install's answers, by question id: a string, a bool or a list of strings, as the question's Kind says. An answers file (--answers) is this map in YAML.
func Ask ¶ added in v0.48.0
Ask asks each applicable question on out, reading one line from in for each, and re-asks an answer the validators refuse (up to three times). An empty line takes the default.
func DecodeAnswers ¶ added in v0.48.0
DecodeAnswers reads an answers file strictly: every key is a question's id, every value its question's kind. Unanswered questions take their defaults later (Resolve), so CI files stay short.
func Resolve ¶ added in v0.48.0
Resolve completes a: each applicable question takes its default when unanswered, and every answer is validated. Answers to questions that do not apply are refused, so a file cannot carry dead keys. Warnings (F4) are returned for the caller to print.
func (Answers) Encode ¶ added in v0.48.0
Encode writes a as an answers file, in the questions' order: what --answers reads back.
type AppInfo ¶ added in v0.48.0
type AppInfo struct {
ID int64
Slug string
HTMLURL string
ClientID string
PEM githubapps.Secret // created only; prints as [redacted]
ClientSecret githubapps.Secret // the factory App's OAuth client secret, created only (R5)
}
AppInfo is one GitHub App the install runs on: created by the manifest flow (with its credentials, which go to secrets/ only), or an existing one named by the answers.
type Generated ¶
type Generated string
Generated names what writes a seam's Secret in some installs, where an ExternalSecret of the same name would fight it: the umbrella's bundled Postgres, the umbrella itself (its TLS), the demo's model or App values, the factory's run-token writer, or cert-manager. "" is the operator's alone.
const ( GeneratedPostgres Generated = "postgres" GeneratedUmbrella Generated = "umbrella" GeneratedDemoModel Generated = "demo-model" GeneratedDemoApp Generated = "demo-app" // GeneratedCertManager: cert-manager's Certificate writes it when the chart's issuerRef is set. GeneratedCertManager Generated = "cert-manager" )
The writers.
type Inputs ¶ added in v0.48.0
type Inputs struct {
Answers Answers
Factory AppInfo
Agents AppInfo
Pins map[string]string // image -> <version>@sha256:<digest>
// Generated random values: the oauth2-proxy cookie secret and the Slack App's webhook key.
CookieSecret string
WebhookKey string
}
Inputs is everything an install's files are written from.
func (Inputs) FactoryAppID ¶ added in v0.48.0
FactoryAppID is the factory App's id: the merge gate's status author and bypass actor.
type Key ¶
type Key struct {
Name string `json:"name"`
Required bool `json:"required"`
// From is a values path, in the seam's chart, that renames this key when set.
From string `json:"from,omitempty"`
Doc string `json:"-"`
}
Key is one key of a seam's Secret.
type Namespace ¶
type Namespace string
Namespace is where a seam's Secret lives: the release's namespace, or the runs' one.
type Question ¶ added in v0.48.0
type Question struct {
ID string
Prompt string
Kind Kind
// Default is the answer when none is given; nil (or a nil result) makes the question required.
Default func(a Answers) any
// When gates the question on earlier answers; nil is always asked.
When func(a Answers) bool
// Keys are the values paths (prefixes) the question writes: the IN7 table's last column.
Keys []string
// Values is the answer's values, by dotted path. Lists at one path from two questions append.
Values func(v any, a Answers) map[string]any
// Check refuses what no schema can (an error), or warns (a non-empty warning).
Check func(v any, a Answers) (warning string, err error)
}
Question is one seam the wizard asks about (IN7). Values is what an answer writes into the umbrella's values, by dotted path: each path is checked against the charts' own schemas (ValidateValue), so the wizard refuses what the chart refuses. Check adds what no schema says.
type ReadAs ¶
type ReadAs string
ReadAs is how a component reads a seam: an environment variable, a mounted file, or the Kubernetes API.
type Registry ¶ added in v0.48.0
type Registry struct {
HC *http.Client
Base string // empty is https://ghcr.io
}
Registry is where the images' digests are read when the answers give none: ghcr.io, anonymously.
type Seam ¶
type Seam struct {
ID string `json:"id"`
Component string `json:"component"`
Chart string `json:"chart"` // the chart whose values name it
// ValuesKey is the chart's key in the umbrella's values when its alias differs (maku-slack is
// slack); "" is Chart.
ValuesKey string `json:"valuesKey,omitempty"`
Value string `json:"value"` // its values path in that chart; "" is a fixed name
Default string `json:"default"` // the name when the values set none; "" is none
Namespace Namespace `json:"namespace"`
Keys []Key `json:"keys"`
ReadAs ReadAs `json:"readAs"`
MountPath string `json:"mountPath,omitempty"` // a file seam's directory in the component
Optional bool `json:"optional"`
// MountOptional: the chart mounts it optional, so a missing file is a configuration the
// component refuses at use (an intake with no token), never a failed start.
MountOptional bool `json:"mountOptional,omitempty"`
Generated Generated `json:"generated,omitempty"`
// DynamicKeys: the keys are named by the component's config (one per client, one per
// sponsored principal), so a list of keys cannot be checked.
DynamicKeys bool `json:"dynamicKeys,omitempty"`
// Instances: Value is a map whose every entry names its own Secret in existingSecret, its key
// in key (default Keys[0]); the ExternalSecret id is <id>.<entry>.
Instances bool `json:"instances,omitempty"`
Doc string `json:"-"`
}
Seam is one Secret an install provides: its id, who reads it and how, the chart value that names it and its default name, and its keys.
func (Seam) UmbrellaKey ¶ added in v0.48.0
UmbrellaKey is the seam's chart's key in the umbrella's values.
type Tree ¶ added in v0.48.0
Tree is the wizard's output, by path.