Repository navigation
Description
The owner's decision (2026-11-14)
"in the payload we need fields to be required for metadata for labels and annotations ... configure this compulsory but parameterizable ... requiredAnnotations (stanza) and requiredLabels (stanza as well) - we want to be able to configure the required keys so that the requester needs to set them - and also have flexibility to configure extraAnnotations and extraLabels - so that they can set additional labels or annotations if they want."
The owner's sample of a company's namespace today (company.net stands for any company's domain):
kind: Namespace
apiVersion: v1
metadata:
name: abc-rnd # every namespace starts with the team's mnemonic
labels:
name: abc-rnd # required: a copy of the namespace name
company.net/app-environment: rnd # required
company.net/mnemonic: abc # required
company.net/lob: amgsst # required: line of business
company.net/cl: '1' # required: critical level
company.net/provisioner: cluster-configs # written by the old way of provisioning; useful for adoption
company.net/mnemonic-group-contact: '' # optional
company.net/mnemonic-confluence: '' # optional
annotations:
company.net/app-environment: rnd # requiredToday
metadata-keys.yaml (deploy/helm/cmapi/config/, examples/cluster-configs/policies/) has governed keys (each with kind, required, pattern or format), team keys (free extra keys with allowed prefixes and limits), system keys that cmapi writes, reservedPrefixes, sensitiveKeys and emailDomains. It cannot say: a value that cmapi derives (the namespace name, the environment), a list of allowed values, a key that must match the namespace name's prefix, or a key recognised only at adoption.
What to build
- Four stanzas in the configuration (per instance, in the Helm values and
metadata-keys.yaml), replacinggovernedandteamwith no change of behaviour for the keys that exist:Each key takes one of:requiredLabels: name: { value: { from: namespace } } # cmapi sets it; the requester does not company.net/app-environment: { value: { from: environment } } company.net/mnemonic: { pattern: "^[a-z]{3}$", namespacePrefix: true } # abc-rnd must start with "abc-" company.net/lob: { enum: [amgsst] } # or a pattern company.net/cl: { enum: ["0", "1", "2", "3"] } requiredAnnotations: company.net/app-environment: { value: { from: environment } } extraLabels: keys: company.net/mnemonic-group-contact: { format: email-in-domains } company.net/mnemonic-confluence: { format: url } allowOther: { prefixes: ["", "*.company.net/"], max: 50 } # any other key, within the limits extraAnnotations: keys: {} allowOther: { prefixes: ["", "*.company.net/"], max: 50, maxValueBytes: 4096, maxBytesTotal: 65536 } adoptionLabels: company.net/provisioner: { recognise: [cluster-configs] } # read when an old namespace is adopted
value.from(derived by cmapi:namespace,environment,cluster,team, ...),pattern,enum,format(email-in-domains,url, ...), and optionalnamespacePrefix,descriptionandexample(for the API document and the portal form). - The request. A derived key is never sent by the requester (sending it is refused, or ignored with a warning: decide and record). A required key that the requester must give and that is missing, empty or invalid refuses the plan with one problem that lists each key and its rule. Extra keys are accepted within the configured keys and limits. The plan and the dry run show the final labels and annotations.
- One source for every check: the same stanzas feed cmapi's plan-time validation, the Kyverno policies of Kyverno policies generated from cmapi's configuration, with approved per-namespace overrides #212 (and their messages, filled from the same values), the OpenAPI description and examples of
labelsandannotations, and the portal's New namespace form (required fields first, extra fields after). - Changing a required key is a reviewed configuration change. Existing namespaces that miss a new required key show as non-compliant (a finding on the namespace and on the Policies tab); the fix is an update request, not an automatic change.
- Adoption:
adoptionLabelslets cmapi recognise namespaces that the old way provisioned, for the adoption work of story [Draft] OBI-39: Adoption, policy visibility and recoverable operations #26. - Keep
system,reservedPrefixes,sensitiveKeysandemailDomainsas they are; a required or extra key must not use a reserved or system key, and the loader refuses a configuration that does.
Proof
Tests that fail before and pass after: each rule (missing required key, bad enum, pattern, namespace prefix, derived key sent by the requester, an extra key outside the allowed prefixes or over the limit); the owner's sample namespace renders exactly; the loader refuses a bad configuration; the portal form shows the configured keys. docs/02 (live and export), docs/04 regenerated, the contract gate, the service suite and GitHub's checks green on the exact head.
Activity
ephico2real2 commentedon Nov 14, 2026
Owner decisions, 2026-11-14:
Keep both keys; they are different things.
cmapi.net/envis cmapi's own system key: the environment of the namespace's cluster, which matches the instance that manages it; approval rules, Kyverno and the instance boundary (422 environment-not-served) use it.company.net/app-environmentis the company's label, filled as in the owner's sample. Do not merge them and do not make cmapi read the company key. In this issue,company.net/app-environmentstays derived from the cluster's environment (value.from: environment), so a requester cannot set a value that disagrees, unless the owner says requesters type it.Two instances, not three. The owner: "nonprod (dev, rnd, uat and qa) and another instance (prod) will be deployed to manage prod (production clusters)". The design and examples today have three: nonprod (rnd, dev), staging (qa, uat), prod (prod) (
examples/instances/, docs/01, docs/02, and the OpenAPI description "The nonprod instance serves [dev, rnd]"). Change the example instance files, the docs (live and export) and every place that names the instances to the owner's two; it is configuration, so no code change is expected, but check the code and tests for any assumption of a staging instance.ephico2real2 commentedon Nov 14, 2026
Correction by the owner, 2026-11-14 (replaces item 2 of my previous comment): keep the three cmapi deployments (instances) of the design: nonprod (rnd, dev), staging (qa, uat), prod (prod). The owner: "I like the fact that we have 3 cmapi deployments". Do not change the instance files, docs or OpenAPI description to two. Item 1 (keep both
cmapi.net/envandcompany.net/app-environment) stands. #222 (email links hard-code#nonprod) still applies, since the staging and prod instances send emails too.Records: the owner's decisions of 2026-11-14 (#215, three instances, #…
Fable's review of #234: no format on a label, adoption labels reserve…
ephico2real2 commentedon Nov 14, 2026
Owner decision, 2026-11-14 (after Fable's review of PR #234):
company.net/mnemonic-group-contactandcompany.net/mnemonic-confluencemove to annotations: optional keys ofextraAnnotations, withformat: email-in-domainsandformat: url. A label value cannot hold@,://or/(at most 63 characters of letters, digits, dot, dash and underscore), so they cannot be labels with those formats. Existing namespaces that carry them as labels keep those labels at adoption (raw as-is), each reported as a finding (#26).The company's two optional keys are annotations, with their formats (#…
Fable's N1 on #234: a key of the other kind is refused even where all…
Adoption design: Fable's second pass, R1 to R7 (#26, #251)
Merge pull request #234 from ephico2real2/configurable-metadata-stanzas