Fill Probes
Package probe holds the library’s provenance report to what the library does, as
observed in a fixed set of probe documents. A built-in handler fills values the author
left out, and the report names each one with its source (policy or builtin, see
pkg/oam). The probes run documents through a transformer and compare the report with
the generated objects. They show what these documents trigger. A fill no probe document
triggers is not seen, so a clean run says nothing about it.
A consumer passes its own *oam.Transformer. The probes bring their own policies:
ProbePolicy() (every Default* accessor of oam.Policy set to an arbitrary value) and
NoPolicy(). The arbitrary values never appear in what a consumer publishes.
Surface
| Name | Use |
|---|---|
Probes() | The probe documents, each with the fills observed with and without the policy. |
Probe, Fill | One document, and one fill it shows: path, source in each state, and the value an author can write for it. |
ProbePolicy(), NoPolicy() | The two policy states. |
Run(tr, components, policy) | Validate, transform with provenance, generate: the report and the marshalled objects. |
RunWith(tr, components, policy, caps) | Run with the capability bindings the transform runs with. A probe states its own in Probe.Capabilities. |
CheckDeclaredDefaults | Check A. |
CheckReportedFillsAreReal | Check B. |
CheckProbePolicyCoversEveryDefault | Check E. |
Each check returns findings as strings and never calls testing, so a consumer runs it
from its own test and prints what it returns.
The three checks
- A, declared defaults. For every default a handler schema declares for a property a
probe document leaves out, writing the default gives the same objects as leaving it out
and the report holds an entry at that path. A default the handler leaves to the
cluster is listed in the probe’s
LeftToClusterwith the reason. The check reads schema declarations only: a fill no schema declares, such as the resource requests, is not seen here. - B, reported fills are real. In both policy states the report holds the sources each
probe states, and no entry of source
policyorbuiltinthat the probe does not list. For each fill with an authored value, writing that value gives the same objects and no entry at that path. An entry no probe lists fails with an instruction to add a row or fix the report. - E, the probe policy sets every
Default*accessor. An accessor added tooam.Policyand not to the probe policy is named.
No shipped probe lists LeftToCluster any more: the one case, the cronjob schema’s
concurrencyPolicy default Allow, went when the kind became raw (go-kure/launcher#1629).
The mechanism stays for a handler that declares a default it leaves to the cluster, and
the tests keep it exercised with a probe built for the purpose.
No handler-built workload type is left: the raw deployment, statefulset, daemonset,
job and cronjob (go-kure/launcher#1629) fill nothing, so their probes are raw documents
(a pod template, with a selector and a restart policy where the kind needs one; for
statefulset also one with an init container, a second container and ports, and one with a
claim template) that list no fill. Check B fails on any policy or builtin entry a probe does not
list, so a fill that came back to the kind fails there. It also probes the types that lower to other components: webservice and worker,
whose entries the report names at the place of their role-deployment member (Fill.Member),
and postgresql, which the report names at the cluster it builds. For a type that
publishes a lowering key map check A reads the places of a declared default from it: those
live for the probe’s component, read under the plain owner where the report names the
component with no member. A default that lands in several places needs an entry at each. Provenance records leaves, so a default under a key the rule
builds (affinity) is read as “some entry below that key”: weaker than its own leaf.
For postgresql, check B compares written values for the four resource rows only; the
enablePDB, instances and storage.size rows state sources and no value, because the
authored keys differ (replicas, storageSize), so check B does not show that the library
applies those three fills.
Check A also found declared defaults the report holds no entry for, observed in these
probes. Each is listed in its probe’s Unreported with the reason, and check A fails when
an entry there stops being a gap: topologySpread on webservice and worker (the
document with no policy runs one replica, where the topology-spread trait it switches writes
no constraints and the report holds no entry; the document with the policy runs two and
holds it), and provider and, without a policy default, replicas on postgresql.
The trait probes put one trait on a raw deployment, with the capability bindings the transform
runs with (Probe.Capabilities), and name the fills the report holds under the trait
(Fill.Trait): certificate, external-secret, volsync, scaler, networkpolicy,
ingress, httproute (also the gateway namespace of a platform gateway), pvc,
topology-spread and security-context. A
probe row writes its value at the trait at Fill.TraitIndex, when that trait has the row’s type. Six limits, observed in these
probes:
- Check A reads declared defaults of components and not of traits, so a declared trait default no row names is not seen by it.
- The
issuerRef.kindandgatewayNamespacerows state sources and no value: an author cannot write that path alone, or the platform owns it, so check B does not show that the library applies them. - The computed fills (names, backends, a target secret, the repository of a backup) have rows that state sources only: no value an author writes is the computed one, so check B does not show that the library applies them.
- A fill the report does not hold yet has no row: what the
exposerule fills. Thetopology-spreadrow states a source only: the trait takes no property and fills a field of the Deployment, so no value an author writes is its fill. - The
security-contextprobes coverrestricted(three fills) andbaseline(none). OnlyreadOnlyRootFilesystemhas a value and anOther: the opposite ofrunAsNonRootand ofallowPrivilegeEscalationis refused atrestricted, so their rows state a source only. A workload that authors some of the three, a Windows pod andprivilegedhave no probe; the registry tests read each of them, and compare the generated objects with the report on and off for each. scalerlistsreplicasinNotAuthorable: the trait owns the replica count and the document refuses an authored one with the stated text, so check A cannot compare objects for it.