GitLabCore values from ConfigMaps and Secrets

Status: Implemented Issue: https://gitlab.com/gitlab-org/crete/-/issues/54 Parent: GitLabCore reconciler

Goal

A platform that ships GitLab, such as Crete, keeps its chart settings in a ConfigMap it updates with each release, while the customer creates and owns the GitLabCore resource. The resource references that ConfigMap, and the customer’s own values still take precedence, so the platform updates its settings without ever writing to the customer’s resource.

Requirements

  • spec.chart.valuesFrom lists ConfigMaps and Secrets in the namespace of the resource, each read at valuesKey (default values.yaml) as a YAML map of chart values.
  • A referenced object needs the operator.gitlab.com/config-source: "true" label, as a versionRef ConfigMap does. An unlabeled one counts as missing.
  • Precedence, lowest first: the derived values, each entry in list order, spec.chart.values, and the Operator overrides.
  • A missing optional entry is skipped. A missing required entry renders nothing and sets Initialized to False with ValuesReferenceNotFound. Content that is not a map does the same with ValuesReferenceInvalid. Neither quotes the content. Empty or null content contributes no values.
  • A change to a referenced object renders the chart again, including after a failed render.
  • Referenced values that violate the chart schema fail the render.
  • The preflight of a candidate version renders with the referenced values, so a candidate they do not render with is rejected before it becomes the target. A rejected candidate is checked again on the first pass after a referenced object changes, so a platform that ships a version and the values it needs together does not wait out the retry interval when the version arrives first. Values that arrive first take no preflight. As with any change to a referenced object, the running version renders with them, so it can fail until the version arrives.
  • An edit through Bridge keeps the entries.

Out of scope

  • References to objects in another namespace.
  • Validating referenced values at admission. No GitLabCore validating webhook exists yet.
  • Showing or editing valuesFrom in Bridge.
  • valuesFrom for Siphon and Orbit.
  • targetPath, which sets one value at a path, as Flux supports.
  • Running the chart hooks again when a referenced object changes.

FAQ

  • Why doesn’t the platform write its settings into the resource instead? The customer owns the resource. With two writers on one resource, either the customer’s changes get reverted or the platform’s updates overwrite them. With valuesFrom, each object has one writer: the customer writes the resource and the platform writes its ConfigMap.
  • Why do inline values win over the referenced ones? The customer owns the resource and the platform owns the ConfigMap. The customer has to be able to override a platform setting without writing to an object the platform keeps current.
  • Why watch the referenced objects when the reconciler requeues every 30 seconds? A failed render does not requeue, so without the watch a fixed ConfigMap would not be picked up until the resource changed.
  • Why do the referenced objects need a label? The Operator caches only labeled config sources, so it never holds every ConfigMap and Secret in the cluster. See ADR 39.