Property schemas and contract metadata
The implementation, history and tests of the sections below are on the contributor page.
Property schemas
Handlers may implement PropertySchemaProvider (PropertySchema() map[string]PropertySchema)
to declare a constrained schema for their user-facing properties. PropertySchema is launcher’s
single schema vocabulary — the same type also backs kurel.yaml parameters (ParameterDecl) and
CapabilityDefinition rendering properties. It has Type (string/integer/boolean/number/array/object),
Types, Description, Required, Default, Enum, nested Properties, Items, AdditionalProperties
(default false; escape-hatch fields set it true), AdditionalPropertiesSchema, Exclusive, AtLeastOne and RequiredWhen. The rich fields
(Types, Enum, Properties, Items, AdditionalProperties, AdditionalPropertiesSchema, Exclusive, AtLeastOne, RequiredWhen) are
meaningful only for handler properties: the two flat call sites (kurel
parameters, capability rendering) reject them at decode time, so unifying the type does not widen
their accepted behavior.
AdditionalPropertiesSchema (published as additionalPropertiesSchema) types the values of the keys
an object leaves open. It describes a map from a free key to a typed value, such as
{"<group>": ["name", ...]}, which AdditionalProperties alone can only call “an object”. The
rules:
- A non-nil value schema opens the object, whatever
AdditionalPropertiessays. The boolean stays the shorthand for “any value”, and a node that sets neither refuses an undeclared key as before. Propertiesand a value schema may sit on one node: a declared key keeps its own schema and every other key takes the value schema.- An authored value under an open key is checked against the value schema as an array’s element is
checked against
Items: the same type,Enumand nestedRequiredrules apply, and the refusal names the value’s path (properties.groups.web,properties.groups.web[1]). - A null under a key the value schema types is stripped, as a declared optional key’s null is, and
the Enum null rule treats such a key as declared. Under a key a bare
AdditionalProperties: trueleaves open, a null is left alone as before. - Only an object may carry it. A value schema on any other node is a schema error, in validation and in the model loader.
- The walks that follow
Itemsfollow it too: nestedRequired, exclusive and at-least-one groups, the platform-reserved check, feature gates, and the static Enum null check, which names a member of the value schema at the path*. The authored check of a trait a capability binds relaxesRequiredinside the value schema, as inside a declared object, because the rendering merges into the object an open key holds. - Not read, as before for an open object:
DeclareBoundshas no path token for it (state a bound on the open node itself, which covers a value below it), CEL types the value asdyn, and the probe’s declared defaults have no notion of an open key.
A kurel parameter’s Type is string, integer, boolean, array or object. ResolveParameters replaces a whole-value ${name} for an array or
object parameter with the value’s YAML list or map. With no items or properties to declare,
the parameter checks only that shape (its default too, and a string default is refused); the
substituted value is checked by ValidateAuthoredProperties against the consuming handler’s schema
like any authored property. Such a parameter cannot be embedded in a larger string, in the template
or in another parameter’s string default.
Types is the union idiom: a leaf that accepts more than one scalar type
lists them, and a value is accepted when any member’s single Type accepts it — whatever order the
members are listed in — normalised exactly as the first member, in declared order, that accepts it
would (below). Members are two or more distinct scalar types (string, integer,
number, boolean); Type and Types are mutually exclusive. A schema that sets both, or a malformed
union, is a schema error reported as soon as a value reaches the leaf. Every Kubernetes
intstr.IntOrString leaf — the rolling-update maxUnavailable/maxSurge knobs, the networkpolicy
port, the service kind’s ports[].targetPort — declares integer/string, and every resource.Quantity leaf (cpu, memory, a claim’s
storage) declares string/number, because their parsers take a fractional number too. Type
stays empty on a union leaf, so a schema consumer that does not read Types sees an untyped leaf and
keeps accepting every member. Transformer.HandlerSchemas() returns a HandlerSchemaSet{ Components, Traits, Policies, Exclusive, AtLeastOne }
of every registered handler and lowering rule that declares one, so the downstream runtime’s validator can check a
component’s, trait’s or policy’s properties before the handler is invoked. Built-in examples: the configmap trait and the
passthrough component.
Exclusive is the one-of idiom: on an object node it lists groups of that
object’s Properties keys, ExclusiveGroup{ Keys, Required }, of which a value sets at most one, and
exactly one when the group is Required. A key counts as set when it is present and not a null, as
for Required. A handler’s top level is a map with no node to carry the groups, so a handler or
lowering rule declares them through the optional ExclusivePropertiesProvider
(ExclusiveProperties() []ExclusiveGroup), and HandlerSchemaSet.Exclusive publishes them by
position and type name. Exclusive is nil when no handler declares a top-level group, so a set
without one marshals as it did before the field existed; the nested groups travel in the schemas
themselves. A group’s Required is relaxed exactly where field Required is: an authored document’s
top level is held to at most one only, and a capability-bound trait’s nested groups are checked on
the properties merged with the rendering, where a merge that sets two keys of a group is refused
naming the capability. A component’s capability defaults (ComponentCapabilityDefaults) are held to
the authored bound once merged: a default that fills one key of a top-level group beside an authored
key of it is refused, naming the capability. Emitted properties are held to both bounds at every level, with one exception:
a trait a rule writes under AuthoredTraitEmitter (a model’s traits) is checked as an authored trait is, so its top
level is held to at most one only. A group of fewer
than two keys, a key the object does not declare, a key in two groups, a Required key, or groups
on a non-object node is a schema error. Property validation always refuses it, whatever the
document supplies: ValidateAuthoredProperties* and the check of emitted properties hold the whole
schema, objects and array items the document leaves out included. So does Transform wherever a
capability rendering may supply values the author did not write (a trait it applies or lowers, a
component’s capability defaults); a caller that skips ValidateAuthoredProperties* gets no other
schema check, as for every other property rule. It is reported before the document’s errors about that object’s keys
(Required and group membership); a reserved-property or value-type error of the document may be
reported first. A consumer
that does not read Exclusive sees each key as the optional key it is declared as.
CheckSchemaNodeGroups(field, path) applies those five rules to one declared node and does not
recurse, for a caller that walks a schema itself and spells the path itself. model.Load calls it
for each node of the input schemas it visits, so a malformed group in a model is refused at load.
AtLeastOne (published as atLeastOne) is the “at least one of” idiom: on an object node it lists
groups of that object’s Properties keys, AtLeastOneGroup{ Keys }, of which a value sets one or
more. A key counts as set when it is present, not a null and not an empty array. That differs from
Exclusive, which counts [] as set; an empty object and an empty string do set their key. A
handler’s top level declares its groups through the optional AtLeastOnePropertiesProvider
(AtLeastOneProperties() []AtLeastOneGroup), and HandlerSchemaSet.AtLeastOne publishes them by
position and type name; it is nil when none is declared. The group is enforced where an exclusive
group’s Required is: not on an authored document’s top level (a handler that needs the rule there
refuses it itself, as the built-ins do), nor on a top level after a capability merge; a
capability-bound trait’s nested groups are checked on the properties merged with the rendering.
Emitted properties are held to it at every level, except the top level of a trait a rule writes under
AuthoredTraitEmitter (a model’s traits), which is checked as an authored trait is.
The refusal is the at-least-one kind: at least one of "a" and "b" is required. A malformed group
(fewer than two keys, a key the object does not declare, a key in two at-least-one groups, a
Required key, or groups on a non-object node) is a schema error reported as an exclusive group’s is,
CheckSchemaNodeGroups included. A consumer that does not read AtLeastOne sees each key as the
optional key it is declared as. The built-in cilium-networkpolicy and
cilium-clusterwidenetworkpolicy (spec, specs) and validatingadmissionpolicy (validations,
auditAnnotations) declare one.
RequiredWhen (published as requiredWhen) is Required under a condition. On a property of an
object node (or of a handler’s top level) it names a sibling key of the same object:
RequiredWhen{ Key, Equals } makes the property mandatory while Key is set, or, when Equals is
given, set to that value. A key counts as set when it is present and not a null, as for Required
and Exclusive; a null or an empty string in the property itself reads as for Required (a null is
absent, an empty string is set). Equals is a string or a boolean, of the key’s declared type and,
where the key declares an Enum, one of its values. The refusal is the required kind and says
why: "csi" is required when "type" is "csi", "volumeMode" is required when "devicePath" is set.
A property carries one rule. The rule follows Required wherever that one is relaxed: it is
not enforced on the schema a capability-bound trait’s author is checked against (the rendering may
supply the property), and it is checked on the properties merged with the rendering, where the
refusal names the capability. It is read after the exclusive groups of its object, except at an
authored document’s top level, where it is read with Required and so before them. A rule that names
a key the object does not declare or the property itself, sits on a Required property, or has an
Equals of another type (the key’s Type, or one of its Types) or outside the key’s Enum is a schema error, reported wherever a
malformed group would be (CheckSchemaNodeGroups included, so model.Load refuses it). So is a rule
on a node that is no property of an object, which has no sibling to name: an array’s items, the value
schema of an open object, a model input itself (CheckSchemaNodeNotProperty). The two
flat call sites reject the key at decode time; a model input accepts it. A consumer that does not
read RequiredWhen sees the property as the optional key it is declared as. It states the
presence of a property and never its value: a handler keeps its own refusal of the rest, and of the
same case, so a caller that skips validation gets the handler’s wording.
Description is optional (json:"description,omitempty") but every built-in property populates it —
including nested object fields and array item schemas at every depth — so the downstream runtime can surface prose in
its generated Handler API Reference.
A schema field may also be marked PlatformReserved: its value may arrive only via
ClusterProfile capability rendering, never authored inline. enforcePlatformReserved
(property_validate.go) rejects an authored value for such a field — including an
explicit null — before capability rendering is merged in, with a *PropertyError of
kind platform-reserved that wraps ErrPlatformReserved; it walks declared nested object fields and the items of a
declared array of objects too (named properties.items[0]), so a reservation on an
inner field is enforced wherever it is declared, not only at the top level.
createApplications and applyTraits (transform.go) run this check on the authored
path, and the lowering engine runs it on a TraitLoweringRule’s input trait before
capability rendering is resolved into it (see Lowering). A value a lowering rule
recorded with Component.RenderReserved or Trait.RenderReserved is exempt while the
key still holds it (see Lowering).
A schema field may also name a Kubernetes feature gate in Gate (published as gate):
the field needs that gate on the cluster. A ClusterProfile that states
spec.kubernetesVersion below the release where the gate is on by default has an authored
value refused by ValidateAuthoredPropertiesForTarget, naming the property’s path, the gate,
that release and the profile’s version; with no version nothing is checked. A profile’s
spec.featureGates overrides a gate’s state in both directions; it
needs spec.kubernetesVersion, refuses a name the table lacks, and has no lock or removal
state. The gates are
rows of one table in featuregates.go (name, first release with Default true, read from the
Kubernetes feature gates reference), held to the schemas by tests in both directions: a Gate
no row names, or a row no schema uses, fails. Only Kubernetes core
properties of the built-in components carry one today: EnvFiles
(env[].valueFrom.fileKeyRef), ContainerRestartRules (restartPolicyRules: an init
container’s on the workload kinds, any container’s on the raw-PodSpec kinds below), PodLevelResources (podResources) and HostnameOverride
(hostnameOverride). The check reads the declared schema, so it stops at an open object
(AdditionalProperties with no Properties). The raw-PodSpec kinds (pod and the kinds
that take a pod template, and the template of cnpg-pooler) leave their containers and template spec open, and their open
nodes carry GatedPaths (published as gatedPaths) instead: gate-relative paths
(env[].valueFrom.fileKeyRef, with [] after an array key) to the gate the field needs,
read by the gate check alone, so property validation and what a document is accepted as do
not change. A consumer that predates gatedPaths ignores it.
The gate check reads a value as the writer writes it. A property value built in Go can
hold a struct from the Kubernetes API types (a corev1.PodSpec in a template, a
[]corev1.EnvVar) where a decoded document holds a map. The check reads such a struct, a
pointer to one, or a slice of either, through its JSON form, so it is held to the same
gates as the decoded document. A struct that encodes to null is absent, as a decoded null
is. A struct that does not encode as JSON is refused, with its path, where a gate
below it is off at the target. The read comes before the null
check, so a nil slice of a named type whose own MarshalJSON writes an array is present,
and a pointer type that is its own element type (type P *P) is read through its JSON
form like any other.
A gate may also cover single values of an enum property: ValueGates (published as
valueGates) maps an Enum value to the gate that value alone needs, and the property is
accepted at every version for its other values. An authored value listed there is refused
below the gate’s release with the same fields plus the value
(value "Never" requires the Kubernetes feature gate ContainerRestartRules, ...). A key
that is not an Enum value, or a gate no row names, fails the schema tests. Like Gate,
the key is rejected at the two flat call sites, so it is absent from their allow-sets. Two properties carry it today: an init container’s
restartPolicy (Never and OnFailure, ContainerRestartRules) and service’s
trafficDistribution (PreferSameZone and PreferSameNode, PreferSameTrafficDistribution).
GatedPaths names a field, not a value. A path that gates values sits in ValueGatedPaths
(published as valueGatedPaths): a gate-relative path maps to a map from a value to its
gate, and the check walks the path as it walks GatedPaths. The raw-PodSpec kinds use it
for the restartPolicy of an init container, from the same table as the shorthand
(Never and OnFailure, ContainerRestartRules). Their restartPolicy on a regular
container is a plain GatedPaths entry, because Kubernetes forbids the field there with
the gate off, Always included. A null, a value that is not a string and a string the table
does not name use no gate. Like Gate, the key is rejected at the two flat call sites.
A property may also say which refusals by the environment policy an authored value can
cause: BoundedBy (published as boundedBy) lists
refusal classes, in RefusalClasses order. A
consumer that builds an input form reads there which properties the environment limits. The
list names the class and never the limit, which is the policy’s. On an open node (an
object that takes keys the schema does not declare, or an array of such items) it lists every
class a value at an undeclared key below the node can cause, with no path; a property the
node does declare carries its own. For an array of open items the list is on the array where
its items declare no property, and on the items where they do. A string property whose value
is a document the handler reads object by object, or the url that document is fetched from
(inline and url of manifests), lists the classes of the refusals of those objects. A
property declares a class when a value at it alone can cause it: the properties that name a
chart (source.url, chart and version of helmtemplate) declare none of the classes of the
objects it renders, which sit on its values and secretValues.
Nothing reads boundedBy to accept or refuse
a value, so a document is accepted as it is with or without it, and a consumer that predates
the key ignores it.
The built-in types declare a bound only where a test holds it, and the claim runs one way. A
declared class is shown to refuse a value at that property: from a document that passes, the
value there, or one below it for an open node, is changed, with the keys the changed
document needs beside it, the build is refused with that class, and the refusal is gone once the
one policy setting behind it is relaxed. A property that declares no class is not shown to be
free of one. Which built-in types declare bounds, and on which properties, is in
Declared bounds. A handler states its own bounds
with DeclareBounds, which takes a schema and a map from a path (volumes[].type, with
[] after an array key) to its classes, and leaves the schema it was given unchanged: a
fragment that several schemas share carries no bound, so a bound never reaches a type that
did not state it. Like Gate, the key is rejected at the two flat call sites, and a
component model (pkg/oam/model) may not write it on an input.
One bound is read through a lowering place and not through the property. helm declares no class
on values: under delivery: flux the cluster renders the chart and no object is read, so a class
declared there would be false for the default delivery. Under delivery: template the value is
handed unchanged to the values property of the helmtemplate it lowers to, which is held to the
environment policy and declares the classes of the objects a chart renders. A consumer reads values
of helm under delivery: template as that values bound, through the place ComponentLoweringKeys()
reports for the key (helmtemplate, values, unchanged, when delivery is template). That map is a
Go method and not part of HandlerSchemaSet, so a consumer that reads the published schemas as JSON
finds no bound on values of helm, which claims nothing. A test holds each step of the join.
Separately, validateProperties (property_validate.go) checks an EMITTED
component/trait/policy’s properties against its TARGET handler’s declared schema —
enforcing Required, Type/Types, Enum, and nested Properties/Items/
AdditionalProperties/AdditionalPropertiesSchema — immediately after a lowering rule returns it, so a rule
cannot silently produce properties its own target handler would reject.
Both this check and the authored one below write a normalised value back where the
handler’s reader would not accept what was supplied: a typed Go collection becomes
[]any/map[string]any; a string, boolean or number value of a named Go type
(type Mode string) becomes its predeclared type; and an integer value of kind
int8, int16 or any unsigned kind, or of any named integer type
(type Replicas int32), becomes int — a value outside the int range is rejected
instead. Values already of type int, int32, int64 or float64 are left as they
are, because some readers accept int but not int64; a named integer type becomes
int rather than its underlying type for the same reason. A Types union leaf is
rewritten by whichever member the value matched. A property whose schema declares
neither Type nor Types, or a key an open object leaves undeclared, is not rewritten.
ValidateAuthoredProperties (property_validate_authored.go) is that check’s
authored-path counterpart. Parsing is strict
(KnownFields(true)) only down to the envelope: Component.Properties,
Trait.Properties and ApplicationPolicy.Properties are each map[string]any, so
before this every handler read the keys it knew and silently dropped the rest — a
misspelled or stale property built successfully and produced nothing. The check walks
each authored component and its traits in document order, looks up the same schema
validateProperties would (terminal handler first, then a ComponentLoweringRule /
TraitLoweringRule claiming the type), rejects any key the schema does not declare,
and checks the shape of every key it does. kurel build calls it immediately after
parsing — and, in package mode, necessarily after ResolveParameters, because a
${...} placeholder is a bare string until substituted.
A reason on a refused key. The refusal of an undeclared top-level key can
carry the reason the type has for it. A component handler, a component lowering
rule, a trait handler or a trait lowering rule that has the method
UnsupportedFieldHint(key string) string is asked for the refused key, and a
non-empty answer is appended to the refusal after "; ":
component "web" (type "webservice"): properties: unsupported field "selector" (allowed: …); selector: not authorable; the Deployment selector is builder-managed (app: <component>), must equal the generated template labels and is immutable once createdThe built-in hand-parsed kinds answer with the reason they refuse a field of the
Kubernetes type they project, webservice and worker with their role-deployment member’s,
and the pvc trait with the persistentvolumeclaim kind’s
(site/content/api-reference/oam-components/upstream-fields-not-read.md, “Upstream fields a hand-parsed kind does
not read”); helmchart and helmrelease point a removed key to its replacement,
and postgresql a key its backup replaced (objectStore, objectStoreObjectName)
to where it went.
An empty answer adds nothing.
A key refused below the top level, inside an object the type declares, is
never passed to UnsupportedFieldHint, so a hint written for a top-level key is
not given for a nested key of the same name. At the same four positions, the
optional method NestedUnsupportedFieldHint(parents []string, key string) string
is asked instead. parents are the declared keys from the top level down to the
object that refuses the key, list items unnamed: initContainers[0].probes is
asked as ["initContainers"], "probes". A non-empty answer is appended the same
way:
component "web" (type "webservice"): properties.affinity: unsupported field "nodeAffinity" (allowed: …); affinity.nodeAffinity: not read — …The built-in workload kinds, webservice and worker answer with the reason
their parser gives for the key at that position (the components README, “Below
the top level”), and postgresql names the replacement of a key backup no longer
takes (destinationPath, endpointURL, secretName) and the reason backup.objectStore refuses a key
(serverName, azureCredentials, googleCredentials).
The refusal text itself is unchanged at every depth.
Where a refusal is, as data. Every refusal the property validators make is a
*PropertyError: errors.As finds it in the error the call
returns, a hinted refusal included, and Error() is the text above, byte for byte.
The platform-reservation check described below is one of them.
Its refusal has the kind platform-reserved, and it also wraps ErrPlatformReserved,
so errors.Is finds the sentinel too. A caller that maps a refusal to a reply of its
own reads these fields and parses no text:
| Field | Holds |
|---|---|
Kind | unsupported-field, required, exclusive, at-least-one, type, enum, range, null-element, platform-reserved (an authored value for a PlatformReserved key), or schema (the handler’s own schema is malformed, so the document is not at fault) |
Position | component, trait or policy; empty where the refusal was made on no authored document (a schema, a property a rule emitted) |
Component, Trait, Policy | the component’s name (for a trait, the one it sits on), the trait’s type, the policy’s name; empty where they do not apply |
Field | the location below properties: dotted keys, array elements as [n], as in probes.httpGet[0].port. For unsupported-field, required and platform-reserved it is the key itself; for exclusive the object holding the group, empty at the top level; for schema the node whose declaration is wrong |
Field is the path as the refusal builds it, so a key that itself holds a dot
reads the same as a nested one (a.b is one key or two); the kind and the
position are exact either way. A refusal that names a document position is made
by the three boundaries of this check; the same refusal made by Transform’s
emission checks carries a kind and no position. The exported helper
CheckSchemaNodeGroups returns the schema kind too.
Before any of that, it runs Transform’s own reservation check
(enforcePlatformReserved) over the document, with the same schemas and the same
error text Transform would report for it. It has to come first: validation drops an
explicit null under a nested declared object, so a reserved key authored as
config: {locked: null} would otherwise be gone before Transform could refuse it.
The shape check is also the only place an authored scalar’s type is enforced for
every property. Many built-in handlers read string properties
with a comma-ok assertion (cfg.Delivery, _ = props["delivery"].(string)), so on
the handler alone a delivery: 123 becomes "" and is defaulted as though it were
absent. Type-checking once here, against the schema each handler already declares,
is what rejects it — not a per-field check in each handler. A caller that drives
Transform directly must therefore call ValidateAuthoredPropertiesWithCapabilities
first (after any parameter substitution, with the bindings EvaluateProfile
returned) to get the same guarantee kurel build gives. ValidateAuthoredProperties
is the same check for a caller with no profile.
The validators return the document they validated, together with the error:
validated, err := tr.ValidateAuthoredProperties(app). It is a copy of app whose
property trees carry the result of the check: under the schema-declared fields, an
explicit nested null is stripped, and a named scalar or a typed collection is
rewritten to the plain Go shape a handler reads. A key accepted through
AdditionalProperties is left as authored, as before. The app argument is never
edited, for a plain type name and for a declared type identity alike. Transform strips and normalizes
nothing itself, so Transform the document the validator returned, not app: a
nested null in app still reaches the handler as nil. On an error the returned
document is nil and app is as it was authored. A nil app returns nil and no error.
Authored policies are checked the same way, after every component, in document order:
against the PolicyHandler registered for the type, else the PolicyLoweringRule
claiming it. The built-in policy handlers each declare a PropertySchema, so a
misspelt placement key such as teir is a build error rather than a
setting the handler never reads.
Three positions are exempt, each because there is no schema to check against: a
component or trait type no handler and no lowering rule claims (rejected separately
by the type allowlists and by validateSettled); a custom trait type from a
CapabilityDefinition, which declares that the type exists but not what properties
it accepts; and a policy type nothing is registered for, which the transform rejects
with no handler for policy type.
Required is enforced at the top level too, as written, and a null counts as absent: component "web" (type "webservice"): properties: "image" is required. Two cases are left to the platform and are not refused here. A trait a
capability binding matches is checked on the merged properties, as described below, because
ClusterProfile capability rendering merges into its top-level property map after this
runs. A component key that its handler lists in ComponentCapabilityDefaults is filled by
the capability, so its absence is accepted.
Nested Required, inside an object the author did write, is enforced, and top-level Required on a matched trait follows the same
rule. A kind component’s published schema carries the nested fields its build refuses whenever the kind is built (cluster.name of
cnpg-pooler, rules[].backendRefs of tcproute), so a request that omits one fails here and not in the build; see
Required fields the published schema carries:
ValidateAuthoredPropertiesknows no profile, so it checks nestedRequiredas written, on every trait.ValidateAuthoredPropertiesWithCapabilities(app, capabilities)does the same for a trait no binding matches. For a trait a binding matches, it checks the trait’s properties as the rendering merges into them, recursively, so a required key the rendering supplies is not refused: a partial override such asissuerRef: {kind: Issuer}over a renderedissuerRef: {name: ca}is accepted. A missing key is then reported as"name" is required; neither the trait nor capability "certificate"'s rendering sets it. A required key inside an array element is always checked as written, because a rendering never merges into a list.ValidateAuthoredPropertiesForTarget(app, capabilities, target)is the capability variant plus the feature-gate check (PropertySchema.Gate, above) for a cluster attarget, a*KubernetesVersion(ClusterProfileSpec.TargetVersionreturns the profile’s). Everything the capability variant refuses is refused first. A niltargetis an unknown version, and the result is the capability variant’s, the validated copy included.Transformdoes not read the version for this check: it only refuses, so an accepted document renders the same at any version.ValidateAuthoredPropertiesForTargetWithGates(app, capabilities, target, gates)is the same call with the profile’sspec.featureGates(ClusterProfileSpec.FeatureGates): an entry replaces the table’s answer for that gate in both directions, and a refusal it causes namesspec.featureGates.ValidateAuthoredPropertiesForTargetis this call with nilgates.TransformContext.FeatureGatescarries the same map, read withTargetVersion, to the Service-name check (RelaxedServiceNameValidation); it is ignored whenTargetVersionis nil.ParseKubernetesVersiontakes1.35,v1.35andv1.35.2(patch ignored) and refuses anything else, a major other than 1 included.Transformmakes the same check itself on every trait’s merged properties, at both merge sites (trait dispatch and the lowering fixpoint), whether or not a binding matched. This is new for a caller that runsTransformwithout the validator: a nested required key missing from both the trait and the rendering used to reach the handler and is now refused.kurel buildalready ran the validator, so its output is unchanged.
The Required keys inside an object are checked only when that object is present after the merge. An optional object property that is left out entirely is not checked, as at the top level. An object property that is itself Required and is left out is refused as a missing key, like any other.
One property is legal on every trait regardless of what its handler declares:
scope. It is read by the transform engine rather than by a handler —
buildCapabilityKey builds the "<traitType>.<scope>" capability key for every trait
type, so a pvc or certificate trait can select a scoped ClusterProfile binding
even though neither handler declares such a property. expose, ingress and
httproute do declare it, but for an unrelated reason (sub-application naming), and
their own declaration wins over the engine default. Engine-owned keys are checked even
on a trait whose handler or lowering rule declares no PropertySchema at all (for
example a custom handler registered through RegisterTrait): a non-string scope
there is rejected, while the handler’s own keys stay unchecked because nothing
declares them. A handler that refuses keys it does not read (for example
topology-spread, which takes none) asks IsEngineTraitProperty and lets these
through. It cannot tell an authored scope from one a capability rendering merged
in, and a rendered one selects nothing (the binding was already chosen), so such a
handler also refuses rendering keys in ValidateAndApplyDefaults, at
EvaluateProfile. Add to engineTraitProperties if
another engine-read property is ever introduced; the merge never mutates the
handler’s returned schema, so HandlerSchemas still advertises only what each handler
actually declares.
validateProperties’s null check (isNullValue) treats a typed-nil pointer,
slice, or map — not just a bare nil interface — as null: a Go type assertion
alone can’t tell an uninitialized slice/map apart from a validly-typed empty
collection, so a lowering rule that emits an unset (rather than empty) collection
field is still caught.
IsNullValue is the exported form of that check, and with it the contract itself:
a null value is absent, not present-and-empty. The predicate is nil-ness, not
serialization, and that distinction is load-bearing rather than pedantic: whether
the two shapes serialize differently depends on the ENCODER. encoding/json (and
sigs.k8s.io/yaml, which routes through it) writes null for a nil map or slice
and {}/[] for an allocated empty one, but gopkg.in/yaml.v3 — the YAML library
this package parses with — renders both as {}/[], because its encoder
dispatches on reflect.Kind. Keying the contract on nil-ness rather than on
rendered output is what makes it hold under either. The predicate parts company
with every encoder only on values no document round-trips (a nil channel is
reported null though encoding/json cannot marshal it at all).
It exists for parsers outside this package — handler and trait property readers,
and out-of-tree lowering rules — that must classify a null the same way the
validator does. Use it rather than value == nil: a typed nil is a non-nil
interface holding a nil value, so == nil is false and a .(map[string]any)
assertion on it succeeds with ok=true and a nil map, making the key read as an
authored empty collection. Where empty and absent mean different things that
difference is a behaviour change, not a cosmetic one. The standing example is a
metav1.LabelSelector in a NetworkPolicy peer: an empty one matches everything,
while a nil one applies no constraint on that axis — which is not the same as
matching nothing, since what the peer then selects depends on the sibling fields it
still has (k8s.io/api networking/v1/types.go:199-222).
IntegerValue is the matching reader for integers. It returns a property value as
an int64 when it is a whole number of any Go integer kind, named or not, or a
finite integral float. It refuses a fraction, NaN/±Inf, a non-number, an unsigned
value above math.MaxInt64, and a float outside −2^63 ≤ value < 2^63 (−2^63 itself
fits int64 and reads; 2^63 does not). The builtin handlers
read every integer property through it, and each then checks the result against its
own target (a port is 1–65535, a replica count fits int32), refusing a value that
does not fit rather than converting it. So a plain int32 or int64 from a lowering
rule or a Go caller reads the same as the int the YAML decoder produces, and a
value that would only fit after wrapping, like 2^32+80 for a port, is an error
instead of port 80. An out-of-tree handler should read integers through it for the
same reason. IntegerInRange(value, lo, hi) adds the target check and names the true
refusal reason, so an overflow like 1e20 never reads as a type error; a capability
integer property is checked with it too.
What an explicit null means on the emitted path
The contract, stated once because “null” has several readers here and aligning them one at a time is what made this take six rounds:
A value that serializes to JSON null is absent, at every depth, on every path; a null is never a member of any
Itemstype, so a null array element is a type error; reservation is about the KEY being written.
Applied in two places, because a key and an array element are not the same kind of thing:
A declared, optional object key holding a null is DELETED before its value is checked, and so is a key an
AdditionalPropertiesSchematypes: it is treated as a declared optional key. A key a bareAdditionalProperties: trueleaves open keeps its null.Requiredalready classifies a null as absent, so materialising it as a present key contradicted the classification the file had already made — and a handler parser decides presence with a bare two-value map lookup, so it saw a key the validator had decided was not there.A null ARRAY ELEMENT is rejected, by an explicit guard rather than by the type check. An element cannot be absent — it is present by being in the list — so there is nothing to normalise it to, and dropping it would renumber its siblings under a schema that may constrain length and order. The guard is necessary rather than decorative: a typed nil (
map[string]any(nil),[]any(nil), reachable from a rule written in Go) satisfies the plain type assertion the object/array coercers try first, and iterating the resulting empty collection rejects nothing, so the type check alone accepted it. AnItemsschema with no declared type checks nothing at all — and so does noItemsschema, which is why the guard runs before theItemswalk rather than inside it: declaring no element schema says nothing about the members, but it does not license the one member noItemstype could ever have matched.An
Enummember holding a null where the value’s null would be stripped or rejected is refused. Members are compared against a value that has already been normalised, while the declared members are not, so such a member could never match anything that reaches the comparison. Refusing it names the schema defect instead of leaving anEnumthat silently never matches.The member is walked alongside its schema, because normalisation does not reach everywhere: a key an object leaves to
AdditionalProperties: truewithout anAdditionalPropertiesSchema, anything inside an array element with noItemsschema, and anything below a schema with no declaredTypepass through as written. (A key anAdditionalPropertiesSchematypes is walked against that schema, as a declared key is.) A value can hold a null there, so a member holding the same null matches it and is accepted —{opaque: null}againstEnum: [{opaque: null}]on an open object. A member’s null compares equal only to a null value, whatever either side’s Go type, and never to an empty collection. The rule is one-sided: where only the value holds a typed nil under such a key and the member holds an empty[]/{}, the two still match, as they always have — an undeclared key is outside every normalisation rule, so this does not start distinguishing a typed nil from an empty collection there. A member that cannot match for another reason — the wrong shape for the schema’s type, or a key a closed object refuses — is still refused for any null it holds, as before.Refused per member, not per schema type. Refusing every
Enumdeclared on an array or object type is simpler to state and was the first shape of this rule, but it also refuses the null-free compound enums that match perfectly well — andPropertySchemais exported, so a handler outside this repo would have seen a schema this validator used to accept start failing for a reason that does not apply to it. No built-in schema declares anEnumon a non-scalar type today, but nothing asserts that as a rule and this check does not depend on it.The walk of every schema that ships for an
Enummember holding a null is exported asCheckEnumMembersHoldNoNull(schema PropertySchema) error, so a handler outside this package can assert the same of its own schemas. It reports everyEnummember — on the schema and on every schema nested under itsProperties(in sorted key order),ItemsorAdditionalPropertiesSchema(path*) — that holds a null anywhere, named by schema path and member index, and returnsnilwhen none does. It is deliberately stricter than the runtime arm: it does not read the schema around a member, so it also reports the matchable nulls described above (under anAdditionalPropertieskey, inside an array element with noItems, below a schema with noType). A schema it passes is never refused by the runtime’s null rule; one it fails may still validate. A member nesting past the validator’s depth bound counts as holding a null, as it does at runtime.
Two things this deliberately does not do:
- It makes no exception for
PlatformReservedkeys. Reservation (enforcePlatformReserved) is a rule about what a user wrote. On the authored surface the two rules never meet — it runs upstream of any emission validation, andValidateAuthoredPropertiesruns it before its own strip — so reservation keeps treating an explicit null as present while the strip treats one as absent. Exempting reserved keys here would not have preserved the authored rule; it would only have handed a reserved null to the type check, producing a loud rejection with the wrong reason. The component and trait surfaces keep the same separation: an authored component or trait is checked before any rule can rewrite it. One a rule emitted from checked input — whose properties are the ones the strip touches — is exempt from reservation; the output of a rule whose input was not checked stays authored, and its components and traits are checked as they are emitted, before the strip (see the rule-output contract in Lowering). - A key the schema does not declare is untouched, including inside an object
that sets
AdditionalPropertieswithout a value schema. Nothing describes such a value, so nothing here can normalise it, and a null inside an opaque object still reaches the handler parser. This is the same horizon as validation itself.
Scope, because this contract is not settled repository-wide: ValidateAuthoredProperties
(above) does reach validatePropertyValue — it calls it directly for every
authored key, with no strip of its own first. That is why
validatePropertyValue carries its own top-level null check
(if isNullValue(value) { return value, nil }) rather than relying entirely on
validateObjectProperties’s strip: on the emitted path the strip runs first and
the check is usually moot, but on the authored path it is what makes an
explicit null under an optional field read as absence instead of a type error.
What the contract does not reach is any path that skips both validators
entirely — a component a lowering rule constructs directly in Go, or a
built-in parser’s own field read (pkg/oam/builtin/components) — which is why
those parsers keep their explicit-null guards regardless. Aligning that
parser-level layer with this contract is a separate, lower-level concern, and is not closed by this.
Two surfaces used to be named here as sitting outside the contract; both are now fixed, so the note is historical rather than a live caveat:
- Capability rendering (
checkCapabilityValueType,capability.go) is still outside the contract by the scope sentence — it is a parallel implementation, not a call-through tovalidatePropertyValue— but it now agrees with the contract’s own behaviour: a present null reads as absence, matching the handler surface, and the type switch has adefaultarm. See Capability rendering: types and nulls for the current, authoritative description. - The networkpolicy peer parser used to read a typed nil
namespaceSelectordifferently from an untyped one. Fixed — both parsers now route their presence check throughoam.IsNullValue’s reflect-based classification, so a typed nil reads as omission on every path that reaches it, the same as an untyped one.
Contract metadata
Handlers and lowering rules may implement ContractDescriber (ContractMetadata() ContractMetadata) to declare registration metadata about the contract they
implement: Family, Version, RequiredCapabilityKeys (the ClusterProfile
capability keys an entity of this contract needs), Prerequisites, PlatformNeeds and
Readiness (see below), Level, Deprecated, and DeprecationMessage. It is primarily a discovery/documentation surface — the engine
does not enforce any of these fields (CapabilityAware.CapabilityRequired is what the
engine actually enforces). It is read in four places. Level is base-kind for a type
that projects one object and holds no launcher opinion (every handler), higher-level-model
for a type that adds an opinion on a kind or builds several objects (a lowering rule such as
webservice, postgresql or tls-certificate), and empty for a trait and a policy;
Transformer.TypeCatalog() reads it (below). A lowering rule’s Version composes
the "@<version>" suffix on Origin.Rule (see below). Deprecated turns every
authored component or trait of that type into one warning through the Transformer’s
warning handler (SetWarningHandler), in document order: component "<name>": type <t> is deprecated[: <DeprecationMessage>], or trait type <t> for a trait. Both
Transform and TransformWithPolicy warn; LowerRaws does not, because its output
re-enters Transform as authored and warns there. The check reads the authored
document before lowering, so a component a rule synthesizes never warns. A
deprecation is never an error and never changes the output. PlatformNeeds is
collected into PolicyResult.PlatformNeeds, a report that never changes the output
either (see below). Nothing else here is read or enforced. Consumers otherwise: schema publication, artifact
provenance in a downstream consumer, and deprecation tooling. Metadata rides the
existing registration mechanism; there is no separate contract registry.
Transformer.TypeCatalog() lists every registered component, trait and policy type, in that
order and by plain name within a position, as a TypeCatalogEntry: position, key (the
plain name the type is registered under), qualifiedName (the declared identity,
certificate.cert-manager.io@v1, or the plain name for a type that declared none),
shortName and, for a component type, level. A client shows qualifiedName and level
together, so a kind and a higher-level type that share a short name read as two things.
The JSON form is {"position":"component","key":"tls-certificate","qualifiedName":"tls-certificate.launcher.gokure.dev@v1","shortName":"tls-certificate","level":"higher-level-model"}.
Transformer.HandlerContracts() returns a HandlerContractSet{ Components, Traits, Policies } of every registered component, trait and policy handler, and every
component, trait and policy lowering rule, that implements ContractDescriber — the
same six registries HandlerSchemas() covers (componentHandlers, traitHandlers,
policyHandlers and the three lowering-rule registries), for the identical reason: a
type reachable only through a lowering rule must still publish its metadata.
Breaking library change: HandlerContractSet gained the
Policies field, so an unkeyed composite literal of it no longer compiles.
A lowering rule that implements ContractDescriber also has its Version folded
into the lowering-rule identity recorded on Origin.Rule (see Lowering), e.g.
"trait/expose@v1alpha1".
Every built-in handler and lowering rule implements ContractDescriber. The scheme: Family is the type name the built-in is
registered under (webservice, expose, placement), Version is
builtin.ContractVersion (v1alpha1, one value for all of them), and
RequiredCapabilityKeys is the type name for a built-in whose
CapabilityAware.CapabilityRequired returns true (certificate, expose) and
empty otherwise. No built-in is deprecated. A built-in rule’s identity therefore
reads component/webservice@v1alpha1, on Origin.Rule, on LoweringStep.Rule and
in a LoweringError chain, where it read component/webservice.
Prerequisites lists what must be in place in the target
cluster, or beside it, for the output to work once applied: an operator, a CRD, an
object the output names and does not create. Each ContractPrerequisite{ Name, Version, When } is text for a reader: Version is "" when any version will do,
When is the use of the entity that needs it, "" when every use does. The build
runs offline and checks none of them, and the engine never reads the field; a
consumer can, for example to check a cluster before the first apply. Unlike
CapabilityAware.CapabilityRequired it never fails a build. A nil list means none is
declared, not that none is needed: a contract whose output is a CRD’s object needs
that CRD and its controller whether it lists them or not. Of the built-ins only the
postgresql rule sets it, with the prerequisites of its backup and recovery
(When backup or recovery set): the CloudNativePG operator, the Barman Cloud
plugin, its objectstores.barmancloud.cnpg.io CRD, and the bucket and Secrets the
objects name; and, each When its property is set, the ObjectStore
recovery.source.objectStoreName names and the owner’s Secret recovery.secret.name
names. docs/postgresql-backup-recovery.md has the same list with the
reasons. cert-manager
is not on it: the plugin’s install recommends it for its own TLS, which can be
supplied otherwise. Breaking library change: ContractMetadata gained the
field, so an unkeyed composite literal of it no longer compiles.
PlatformNeeds lists the capabilities the platform must serve for the output of an
entity of this contract to work. Each PlatformNeed{ Capability, When } is a name,
never an installation, so the consumer chooses how a need is met: for a built-in kind
that emits custom resources, Capability is the API group of those resources, for
example postgresql.cnpg.io. When is text for a reader, as in ContractPrerequisite
("" when every use of the entity needs it). It differs from Prerequisites in three
ways: a need is a name a consumer can match instead of free text, it lists only
capabilities (never a bucket or a Secret), and the engine reads it. Nothing is
enforced: no build fails because a need is unmet, and the ClusterProfile is not
consulted. A nil list means none is declared, not that none is needed. Of the
built-ins, the eleven CloudNativePG family kinds (cnpg-cluster, cnpg-database,
cnpg-objectstore, cnpg-pooler, cnpg-backup, cnpg-clusterimagecatalog,
cnpg-databaserole, cnpg-imagecatalog, cnpg-publication, cnpg-scheduledbackup
and cnpg-subscription) each declare one (barmancloud.cnpg.io for
cnpg-objectstore, postgresql.cnpg.io for the other ten), and the postgresql rule
declares both, the second with When backup or recovery set. The other kinds that
need an API (cert-manager, external-secrets, the Prometheus operator, Flux, Gateway
and the rest) do not declare one yet.
Two places carry a need, and they answer different questions.
Transformer.HandlerContracts() publishes what each type declares: for a lowering
rule such as postgresql that is the superset of what it may emit, for discovery.
PolicyResult.PlatformNeeds, returned by TransformWithPolicy, is the sorted,
deduplicated union of what the handlers of the components of the lowered application
declare, so it is what that application emits. A handler that implements the optional
interface ComponentPlatformNeeds (PlatformNeedsFor(component *Component) []PlatformNeed) answers for each component by its properties, and that answer is used
in place of its static list. The cnpg-cluster handler does so: it adds
barmancloud.cnpg.io when its plugins or externalClusters[].plugin carry an enabled
barman-cloud.cloudnative-pg.io entry, so a postgresql that archives or recovers
through the plugin, even by the name of a store it does not emit, reports it, and one
that does neither reports postgresql.cnpg.io only. It follows
ConsumedCapabilities (see Transform and lowering): a
report, nothing enforced, nil when nothing declared a need, and not produced by
LowerRaws, which returns no result. The report reads the components of the lowered
document: a component a trait lowering rule emits is in it, and a sub-application a
trait adds after lowering is not. No CloudNativePG kind is added that way. Library addition: ContractMetadata and PolicyResult
gained a field each, so an unkeyed composite literal of either no longer compiles;
none exists in this repository.
Readiness lists, for each kind of resource an entity of
this contract provides, how a reader judges that the resource is ready. Each
ContractReadiness{ Group, Kind, NamePattern, Condition, Field, Value, Generic } names
the kind (Group is "" for the core group), says in text how the resource is named
(NamePattern, for example <component>-pooler), and gives its signal: either
Condition, a status condition type that reads True when the resource is ready, or
Field with the Value it holds when ready, never both. Generic says whether a
generic health check, one that reads a Ready condition and applies no other rule,
can judge the kind: GenericJudges ("judges", valid only with Condition: "Ready"),
GenericCannotJudge ("cannot-judge", the kind needs a resource-specific rule; both
signal fields may then be empty when the entity gives none), or GenericUndeclared
("", the entity does not say). An entity that provides several kinds lists one
entry per kind, in a stable order. The declaration is made by the entity, read by a
consumer and enforced by nothing: the engine never reads the field, no registration
or build step checks it, and nothing checks that the named condition or field exists
on the real resource. A nil list means none is declared, not that the resources are
ready at once or need no waiting; an empty non-nil list reads the same as nil. Only
postgresql declares readiness, one entry for each kind it
lowers into; pkg/oam/builtin/components/README.md lists them. Breaking library change: ContractMetadata
gained the field, so an unkeyed composite literal of it no longer compiles.
Lowering targets and Seal
A lowering rule emits elements other handlers render, so a registry that holds the
rule without them fails only when a document reaches the gap. A rule that
implements LoweringTargetDeclarer declares, in a LoweringTargets{ ComponentTypes, TraitTypes, PolicyTypes }, every type it can emit over all of its inputs: the
components it emits, the traits it emits or attaches to a component it emits, and
the policies it emits. A type it only forwards from its input is not a target, and
document kinds are not listed.
Transformer.Seal() checks every registered rule that declares targets, of any
kind (document, raw document, component, trait, policy): each declared type must be
registered at its position, as a handler or as another lowering rule. The check
cannot run at registration, because a rule and the handlers of its targets are
registered in any order. Transform and TransformWithPolicy call Seal first, so
an incomplete registry is refused whether or not the document uses the rule;
LowerRaws does not, because it dispatches no handler. A caller that has finished
registering may call Seal itself to learn of a gap before it has a document. The
error names each rule and the type it is missing, sorted:
Seal stores nothing and locks nothing: it reads the registry as it stands, may be
called any number of times, and accepts on the next call a type registered after a
refusal. A rule that does not implement LoweringTargetDeclarer is not checked, and
the engine does not check that a rule emits only what it declares.
Breaking library change: a consumer that registers a
built-in lowering rule without the types it lowers into now fails at Seal or at
the first transform, where it failed only for a document that reached the missing
type. The built-in rules declare:
| Rule | Components | Traits | Policies |
|---|---|---|---|
webservice | role-deployment, service, serviceaccount | topology-spread, pvc | |
worker | role-deployment, serviceaccount | topology-spread, pvc | |
helm | helmrelease, helmtemplate, helmrepository, ocirepository, gitrepository, bucket | configmap, secret | |
postgresql | cnpg-cluster, cnpg-objectstore, cnpg-pooler, cnpg-database, cnpg-scheduledbackup | dependency, placement | |
oci | ocirepository, fluxcd-kustomization | ||
expose (trait) | ingress, httproute |
Lowering keys
A lowered component type has no entry of its own in the provenance report
(TransformWithProvenance): its rule replaces the component by members, and the
report speaks at the members’ paths. A component lowering rule that implements
LoweringKeyDeclarer says where to read. LoweringKeys() returns, for every key of
the rule’s schema, the places its value lands, each a LoweredKey{ Member, Trait, Path, Unchanged, When }:
Memberis the component type of the emitted member, which is the report’sMemberinside a same-name sibling group. Outside one the report names the component with no member: aworkerwith an authoredserviceAccountNameis read under the plain owner.Traitis the type of a trait the rule attaches to that member, when the value lands in a trait.Pathis the path in the member’s properties or the trait’s.Unchangedis true when the rule hands an authored value on as written. A path below the key is then the same path belowPath, and the report calls an authored value therecopied. When false the rule reads the key itself and may build what lands there, in another shape.Whenlists conditions on the component’s authored properties (for a trait rule, seeexposebelow), each a key and the values it may hold. All must hold for the place to apply (LoweredKey.LiveFor), and an empty list applies to every component. An empty string among the values also matches a key left out or written null, and a key matches a property in any letter case.
A key that reaches no property of a member maps to no place.
Transformer.ComponentLoweringKeys() returns the maps of the registered rules by
component type; a rule that declares none is left out.
webservice and worker publish a map. Which keys are forwarded comes from the
function the rule forwards its properties with, so the two cannot disagree on it; the
places of the keys the rule evaluates itself are declared beside it. Every key not listed below
lands unchanged at the same key of the role-deployment member:
| Key | Lands at | Unchanged |
|---|---|---|
port (webservice) | role-deployment ports[0].containerPort, service ports[0].port | no |
affinity | role-deployment affinity, as a Kubernetes affinity | no |
volumes | role-deployment volumes, and a pvc trait on it for each claim a volume generates | no |
topologySpread | the topology-spread trait on role-deployment | no |
serviceAccountObjectName | role-deployment serviceAccountName | no |
deploymentObjectName, serviceObjectName (webservice) | no place: they name objects |
The topology-spread trait the rule attaches holds no property, so the report has
no leaf for topologySpread, present or absent. The trait does fill a field of the
Deployment: from two replicas the report holds one builtin entry for it,
topologySpreadConstraints under the trait, and none at one replica, so replicas
declares that place as a fill it can make. serviceAccountObjectName names the
ServiceAccount the component generates, and the deployment’s pods run as it: the
member’s serviceAccountName holds the name resolved for the account, which is the
Naming hook’s answer or the component name when the key is left out.
Two keys are tied. The rule’s own spread (topologySpread, on unless set to false)
and a non-empty authored topologySpreadConstraints list are refused together when
the objects are generated: a component that authors constraints also sets
topologySpread: false. An empty list is accepted beside the rule’s own spread.
One key reaches the place of another. A volumes entry whose claim is ReadWriteOnce
or ReadWriteOncePod and not also ReadWriteMany (a claim that names no access mode is
ReadWriteOnce), on a component that authors no strategy, gives the deployment the
Recreate strategy: the report then holds a builtin entry at the deployment’s
strategy.type, the place of the strategy key. With such a claim an authored
strategy of another type is refused. A claim that is only ReadOnlyMany does
neither.
oci publishes a map. It has no loop over its schema, so the places are declared beside
the code that builds its two members, and a test that authors every key holds them to
what the rule emits: a place the key does not change fails, and so does a change at a
place the map does not declare. The registry access keys of source are listed once, in
the slice the schema and the map both read; the lowering names each of them again. No
place is Unchanged below source, because source.secretRef.name lands at
secretRef.name:
| Key | Lands at | Unchanged |
|---|---|---|
source | ocirepository url and each access key (secretRef, provider, insecure, certSecretRef, proxySecretRef, serviceAccountName); fluxcd-kustomization sourceRef | no |
version | ocirepository ref (a tag as ref.tag, a sha256: digest as ref.digest); fluxcd-kustomization sourceRef, when the key changes which source the Kustomization names | no |
interval | ocirepository interval and fluxcd-kustomization interval; sourceRef, when the key changes which source the Kustomization names | yes for the two intervals |
path, prune, targetNamespace, wait | fluxcd-kustomization, the same key | yes |
healthChecks | fluxcd-kustomization healthChecks, each entry rebuilt from its four fields | no |
kustomizationName | no place: it names the Kustomization object |
The map names member types, not instances. With source.name written, or a source two
or more oci components share, the ocirepository is a component of its own and the
fluxcd-kustomization is no member of a group with it, so the source places on
ocirepository name that component. The report then names the Kustomization with no
member, and its places are read under the plain owner. The source sub-keys are one key
of the map: a reader cannot tell source.url from source.secretRef by it.
helm publishes a map. Every place carries a condition on delivery, and some also one
on valuesMode:
| Key | delivery: flux (the default) | delivery: template |
|---|---|---|
interval, targetNamespace, driftDetection, install, upgrade | helmrelease, same key | no place |
releaseName | helmrelease, same key | helmtemplate, same key |
values | helmrelease values (valuesMode unset or inline); under valuesMode: configMap a configmap trait on it, and valuesFrom | helmtemplate values |
valuesFrom | helmrelease valuesFrom | no place |
secretValues | a secret trait on helmrelease, and valuesFrom | helmtemplate secretValues |
valuesConfigMapName (valuesMode: configMap), valuesSecretName | the trait’s name, and valuesFrom | no place |
chart | helmrelease chart.spec.chart | helmtemplate chart |
version | helmrelease chart.spec.version; for an OCI source ocirepository ref and helmrelease chartRef | helmtemplate version |
source | the source member’s url, ref, endpoint, bucketName, provider, region, prefix; helmrelease chart.spec.sourceRef or chartRef | helmtemplate source |
hookGroupNamePrefix, layoutKustomizationName, scopeOverrides | no place | helmtemplate, same key |
delivery, valuesMode, helmReleaseName, endpoints | no place | no place |
Unchanged are the helmtemplate places other than source, and the helmrelease
places interval, targetNamespace, driftDetection, install, upgrade,
releaseName and values. Which source member a document holds follows the source’s
kind, which no condition names. A generated source is a component of its own, so its
places name that component. The report names the helmrelease or helmtemplate with no
member, so its places are read under the plain owner.
postgresql publishes a map. Its rule parses each key and builds its members from the
result, so no place is Unchanged. One place is conditional: version reaches
imageName only where imageName is unset or empty. The keys land as follows:
| Key | Lands at |
|---|---|
version, imageName | cnpg-cluster imageName |
storageSize, replicas | cnpg-cluster storage.size, instances |
resources, inheritedMetadata, monitoring, affinity, externalClusters, bootstrap | cnpg-cluster, same key |
postgresql, replication, managedRoles | cnpg-cluster postgresql.parameters, postgresql.synchronous, managed.roles |
recovery | cnpg-cluster bootstrap.recovery, externalClusters; with an inline source, cnpg-objectstore configuration |
backup | cnpg-cluster plugins; cnpg-objectstore configuration, retentionPolicy; cnpg-scheduledbackup schedule, immediate, suspend, target, backupOwnerReference |
pooler | cnpg-pooler instances, type, pgbouncer |
databases | cnpg-database name, owner, ensure, databaseReclaimPolicy, extensions |
clusterObjectName | cluster of cnpg-pooler, cnpg-database and cnpg-scheduledbackup |
provider, poolerName | no place |
The map names member types, not instances. The Cluster and the backup store carry the
component’s name; the pooler, each database and scheduled backup and an inline recovery
store are components of their own. With no backup the report names the Cluster with no
member, so its places are read under the plain owner.
The expose trait rule publishes a map too. Transformer.TraitLoweringKeys() returns
the maps of the registered trait lowering rules by the trait type each claims, as a
copy. On these places Trait is the trait the rule emits, ingress or httproute,
Path is a path in that trait’s properties, and Member is empty: match the
component, the trait type and the path, whatever member the report names. Every place
has a condition on controllerType. The platform’s capability rendering supplies that
key, so pass LiveFor the trait’s properties after the capability merge.
| Key | controllerType: ingress, on ingress | controllerType: gateway, on httproute |
|---|---|---|
annotations, name, scope, servicePort, serviceName, networkPolicy | same key | same key |
rules | rules, managedTLS.hosts | rules |
hostnames | rules, managedTLS.hosts | hostnames, rules |
ingressClassName | same key | no place |
certManagerClusterIssuer | platformAnnotations, managedTLS | no place |
secretName | managedTLS.secretName | no place |
sslRedirect, forceSslRedirect, allowedGroups, authURL, authSigninURL, authResponseHeaders | platformAnnotations | no place |
gatewayName, gatewayNamespace | no place | parentRefs |
controllerType, allowedHostnameWildcard | no place | no place |
Unchanged are the places under the key’s own name. Where the rule keeps a key that has
no place under the controllerType on the trait it emits, the transform refuses that
trait, whose schema has no such property. A live place is where the value
can land, not a promise that the trait holds it: managedTLS is built only with a
certManagerClusterIssuer; authURL, authSigninURL and authResponseHeaders write
nothing without allowedGroups; and hostnames build rules only where rules is
left out. platformAnnotations is one path for these annotations. A place names no
trait index, so two traits of one emitted type on one component are not told apart.
A component type defined by a model publishes no map.
ComponentLoweringKeys() returns a copy: writing to it changes no rule’s map.
The plain owner
Where a component’s members form no same-name group, the report names no member for an
entry under the component’s own name, and a reader that goes from such an entry back to a
key needs to know which member it is read under. That is the member emitted under the
input component’s own name in every document the rule lowers, its plain owner. It is the
member’s name that is meant: an objectName can name the object the member generates
otherwise. A member emitted under another name (a generated source, a Pooler, a database)
is a component of its own, and the report speaks of it by that name.
Transformer.ComponentPlainOwners() returns
it by component type, beside the key maps, as a list of PlainOwner (Member, and
When as a place’s conditions, read by PlainOwner.LiveFor): the owners live for one
document are exactly one. A rule declares it with PlainOwners() (oam.PlainOwnerDeclarer)
beside its LoweringKeys(), and a rule that declares none is left out. Every built-in
type with a key map has one:
| Type | Plain owner | Why only it |
|---|---|---|
postgresql | cnpg-cluster | the backup cnpg-objectstore carries the name too, with a backup |
oci | fluxcd-kustomization | the ocirepository carries it only for the component’s own source |
helm | helmrelease, or helmtemplate where delivery is template | one member, which follows delivery; a generated source never takes the name |
webservice, worker | role-deployment | the service and serviceaccount members carry the name in some or all documents |
A webservice always emits its service under the component’s name too, so its report
always names members and its plain owner is never read for an entry with no member. A
test builds each type’s documents through its rule and fails where the published owner
is no longer emitted under the component’s name. ComponentPlainOwners() returns a copy, as
ComponentLoweringKeys() does.
The map is structure, not a report. A place holds an entry whether the author wrote
the key or the rule, the policy or a built-in default filled it: an omitted port
and an authored one are both rendered at ports[0].containerPort, and no report
tells them apart: whether the author wrote such a key is read from the document. At
an unchanged place an authored value is copied from authored.
The “no handler” error
A type with no registered handler fails the transform, and the message names where
the element is: no handler for component type "x" (component "web"), no handler for trait type "x" (on component "web"), no handler for policy type "x" (policy "first"). For an element a lowering rule emitted, it also names the rule and the
authored component it lowered:
A trait the author wrote, forwarded by a rule onto a component the rule emitted under
another name, names that component and, through it, the rule and the authored
component: no handler for trait type "x" (on component "web-rendered", itself emitted by lowering rule component/role for component "web" (type "role") in document "app" (kind "Application")). One a document rule moved to another component names the
component it was written on: (on component "worker", authored on component "web" (type "webservice") in document "app" (kind "Moving")). On the component the author wrote it
on, by name, the clause is left out.
The emitted form is reached only for a type the package knows and the registry holds no
handler for, and only for a rule that does not declare the type as a target (Seal
refuses a declared one first). A type the package does not know is refused earlier,
when the lowered document is validated.