Documentation
¶
Overview ¶
Package configmaps defines the configmaps pack: the Mutation Triggers that keep the hashes that roll a workload when a ConfigMap it uses changes, and that bound how many immutable ConfigMaps render-configmap leaves behind.
A pod template carries one annotation per ConfigMap it uses, hash.confighub.com/<configmap>, whose value is the named placeholder for the ConfigMap (set-configmap-hash-annotations adds them). Needs/Provides fills each with the confighub.com/Hash of the ConfigMap it names, which the SetHash Trigger keeps for ConfigMaps authored as Kubernetes/YAML. A ConfigMap rendered immutable by render-configmap changes its name with its content instead, and the Prune Trigger removes old renderings.
`cub variant upload` creates the Prune Trigger in a Space that runs its own Triggers and needs it. It does not create SetHash: it fills the annotation for a ConfigMap authored as it is uploaded with a TransformPaths Link that hashes the ConfigMap with get-hash. A Space that selects its Triggers from a policy Space needs them installed there, where they can be selected by their Pack label.
Index ¶
Constants ¶
const Group = "configmaps"
Group is the constants.PackLabel value of this pack's Triggers, by which a Space whose Triggers come from a policy Space selects them.
Variables ¶
var Prune = Trigger{ Slug: "prune-configmaps", Description: "Keeps the 10 newest immutable ConfigMaps rendered from each AppConfig Unit and removes the rest.", Event: "Mutation", ToolchainType: workerapi.ToolchainKubernetesYAML, Function: "prune-configmaps", Arguments: []api.FunctionArgument{{ParameterName: "revision-history-limit", Value: 10}}, WhereResource: "ConfigHub.ResourceType = 'v1/ConfigMap'", }
Prune bounds how many immutable ConfigMaps rendered from one AppConfig Unit accumulate, since each change to the AppConfig Unit adds a rendering.
var SetHash = Trigger{ Slug: "set-configmap-hash", Description: "Keeps a hash of each ConfigMap's data and binaryData in its confighub.com/Hash annotation, so that the workloads using it roll when it changes.", Event: "Mutation", ToolchainType: workerapi.ToolchainKubernetesYAML, Function: "set-hash", Arguments: []api.FunctionArgument{{ParameterName: "path", Value: "data"}, {ParameterName: "path", Value: "binaryData"}}, WhereResource: "ConfigHub.ResourceType = 'v1/ConfigMap' AND metadata.annotations.confighub~1com/RenderRevision IS NULL", }
SetHash keeps a hash of each ConfigMap's data and binaryData in its confighub.com/Hash annotation, which Needs/Provides carries to the hash annotations of the pod templates that use it. It leaves out the ConfigMaps render-configmap produces, which carry a hash of the rendered file already, and which, latest or superseded, carry a RenderRevision.