Skip to main content

Property schemas and contract metadata

Implementation, history and tests of the sections on the reference page Property schemas and contract metadata. Text in square brackets is added here to say what a moved sentence refers to.

Property schemas

  • History:
    • go-kure/launcher#421 (a kurel parameter’s Type is string, integer, boolean, array or object).
    • go-kure/launcher#383 (Types is the union idiom: a leaf that accepts more than one scalar type).
    • go-kure/launcher#790 (Exclusive is the one-of idiom).
    • go-kure/launcher#635 (a reservation on an inner field of a declared array of objects is enforced wherever it is declared, not only at the top level; a reserved key authored as config: {locked: null} is not gone before Transform can refuse it).
    • go-kure/launcher#1231 (spec.featureGates overrides a gate’s state in both directions).
    • go-kure/launcher#1183 (a Gate no row names, or a row no schema uses, fails the schema tests).
    • go-kure/launcher#1245 (gatedPaths is read by the gate check alone, so property validation and what a document is accepted as do not change).
    • go-kure/launcher#1320 (a struct that does not encode as JSON is refused, with its path, where a gate below it is off at the target).
    • go-kure/launcher#1450 (a pointer type that is its own element type, type P *P, is read through its JSON form like any other).
    • go-kure/launcher#1230 (ValueGates, which maps an Enum value to the gate that value alone needs; like Gate, its key is rejected at the two flat call sites, so it is absent from their allow-sets).
    • go-kure/launcher#1330 (ValueGatedPaths, a path that gates values; like Gate, its key is rejected at the two flat call sites).
    • go-kure/launcher#1580 (BoundedBy, the refusal classes an authored value at a property can cause; its key is rejected at the two flat call sites and on a model input. Which facts a model may declare for its inputs is an open point of that issue).
    • go-kure/launcher#408 (ValidateAuthoredProperties is the authored-path counterpart of the emitted-path check, and closes it).
    • go-kure/launcher#1001 (postgresql points a key its backup replaced, objectStore and objectStoreObjectName, to where it went; and names the reason backup.objectStore refuses serverName, azureCredentials and googleCredentials).
    • The hint was asked of a terminal component handler alone before go-kure/launcher#790; the three other positions are new. [The hint is UnsupportedFieldHint.]
    • Before go-kure/launcher#790 a nested refusal carried no hint.
    • go-kure/launcher#1466 (every refusal the property validators make is a *PropertyError).
    • go-kure/launcher#1469 (the platform-reservation check is one of those refusals).
    • go-kure/launcher#325 (the shape check is the only place an authored scalar’s type is enforced for every property).
    • go-kure/launcher#1282 (the app argument is never edited, for a plain type name and for a declared type identity alike).
    • go-kure/launcher#1463 (top-level Required is enforced as written, and a null counts as absent).
    • go-kure/launcher#765 (nested Required, inside an object the author did write, is enforced).
    • go-kure/launcher#750 (for a trait a binding matches, the check reads the trait’s properties as the rendering merges into them, recursively, so a required key the rendering supplies is not refused).
  • Tests:
    • A completeness test (pkg/cmd/kurel) enforces that every built-in schema node declares exactly one of Type and Types.
    • A completeness test (pkg/cmd/kurel) enforces that no built-in schema node is left without a description.
    • TestPropertySchemaFields_FlatSiteDecisions (pkg/oam) and TestLoad_InputSchemaFieldDecisions (pkg/oam/model) read the fields of PropertySchema by reflection and fail for one with no recorded decision: whether a kurel parameter, a capability rendering property and a model input accept its key.
    • The TestBoundedBy tests (pkg/oam/builtin/registry) hold every boundedBy a registered schema publishes to a row that shows the refusal, and every row to a declaration. A declaration with no row, and a row with no declaration, both fail.

What an explicit null means on the emitted path

  • History:
    • go-kure/launcher#394 (aligning the parser-level layer with this contract, a separate, lower-level concern, is not closed by this).
    • go-kure/launcher#431 (capability rendering, checkCapabilityValueType, now agrees with the contract’s own behaviour).
    • go-kure/launcher#430 (the networkpolicy peer parser read a typed nil namespaceSelector differently from an untyped one; both parsers now route their presence check through oam.IsNullValue’s reflect-based classification).
  • Tests:
    • What is asserted is the rule above: TestBuiltinHandlerSchemaEnumMembersHoldNoNull (pkg/cmd/kurel) walks every schema that ships for a member holding a null, because the runtime arm only fires once a document validates against the property carrying the Enum. [The rule is that no Enum member holds a null.]

Contract metadata

  • History:
    • go-kure/launcher#789 (HandlerContractSet gained the Policies field, a breaking library change; every built-in handler and lowering rule implements ContractDescriber).
    • go-kure/launcher#1027 (Prerequisites lists what must be in place in the target cluster, or beside it, for the output to work once applied).
    • go-kure/launcher#1134 (Readiness lists, for each kind of resource an entity of this contract provides, how a reader judges that the resource is ready).
    • go-kure/launcher#1144 (postgresql declares readiness, one entry for each kind it lowers into).
    • go-kure/launcher#1611 (PlatformNeeds lists the capabilities the platform must serve for the output to work, as names; PolicyResult.PlatformNeeds reports those of the components the lowered application emits; a handler may answer per component through the optional ComponentPlatformNeeds; the CloudNativePG family kinds and postgresql declare theirs).

Lowering targets and Seal

  • History:
    • go-kure/launcher#789 (a consumer that registers a built-in lowering rule without the types it lowers into now fails at Seal, a breaking library change).

Lowering keys

  • History:
    • go-kure/launcher#1580 (webservice and worker publish where each key of their schema lands in their members, from the function the rule forwards with: roleKeys in pkg/oam/builtin/components/role_keys.go).
    • go-kure/launcher#1601 (the expose trait rule publishes its map: pkg/oam/builtin/traits/expose_keys.go).
  • Tests:
    • pkg/oam/builtin/registry/lowering_keys_expose_test.go holds the expose map: a built-in trait lowering rule with neither a map nor a row fails; a key with no place under a controllerType reaches no trait of a document that builds; and it checks the member the report names for an expose trait on a webservice, a worker and a worker with an authored serviceAccountName.
    • pkg/oam/builtin/registry/lowering_keys_test.go authors every key of both schemas and reads the result twice. From what the rule emits: the key changes a value at each declared place and at no other, and an unchanged place holds the authored value. From the provenance report, which names sources and holds no value: the entries the key moves sit at the declared places, and every entry of a sibling group names its member. A fill the key causes at the place of another key (a ReadWriteOnce or ReadWriteOncePod claim that is not also ReadWriteMany gives the deployment Recreate at strategy.type) is a row of the key’s sample; one with no row fails, and so does a row whose fill no longer happens. An entry the key removes is read the same way: it sat at a declared place, or on the member the sample says the key removes (an authored serviceAccountName and the generated account). It fails for a key added to a schema with no map entry or no sample, and for a built-in component lowering rule that has neither a map nor a row in its list of rules without one. The destinations of the keys a rule evaluates itself are a table beside the rule; these tests are what holds that table to the rule.
    • pkg/oam/lowering_keys_test.go holds ComponentLoweringKeys(), ComponentPlainOwners() and TraitLoweringKeys() to the declared maps and owners and to returning a copy.
    • pkg/oam/builtin/registry/plain_owner_test.go holds the plain owner (go-kure/launcher#1701): every type with a key map publishes one, and for documents of each type that the rule lowers (helm under both deliveries, oci with and without its own source, postgresql with and without a backup, a webservice and a worker with and without a generated account) the owner live for the document carries the component’s name in the lowered members, and some document has it alone under that name (a webservice has none: its service always shares the name). It is read from the members the rule builds, never from a table, so a rule that gives the name to another member fails it.