Architecture

Custos is one reconciler, the CredentialConfigManager, plus a gather command, custos gather, that runs as a Job in the instance namespace.

One pass

Each reconcile of a CredentialConfig runs the whole flow and writes the outcome to its status:

  1. Suspend. With spec.suspend set, nothing else runs, and a Secret written earlier stays in place.

  2. Context. Custos reads the namespace’s chrysopoeia annotations to find the claim the instance belongs to. Without them, the instance is a plain helm install and the Secret lands in the instance namespace.

  3. Validate. The value mapping is checked; a mapping that cannot work goes Failed and never starts a Job.

  4. Gather. Only for objectRef and exec sources, see below.

  5. Resolve. const and claimParam values are read directly, then template values are rendered from the others, see Templating.

  6. Write. Custos applies the target Secret and records its name in status.secretName, see Where the Secret lands.

  7. Clean up. A settled gather Job is deleted.

Most failures are a phase, not an error: a retry cannot fix a mapping that does not render or a target name that is taken, so they are reported as Failed instead of backing off forever.

Why a gather Job

Custos itself may read and write Secrets, ConfigMaps and Jobs, but not arbitrary kinds and not pods/exec. objectRef and exec sources need exactly that, inside one instance namespace. So custos writes a plan, the list of what to read, into a ConfigMap and starts a Job in the instance namespace that runs custos gather as instance-admin, the ServiceAccount chrysopoeia creates there. The Job writes the gathered values into a Secret and its outcome into a ConfigMap, which custos reads back.

That keeps every cluster-wide grant out of custos, and the permissions of the Job end at the instance namespace. When a gather runs and how it retries is described in When a gather runs.

Owned resources

Resource Where and why

Target Secret

Beside the claim, or in the instance namespace without one. Cross-namespace, so a finalizer on the CredentialConfig removes it instead of an owner reference.

Plan ConfigMap, gather Job, gathered Secret, result ConfigMap

In the instance namespace, owned by the CredentialConfig. Only created for objectRef and exec sources.