Derived Defaults
Status: decided and built (go-kure/launcher#1631). The maintainer answered the four questions on 2026-12-03, and “Decisions” at the end records the answers. The sections up to there are the analysis the decision rests on, kept as it was written, with the points a build had to settle answered in “Settled in the build”. The page reads the code at the commit it was written against; a cite names a file and the function or text to find, not a line.
Problem
A kind component (certificate, deployment, cnpg-pooler) takes the upstream API’s required
fields as required. Several of them have an obvious value that follows from the component. A
cert-manager Certificate needs secretName, and the usual value is the component name plus -tls.
The author writes it every time.
The kind level keeps no launcher opinion (design-operator-cr-components.md, “No launcher opinions
on the kind”), so a derived default cannot live in the kind. It belongs to a higher-level type that
builds on the kind. The issue also asks that such a type usually keep the kind’s short name, and the
resolver then reads that short name as ambiguous. The page answers the four questions of the issue:
which kinds and fields, which mechanism, whether one declarative table can be that mechanism, and how
two types with one short name are named, published and told apart.
Two kinds of value are in play, and the page keeps them apart:
- A derived value: computed from the component (its name, its namespace, another field). Example:
secretName. - A constant default: the same value for every component of the kind that meets one condition. The
maintainer’s comment of 2026-11-19 on the issue asks for one:
automountServiceAccountToken: falseon pods that name no service account. The condition matters: the role members ofwebserviceandworkeralready fill it this way and leave the field alone beside an authoredserviceAccountName(podspec.go,buildPodSpec;TestBuildPodSpec_AutomountDefault). Launcher set it ondeployment,statefulset,daemonset,jobandcronjobuntil go-kure/launcher#1629 dropped it, so these kinds follow the upstream default aspoddoes. This comment’s ask is marked “constant” everywhere below, so the maintainer can split it from the derived values if he prefers.
What exists today
The kind level fills almost nothing
The five raw workload kinds (deployment, daemonset, statefulset, job, cronjob) take the
upstream spec as authored. Since go-kure/launcher#1629 they fill nothing
(pkg/oam/builtin/components/builtin_defaults.go, header). Other kinds do write a value the Go type
cannot leave unset, and the page keeps that apart from a launcher opinion: it materializes the
upstream default, as cnpg-cluster does for instances (cnpg_cluster.go) and cnpg-database for
ensure (cnpg_database.go; design-operator-cr-components.md, “No launcher opinions on the kind”).
A field the API requires and the Go type would write empty is refused when unauthored: refuseUnauthoredRequired, called from the kind’s own
parse (kind_policy_free.go, policyFreeKind.config). The paths are generated from the API
(kind_required.go, zz_generated_kind_required.go), so they are the list of fields this design
can act on.
Lowering rules
A role-named type is a lowering rule that expands into kind components and writes its opinions as
the kinds’ properties (design-operator-cr-components.md, “Semantic components as lowering rules”).
Precedents:
webserviceandworker(components/webservice.go,worker.go) are rules, not handlers.webservicedefaultsportto 80,replicasto 1 andtopologySpreadto true. Both write a same-name ServiceAccount withautomountServiceAccountToken: false(unlessserviceAccountNameis authored) and atopology-spreadtrait.workerdeclares noport.postgresqlderives the image tag fromversion, a1Gistorage fallback,enablePDBfrom the replica count, and names its pooler<component-name>-pooler.
A rule writes the kind’s properties before the kind parses them, so a rule can satisfy a required field.
Traits
A trait decorates the object a kind builds, after the kind parsed. The certificate trait
(traits/certificate.go) defaults issuerRef.kind, duration and renewBefore, and reports each
fill (reportFill). It requires secretName and derives nothing. A trait cannot carry a derived
default for a required field: the kind has already refused the unauthored field by then. A trait
fits an opinion that reads the post-policy object, such as topology-spread.
Configuration models
A Model document declares inputs, computes values with CEL and lists parts
(pkg/oam/model/README.md). self.name is the component name, so a model can already compute
${ self.name + '-tls' }. Launcher ships three models (pkg/oam/shipped): workload, datastore
and s3-access. Three costs apply to a model that wraps one kind:
- Its inputs are a schema it declares itself, so the model repeats every top-level field of the kind
it wraps (
certificatepublishes 24). - A model input cannot declare
boundedBy, so the bounds the kind publishes are lost on the wrapper. - A part is named
<component>-<part>andobjectNameis refused on it, so the object no longer carries the component’s name.
A component definition (pkg/oam/definition) declares a type from a pinned CRD. It applies no
defaults to the object it checks or emits (its package comment says so; the policy alone reads the object
with the CRD’s defaults applied), so it is another place
a table could act, and not a mechanism of its own.
What the reader sees
A config that fills a value reports it, and the provenance report names it as source builtin
(BuiltinDefaultReporter, pkg/oam/policy.go; recordBuiltinDefaults, pkg/oam/provenance.go).
Only a config reports: provenance.go reads configs, and lowering.go has no fill reporting. A
lowering rule has no such way. The kind receives a value a rule wrote as an authored property. The
report does not call it authored: it names a property a rule emitted as rendered or copied, with
the rule as its reference (ruleInput.sourceOf, provenance.go). What a rule cannot do is mark a
value as a default, which is the builtin attribution.
Which kinds and fields
The rows below come from the generated required lists and the issue. Kinds not listed were not judged. The candidate kinds of go-kure/launcher#1637 are not read here, so the table can grow once they land.
| Kind | Field | Class | Value |
|---|---|---|---|
certificate | secretName | derived | component name + -tls |
deployment, statefulset, daemonset, job | pod template automountServiceAccountToken | constant, guarded | false unless the pod names a service account (serviceAccountName or its alias) |
cronjob | job template’s pod template automountServiceAccountToken | constant, guarded | false unless the pod names a service account (serviceAccountName or its alias) |
cnpg-pooler, cnpg-scheduledbackup | cluster.name | wiring | names another component |
cnpg-database | cluster | wiring | names another component |
A wiring field refers to another component. The component alone cannot derive it, and
postgresql already writes these fields from the one place that knows both sides. The page keeps
wiring out of any table and leaves it to rules. The automountServiceAccountToken rows are the
2026-11-19 ask. The paths are the upstream API’s: the pod spec sits under template.spec for the
first four kinds and under jobTemplate.spec.template.spec for cronjob.
Mechanism
Option 1: a Go lowering rule for each higher-level type
The postgresql and webservice shape. Full control, and policy stays on the kind it lowers onto.
Each default is code, and each type needs its own copy of the kind’s schema.
Option 2: a shipped model for each higher-level type
Works today for derived values (self.name). It repeats the kind’s schema, loses the declared bounds
and renames the object (see “Configuration models”). It fits a composition of several kinds (the
shipped workload and datastore). It is a poor fit for one kind plus a default.
Option 3: a trait
Excluded for required fields: the kind refuses the unauthored field first. It stays the right place for an opinion that needs the post-policy object.
Option 4: one declarative table and one rule (the generic candidate, evaluated first)
One table row says: for this higher-level type, over this kind, at this path, fill this value when the author left it out. One rule applies the rows of its type and emits the kind component with the same name.
type: <higher-level identity>
kind: certificate
rows:
- path: spec.secretName
from: name # constant | name | namespace
suffix: "-tls"
- path: spec.template.spec.automountServiceAccountToken # a row of another kind
from: constant
value: false
unless: serviceAccount # the one guard: the pod names an account (name or alias)How it works:
- The rule copies the authored properties. For each row whose path is absent or null (a null is absence, as everywhere else) it writes the value. It writes nowhere else.
- It emits one kind component with the component’s name, without an authored
objectName, which the rule names through the naming hook. The kind parses the result, so its own checks, policy and bounds apply unchanged, and nothing is repeated. Endpoints are the exception: the rule delegates the endpoint query to the kind (see the open points). - The published schema is the kind’s schema with each row’s path made optional and its description saying how it is derived. A test holds every row’s path to a field of the kind, as the coverage tests of the kinds hold their own schema.
- The documentation table of derived defaults is generated from the rows, so it cannot drift.
Fit against the inventory above: both secretName and the five constants are rows. The wiring fields
are not, and nothing in the table tries to read another component.
Limits to keep it small:
- Three derivations only: a constant, the component name (with a prefix or suffix), the namespace.
field(another authored field of the same component) is the fourth the issue names. It is the one to leave out until a row needs it. - A row addresses a map path. It fills only where the parent map is authored: the pod template of the five workload kinds is required, so the parent exists in every valid document, and the table never conjures a half-built parent that the kind would then refuse for another reason.
- One guard: a row may name the pod’s service account and stop when the pod names one (
unless). The constant rows need it, because the 2026-11-19 ask is conditional on the pod naming no service account. The guard reads the effective name, as the existing fill does (tokenAutomountIsBuiltin: an emptyserviceAccountName, no automount set): a key written as""or null names none and does not stop the row, and the deprecated aliasserviceAccount, which the raw workload kinds still take (DeploymentConfig.ServiceAccountName), names one and does stop it. A presence test on one key would get both wrong. A second kind of condition is where the table turns into a language, so it is the reason to leave the table. - No cross-component reads and nothing that needs the post-policy object. Those stay rules and traits.
- A new default is a row. A new higher-level type is one registration line plus its rows, because the type has to be declared and registered like any other.
Open points a build must settle, and which this page does not decide:
- The rule must carry the kind’s declared bounds onto its own schema, or the policy contract loses
them (
DeclareBounds). - The rule’s key cannot be the kind’s: a name is a handler or a rule, never both (
design-gvk.md, “Two Axes of a Type”). The identity carries the short name, a different key carries the dispatch, as a declared definition’s type name already differs from its identity. - A fill must read as a default. See “What the reader sees”: a rule has no way to report a fill, so
the report shows a derived value as
renderedby the rule, not asbuiltin. Either a rule gains a way to name the paths it filled, which the provenance report reads asbuiltin, or the page accepts therenderedattribution. - The rule must answer the endpoint query itself. Emitting a kind does not inherit the kind’s
endpoints: the query asks the authored type’s rule and reads no endpoints unless that rule
implements an endpoint-provider interface (
componentEndpoints,pkg/oam/transform.go). The rule delegates to the kind’s own provider after it applies its rows. - The rule must keep the object name. A component that a rule emitted refuses an authored
objectNameand skips the normal object-name hook (pkg/oam/object_name.go), so copying the properties would not give the output the kind gives. The rule removesobjectNamefrom the properties it emits and names the member throughLoweringContext.ResolveMemberName, aswebservicedoes for its members. - The
unlessguard reads the effective service account, not a key. See the guard in the limits.
KISS reading. Option 4 is the smallest mechanism that covers the inventory: the rows are data, and there is one code path. Option 1 repeats one rule per type and Option 2 one model per type with a copied schema. Option 4 stops being the smallest if the vocabulary grows past the three derivations and the one guard.
Settled in the build
Each open point above is answered in pkg/oam/builtin/components/derived_defaults.go:
- Bounds. The rule publishes the kind’s schema entries as they are, so the
BoundedByclasses stay; only the row’s field losesRequired, and a test holds the bounds of each type to the kind’s. - Key. The type is a rule under its role name, so the identity’s leading label is the key
(
tls-certificate.launcher.gokure.dev@v1) and no key differs from the short name (option C below). - Attribution. The rule names the paths it filled on the component it emits
(
oam.Component.Filled, path to reference), and the provenance report reads them asbuiltinwith the reference<type>.<path>. - Endpoints, object name and outputs. The rule asks the kind’s endpoint provider after the rows
apply; names the object as the kind does (the author’s
objectName, else the Naming hook under the object role, else the component name;objectNameis removed from the emitted properties); and publishes the kind’s one object underobject, the nameLowerComponentgives it. The third condition, outputs, is go-kure/launcher#1810: a rule with noOutputProviderpublishes none, and a model reads a part’s object name from the outputs. Every compatibility claim on this page that names the object name and the endpoints holds only with the outputs too. - Capability fill and authored checks. The engine marks the output of a rule that declares a schema
synthesized, and skips the emitted type’s capability defaults, its capability fill and its authored property checks. A StatefulSet claim template would then lose thepvccapability’s storage class. The rule implementsoam.AuthoredComponentEmitter(the counterpart ofAuthoredTraitEmitter): its output carries the author’s own values and the rows, nothing rendered from the platform, so it stays authored and the kind’s handler treats it as it treats the plain kind. A test holds the StatefulSet parity: the same objects, the same consumed capability and the same attribution. - Path syntax. A row path is written in the grammar of
ParsePodSpecPath, from the root of the emitted object (spec.secretName), and read by that function, as the field markers of a component definition read theirs (go-kure/launcher#1818). The rule strips the leadingspecto address the kind’s properties. The rows are checked when the rule is built (the path reads, names no array or map of values, and its first key is a property the kind publishes); a path below an open node is held by the kind’s strict decode, which refuses an unknown field, in the test that builds every type. - Vocabulary. A constant and the component name with a suffix. The namespace is not built: no row needs it, and a lowering rule sees the document’s namespace, not the final one.
- Key map. The rules publish no lowering key map: every authored key lands unchanged at the same path, which one test holds for all six types, and a map would repeat the kind’s schema.
Naming and resolving a higher-level type
Today a type claims the leading label of its name as its short name. A short name resolves only when
exactly one registered type claims it, and registration refuses a short name equal to another type’s
qualified name (pkg/oam/typeid.go, TypeRegistry.Register and resolveName; the rules are in the
“Type identity” part of the parsing reference). The kind certificate is certificate.cert-manager.io@v1
and claims certificate.
Option A: the same short name, told apart by qualified name (the issue’s proposal)
A higher-level certificate.launcher.gokure.dev@v1 also claims certificate. The short name then
refuses as ambiguous (“use a qualified name”) in typeIdentities.resolve for every document that
writes type: certificate, and componentKey finds no key for it. Every existing document and
example then needs the qualified name of the kind. Before the first stable GA release a change may
newly reject a document, with a format entry in the changelog (AGENTS.md, Git Workflow), so it is
allowed. It also contradicts the statement “every short name in the type allowlists stays valid” in
the parsing reference. A shipped model has the same effect, since a model claims its leading label too.
Option B: the same short name, and the higher-level type wins it
The resolver gains a precedence among claimants of one short name, and the kind stays reachable by its
qualified name. Documents that wrote the required field keep building the same output, if the rule
keeps the object name, the endpoints and the outputs as option 4 states. The change touches typeid.go (shorts, Register, resolveName),
the tests that today expect ambiguity (pkg/oam/model/shortname_test.go) and the documents’ meaning
of the bare name: certificate would stop being the opinion-free kind. It would be another change to
the short-name rules, after go-kure/launcher#1716, go-kure/launcher#1718 and go-kure/launcher#1720,
which each added a registration refusal.
Option C: a role name
The naming rule of design-gvk.md says a type that projects exactly one kind without opinions takes
the kind’s name, and any other type takes a role name; a vendor prefix is added only when the bare
name is taken. A higher-level type adds an opinion, so by the rule it takes a role name of its own.
No resolver change, no ambiguity, no document breaks, and certificate keeps meaning the kind with
no opinion. The cost is the one the issue names: the author types a longer or different name. The
page does not pick the names; each type gets one when its rows are chosen.
How a reader tells which one a document uses
- The document says it in
type:. With option C the two never share a short name, so the text is enough. Transformer.ResolveTypeswrites each type as its identity,name@version, so a tool can print the unambiguous form.- The fill report names a derived value as
builtin, with the reference<type>.<path>. - The components README holds a table generated from the rows, listing each higher-level type, its kind and the paths it fills, and a test holds the two equal.
Transformer.TypeCatalog()lists every type with its qualified name and its level:base-kindfor a kind,higher-level-modelfor a type that adds an opinion (oam.ContractMetadata.Level). A client shows both, as the maintainer asked.
What changes, if anything, in resolution
- Option C: nothing in the resolver. A rule registers under its own key and declares an identity whose leading label is its role name.
- Option B: a precedence rule in
typeid.go, a changed test and a changed sentence in the type identity reference. - Option A: no resolver code. Every document that writes the bare short name changes.
Consequences
- For a required field (
secretName) a higher-level type is a superset of its kind, on the condition that the rule keeps the object name, the endpoints and the outputs (option 4): any document that wrote the field builds the same object, and a document that left it out was refused before and now builds. - The constant rows differ. Their field is optional on the kind, and a document that leaves it out
builds today with the field unset (
TestDeploymentHandler_FillsNothingand the matching cases of the other four kinds). A row therefore changes the output of documents that already build. It is a document-format change, which launcher may make before its first stable GA release with aformatchangelog entry and a disclosure in the pull request (AGENTS.md, Git Workflow). - Opinions stay in one place each: the kind keeps none, the rows hold the derived defaults, rules and traits hold the rest.
- The five constant rows are an opinion about the kind’s pods. They are the maintainer’s ask of 2026-11-19 and can be taken out of the table.
What this page does not cover
- Wiring fields, conditions beyond the one guard, and values that need the post-policy object.
- The kinds that go-kure/launcher#1637 may add.
- Any change to the resolver beyond what each option above states. The build changes none.
Decisions
The maintainer decided on 2026-12-03:
- Scope of the first rows. The
certificate.secretNamedefault (<component>-tls) ships together with the constantautomountServiceAccountToken: falserows, in one table, the constants marked. Built astls-certificateand the fivehardened-*types. - Mechanism. One declarative table and one rule (option 4), limited to a constant, the component name, the namespace and the one service-account guard. The table reads alike with the field markers of a component definition (go-kure/launcher#1818): the same path syntax, the same place and one check that each path exists in the kind’s schema. The namespace is in the limit, not in the build (see “Settled in the build”).
- Naming. A role name (option C): the plain kind keeps its short name, and a higher-level type
gets a role name of its own. His addition: names are always shown fully qualified in a client, with
a label that says whether a type is a base kind or a higher-level model; built as
Transformer.TypeCatalogandContractMetadata.Level. - Fill attribution. The rule names the paths it filled, so the report says
builtin, notrendered.
Not put to him, and followed from the page’s own recommendation: further kinds get rows only when a kind needs one (the candidate kinds of go-kure/launcher#1637 add none here).