pub fn kube_bool<R: KubeReceiver + ?Sized>(
recv: &R,
field: &str,
) -> Option<bool>Expand description
Read a sub-<field> YAML scalar-boolean nested one hop under an
arbitrary &serde_yaml::Value mapping receiver as Option<bool>
— the value-level two-hop navigation primitive that folds
.get(<field>) → as_bool into a single helper call. Boolean-arity
peer of the value-level scalar-str kube_str (a23f61d), scalar-
integer kube_u64 (bfbec1d), sequence-arity kube_seq
(9c74ddb), and sub-mapping-arity kube_map (28fa5d8) accessors
on the same value-level two-hop navigation axis: where those four
close the string / unsigned-integer / sequence / sub-mapping
shape-gates on the nested <field> axis, this accessor closes the
boolean-arity shape-gate on the same axis, so every routed test-
side + production per-nested-mapping boolean-typed readback (per-
HelmRelease spec.install.createNamespace first-apply namespace-
seeder toggle, per-HelmRelease spec.upgrade.remediation .remediateLastFailure post-retry-exhaustion rollback toggle, the
forthcoming per-Kustomization spec.prune sweep-what-you-removed
garbage-collection toggle once its outer-arity peer lands, per-
HelmRelease spec.values.<library>.enabled composition-time
child-chart force-on toggle once the &Mapping-receiver peer
lands) now reaches through the same one-line dispatch the scalar-
str, scalar-integer, sequence, and sub-mapping arities already do.
The quintet (kube_str, kube_u64, kube_bool, kube_seq,
kube_map) closes the value-level axis at the five principal K8s
apiserver OpenAPI schema shape arities — string, unsigned-
integer, boolean, sequence, sub-mapping — spanning the JSON
scalar-and-container surface every routed value-level
get → as_* two-hop navigation walks through.
Returns None on any of the three short-circuit arms folded through
the underlying two-hop composition: the receiver value carries a
YAML type without a get(<field>) navigation surface
(serde_yaml::Value::get returns None on scalar arms — string,
bool, number, null — that expose no per-key lookup), the requested
<field> axis-key is absent from the receiver’s mapping
(serde_yaml::Value::get trailing miss), or the sub-field value
is present but carries a non-boolean YAML type (the trailing
serde_yaml::Value::as_bool shape-gate short-circuit — a
schema-invalid scalar type per the K8s apiserver’s OpenAPI schema
but tolerated here as None so the readback stays a total
function, mirroring the sibling kube_str / kube_u64 /
kube_seq / kube_map posture). The returned bool is a
fresh primitive value (booleans carry no underlying borrow the way
the sibling string-arity accessor preserves) — the caller decides
whether to assert_eq!(_, Some(<expected>)) for a determinism pin,
.expect(...) for a load-bearing toggle identity, or
.unwrap_or(<default>) for a substrate-side default fallback.
The canonical shape ~2 test-side per-nested-mapping scalar-bool
readback sites in caixa-flux previously carried inline as
the two-line composition
<value>.get(<FIELD>).and_then(|v| v.as_bool())
...around a one-token semantic payload (the <FIELD> sub-field
axis-key — FLUX_HELMRELEASE_KEY_CREATE_NAMESPACE on the per-
HelmRelease install-path first-apply namespace-seeder toggle,
FLUX_HELMRELEASE_KEY_REMEDIATE_LAST_FAILURE on the per-
HelmRelease upgrade-path post-retry-exhaustion rollback toggle).
After this lift every routed &Value-receiver consumer folds the
two-line navigation onto kube_bool(<value>, <FIELD>) — the two-
hop get → as_bool walk happens once inside the helper, and the
caller keeps its downstream assertion posture (assert_eq!(_, Some(<expected>)), .expect(...), an if let Some(b) = _ bind)
unchanged — the lift closes the navigation surface, not the per-
site downstream posture.
The two remaining per-nested-boolean readback sites in
caixa-flux stay out-of-reach at this arity by design: the
per-Kustomization spec.prune readback ((spec.<field>-anchored,
resolves via kube_spec_field + trailing .as_bool() — a
separate kube_spec_bool_field lift, one altitude above on the
spec-anchored family) and the per-HelmRelease spec.values .<library>.enabled readback (receiver is a &Mapping returned
from kube_spec_map_field, not a &Value — a peer Mapping-
receiver overload would land on a separate lift, mirroring the
same-arity carveout the sibling kube_map docs already name).
Both are noted here so the future extension trajectory stays
discoverable from this accessor’s docstring.
Every future nested <field> scalar-bool readback the M3.x + M4
renderer set materializes (the future :politicas :mtls-required
tristate-arm scalar the mesh-policy overlay lifts alongside the
existing CILIUM_KEY_MODE discriminator, the future per-
Aplicacao spec.entrada.tls per-gateway TLS-toggle scalar the
GATEWAY_API_KEY_HOSTNAME axis pairs with once TLS lands at
MESH-COMPOSITION §III.4, the future per-:limits :sandboxed
per-Servico sandbox-mode toggle the Lunatic per-process sandbox
admits at CAIXA-SDLC §II.3, per-:contratos per-edge idempotent-
retries toggle the M4 typed per-edge overlay lifts) reaches this
one helper by construction. No per-consumer two-hop re-inline; no
coordinated rewrite across every nested-scalar-bool readback on
a future serde_yaml surface rebrand or shape-gate shift.