Transform, extension and lowering
Implementation, history and tests of the sections on the reference page Transform, extension and lowering.
Transform & extension
- History:
- go-kure/launcher#734 (a
TraitHandler.Applymust not replace, remove or rename a component’s application, its own or any other component’s of the bundle, including one whose traits already ran: the transform fails, naming the trait and the component, because NetworkPolicy synthesis finds a component’s application by its name and then its pointer, and a replaced, removed or renamed one would silently get no policy). - go-kure/launcher#752 (nor may a
TraitHandler.Applyrename a sibling group member’s application: the member would generate its objects under a name the group does not carry, so the transform fails, naming the trait, the group and the member’s type). - go-kure/launcher#751 (each value
ComponentCapabilityDefaultsfills is validated against the component’s ownPropertySchema, which must declare every listed key: the trait side’s schema may differ). - go-kure/launcher#772 (a
ComponentCapabilityDefaultshandler that declares no schema relies onEvaluateProfile, which validates the binding only through the trait handler or trait lowering rule of the key’s type. Its fill is refused unless that handler or rule validates the rendering: it implementsValidateAndApplyDefaults, or the type is not built in and has aCapabilityDefinition, whose schemaEvaluateProfileapplies). - go-kure/launcher#742 (
persistentvolumeclaimimplementsComponentCapabilityDefaultsforpvc,storageClassName; every bound key aComponentCapabilityDefaultshandler takes defaults from is inConsumedCapabilities). - go-kure/launcher#761 (
statefulsetimplementsComponentCapabilityFiller: it fillspvc’sstorageClassNameinto eachvolumeClaimTemplatesentry that leaves it unauthored (the entry’sstorageClassuntil go-kure/launcher#1629, itsspec.storageClassNamesince); aComponentCapabilityFillerreads a binding only throughlctx.Capability, which records the key inConsumedCapabilities). - go-kure/launcher#686 (every key a component, trait, document or policy lowering rule reads through
LoweringContext.Capabilityis inConsumedCapabilities). - go-kure/launcher#792 (
helmtemplateimplementsApplicationNameSetter, whose hook-group child layouts are named<application>-<component>-NN-<phase-slug>). - go-kure/launcher#787 (
helmtemplateimplementsHookGroupNamePrefixSetterthroughHelmTemplateConfig.HookGroupNamePrefix, andLayoutKustomizationNameSetterthroughHelmTemplateConfig.LayoutKustomizationName, whichAugmentLayoutsets on the layout unless it carries one). - go-kure/launcher#763 (when a
SubApplicationDecorator’sApplyruns on a sub-application, it must not add, remove, replace, rename or reorder the bundle’s applications there (the transform fails), nor rename a sibling group member’s application, which the bundle does not hold: the transform fails, naming the trait, the sub-application it was decorating, the group and the member’s type). - go-kure/launcher#782 (
prune-protectionandforce-replaceimplementSubApplicationDecorator, whoseApplysets the application’s delivery intent and wraps nothing). - go-kure/launcher#702 (no pod kind generates a ServiceAccount, so
ServiceAccountNamereturns""when none is authored; awebservice/workerhands itsdeploymentmember [now therole-deploymentmember] the name of the account it generates). - go-kure/launcher#781 (no built-in handler writes
PolicyResult.Extensions). - go-kure/launcher#1317 (a named
int32orint64is the same value as theintan integer schema gives it and as theint32orint64a number schema keeps, in either width and at any depth in a list or object: a rule that hands a namedint32on as anint64, or the reverse, reportscopiedunder either schema). - go-kure/launcher#1308 (a plain
int,int32orint64is left as it is, so a rule that changes the number, or its kind (an integer to a float), still reportsrendered, and so does a change of width between plain integers, which keep their width). - go-kure/launcher#1323 (Provenance assumes a 64-bit
int: on a 32-bit build a namedint64outside the range ofintis not folded and reportsrendered; launcher builds for amd64 and arm64 only).
- go-kure/launcher#734 (a
Lowering
- History:
- go-kure/launcher#626 (a component or policy is checked on its own copy of its properties in
LowerRaws, so checking it cannot strip a reservednullfrom a trait or another element that shares its map beforeTransformsees it). - go-kure/launcher#357 (
LowerRawsschema-checked emitted traits itself; it does not any more, so a caller that relied on that adds theValidateAuthoredPropertiescall). - go-kure/launcher#1338 (both checks return the refusal as a
*oam.GeneratedObjectCollisionError, with the text unchanged; for that errorerrors.Is(err, oam.ErrGeneratedObjectCollision)is true, also behind a prefix a caller adds, anderrors.Asfinds the error and tells which objects collide and who produces each, without parsing the text). - go-kure/launcher#646 (a component and another component’s trait, two components, or two traits can each generate the same object, and both pass
Transform). - go-kure/launcher#757 (one component’s own traits, or a trait and an application the component generates itself, rendering one object; two traits of one component whose sub-applications share a name read as
2 sub-applications "dup" of component "web", a trait named after its own component and that component as2 applications "web" of component "web"). - go-kure/launcher#787 (the transform itself refuses both of those shapes within one bundle (two applications of one name), so the check meets them only in a cluster built some other way; a name the
Naminghook gave that meets, on another member, one it did not give is refused by name). - go-kure/launcher#1072 and go-kure/launcher#1074 (both checks also hold an object a controller generates for a generated object as generated: for a HelmRelease with a chart template (
spec.chart), helm-controller generates a source of the template’s kind named<namespace>-<name>after the HelmRelease, and the HelmChart claim is a refusal that a document that built before the claim existed may now meet: ahelmchartcomponent named<namespace>-<name>after ahelmreleasebeside it, in the same namespace). - go-kure/launcher#1080 (
GeneratedChartSource(obj)returns that source, and thehelmreleasecomponent reads its claim from it, and refuses a HelmRelease whose source helm-controller could not apply). - go-kure/launcher#720 (a PersistentVolume or PersistentVolumeClaim that is force-applied, or covered by the
ForceReplacedelivery intent, is warned about, not refused: when an update changes an immutable field of a force-applied object, Flux deletes and recreates it instead of failing the apply, which can lose a claim’s data). - go-kure/launcher#782 (an application is forced when it carries the
ForceReplacedelivery intent, which theforce-replacetrait sets). - go-kure/launcher#781 (an application is forced when its bundle sets
Force; launcher never does, so only a bundle whoseForcethe caller set before generating). - go-kure/launcher#702 (a
webservice/workervolumesentry that generates a claim, which one withclaimNamedoes not, is a synthesizedpvctrait, so the claim is named as a sub-application of its component). - go-kure/launcher#702 (
webservicelowers to a deployment, a service and a serviceaccount member, which give Deployment, Service, ServiceAccount, then the claims of the deployment member’s synthesizedpvctraits [the deployment member is of typerole-deploymentsince go-kure/launcher#1629]). - go-kure/launcher#794 (a config’s
PodTemplateLabels() map[string]string: a member without it counts as running no pods; of the built-in pod kinds onlydeploymenthad it, the one pod kind a lowering rule emits into a group [since go-kure/launcher#1629 that is therole-deploymentmember; the rawdeploymenthas none]). - go-kure/launcher#755 (sub-applications are compared after each one’s
ApplyPolicyhas run, so a policy that renames a sub-application onto another member’s is refused, and the name it moved away from is free). - go-kure/launcher#612 (a value a rule copied into a reserved key from a trait, a policy, metadata or another component, or changed after recording it, is refused like any authored one, including a number that only prints the same, such as an authored
1.0000000000000001e+18over a rendered1000000000000000100, or one that only compares equal, such as an authored-0.0over a rendered0.0, which a handler tells apart withmath.Signbit). - go-kure/launcher#609 and go-kure/launcher#626 (for the output of a rule whose input was not checked, which stays authored, the components and traits it emits at trait position and those nested in the components it emits are checked for reserved keys as they are emitted, before emission validation strips an explicit
null, so a reserved key written asnullis refused as when authored directly). - go-kure/launcher#849 (a step attached with
Component.AfterPolicythat holds the config to the policy refuses asApplyPolicydoes: an error that holds aPolicyRefusalfails the transform as the component’sViolationErrorwith the refusal’s class, any other error as aTransformError). - go-kure/launcher#281 and go-kure/launcher#729 (the
postgresqlrule attaches a step to thecnpg-clusterit emits,CnpgClusterConfig.ApplyPostgresqlDefaults, to set the values postgresql derives after the policy). - go-kure/launcher#783 (a rule that emits components of which one must be applied before another declares it on the later one with
Component.OrderAfter(names...)). - go-kure/launcher#784 (the
helmrule orders the release after the source it generates or adopts, and theocirule does the same for each Kustomization of a source severalocicomponents share; theSourceDeduplicatableinterface and the pass that let the first config of a shared source key emit it were removed). - go-kure/launcher#1041 (a component a rule emits that must not wait for the component it lowers, but must still wait for what that one waits for, declares it with
Component.WaitsAs(name)).
- go-kure/launcher#626 (a component or policy is checked on its own copy of its properties in