Architecture

Chrysopoeia turns a Helm chart into a kind users can order, records every change to an ordered instance, and deploys the approved state with Flux. It is one controller manager, chrysopoeia controller, plus an optional API proxy, chrysopoeia proxy, for harnessed operators.

From chart to CRD

The ClaimDefinitionManager reconciles ClaimDefinitions in the controller’s own namespace only.

  1. It loads the chart from the Flux OCIRepository in spec.reference.

  2. It generates a CRD from the chart’s values.yaml, see values.yaml hints. The API group is the ClaimDefinition’s name plus .helmetica-bundles.io, the version is bundle, and kind and plural come from spec.crdNames.

  3. It pins the versions a claim may pick, the spec.version enum, to the tags the Flux ImageRepository in spec.versionDiscovery discovered, newest first.

The generated CRDs carry the label chrysopoeia.io/managed. Deleting a ClaimDefinition leaves its CRD in place, so existing instances keep working.

Per claim

The DynamicReconcilerManager watches the generated CRDs and starts the following reconcilers for each of them, and stops them when the CRD is deleted.

Reconciler What it does

RevisionManager

Creates a ClaimRevision next to the claim, owned by it, for every new combination of version and values. The version is the pinned spec.version, else the one the framework selected in status.version, else the one the instance already runs. So only a write to status.version, which adept makes ahead of maintenance, moves a managed instance to a new version. Platform values from config maps annotated with chrysopoeia.io/platform-values are merged in, see Platform values.

AutomaticApprovalManager

Approves new revisions of claims with spec.approval.strategy: Automatic by setting spec.approvedAt.

ReleaseController

Creates the instance namespace helx-<kind>-<hash>-<id> and a Flux HelmRelease in it from the newest approved revision. It reports status.instanceNamespace, status.appliedRevision and status.releaseStatus on the claim. A finalizer removes the instance namespace when the claim is deleted.

The instance namespace carries the label chrysopoeia.io/instance and the annotations chrysopoeia.io/claim-apiVersion, -kind, -namespace, -name and -uid, which the other operators read to find the claim an instance belongs to.

The DynamicCRDsRBACAggregatorManager keeps an aggregated ClusterRole in step with the generated CRDs, so other operators can be granted access to claims of every kind without naming them.

Operators as services

A reagent can install an operator that manages resources for other instances. Three reconcilers keep such setups apart:

  • The DependencyGroupManager validates DependencyGroups: a CRD may belong to one group only, so two operators never manage the same resources.

  • The DependencyRBACManager and DependencyNetworkPolicyManager give operator namespaces access to the namespaces that require them.

  • The OperatorHarnessManager registers a mutating webhook per OperatorHarness that points the operator’s pods at the harness proxy instead of the Kubernetes API server, and copies the proxy’s CA certificate into the operator’s namespace. The proxy, chrysopoeia proxy, scopes what the operator sees to the label of its group.