Skip to content

Unit

The (Config) Unit is the core unit of configuration in ConfigHub.

Config Data

Config Units store configuration data. Configuration data may originate from a variety of sources: other Units, previous revisions, live state, documentation samples, AI agents, and so on, but ConfigHub becomes the authoritative record for the configuration.

Revisions

A Config Unit maintains a sequential list of revisions of the config data. Every time the data is mutated, ConfigHub records a new revision along with who made the change, a description of the change, and other metadata.

Toolchain Type

A Config Unit (or just Unit) contains configuration data ("config data") in a single format understood by a single family of tools, known as the ToolchainType. The ToolchainType implies a family of schemas for the configuration, including the means of distinguishing elements of different types and identities (i.e., names) -- called the resource provider in the function sdk. A typical kind of configuration element is a resource, and we currently use that term for configuration elements generally.

Unit Granularity

One or more "atomic" resources or other configuration elements can be specified in a Unit. For example, it can contain a list of Kubernetes YAML resources (YAML documents) or application properties files. A Unit is bundled into a Release as a single file, so if it contains multiple resources/elements, it is expected that the GitOps operator applying them will resolve references between them and handle ordering.

A single Config Unit cannot contain resources/elements of different formats configured using different tools, such as both Kubernetes YAML and TOML application configuration.

Here are some examples of Config Units:

  • A Kubernetes resource serialized as a YAML document
  • A single Java properties file

We recommend that you store one resource per Unit. We will likely enforce that constraint in the future.

Ingested Helm charts do not currently follow this guideline in order to simplify the process of ingesting and upgrading them from the charts.

Secrets shouldn't be stored in units. See recommendations in this blog post.

Unit Release Workflow

After making changes to configuration data of a Unit, at some point you will want to synchronize those changes to the Live resources. Primarily that is achieved via a Release operation, which makes the configuration available to GitOps operators via the OCI endpoint.

Release has some prerequisites:

  1. The Unit's Space must have a release Target (ReleaseTargetID). A Unit's TargetID is read-only: it is the Target a Release of its Space publishes it for, the Space's release Target, and is null when the Space has none or the Unit is Unreleasable. You change it by setting the Space's release Target, or the Unit's Unreleasable. The Unit must not be Unreleasable, which leaves it out of its Space's Releases so that it is never delivered. A Unit is created releasable if its toolchain is Kubernetes/YAML, and unreleasable otherwise: an AppConfig/* Unit is delivered by being rendered into a Kubernetes Unit, and a ConfigHub/YAML Unit holds configuration ConfigHub applies to itself, as the backing Unit of a ConfigHub entity. Set it on a new Unit with cub unit create --unreleasable, and change it with cub unit update --unreleasable or --unreleasable=false.
  2. The Unit must not have any Validation Errors, such as due to remaining placeholder values or other failed validation function triggers.
  3. When the Release is for a ChangeOrder governed by a ChangeWorkflow, the revisions being released must satisfy the ReleasePrerequisites of the Stage the Space is in, such as required approvals.

Once these prerequisites are satisfied, the release operation may be invoked.

This is a simplified workflow compared to using git, where:

  1. configuration changes would be committed and pushed,
  2. then a pull/merge request would be opened, validated, reviewed/approved, and merged, and then
  3. the GitOps operator would eventually pull and apply the changes.

In that workflow, the PR merge is analogous to the release operation. In ConfigHub, any configuration changes made after the last release (tracked by the last released revision) are analogous to commits pushed to an open pull request.

Approvals are recorded as Attestations of specific revisions, and required by a ChangeWorkflow's attestation prerequisites. Only organization members with the Approve permission on the Unit's Space can record them. An approval covers the content it was given for, so a change to a Unit creates a revision that is unapproved until someone approves it. See review and approval.

A Release that no longer carries a Unit's configuration removes the Unit's resources, when the GitOps operator prunes. Publishing puts the Released Delete Gate on each Unit a Release bundles with configuration, so a Unit is retired by emptying it with cub unit update --empty and publishing, which takes the gate off, before it is deleted or archived. A Destroy Gate on the Unit refuses that Release.

See making changes and publishing Releases for more details.