pub fn find_by_api_version<'a>(
docs: &'a [Value],
api_version: &str,
) -> Option<&'a Value>Expand description
Locate the first K8s CR YAML document in docs whose top-level
apiVersion: CRD-group/version axis equals api_version.
Composes on top of kube_api_version_is — same one-hop
.get(KUBE_KEY_API_VERSION).and_then(as_str) == Some(api_version)
predicate — and closes the “find the first document of a given
CRD-group/version inside a multi-doc mesh emission” navigator
axis every future per-CRD-group / per-CRD-version fan-out slicer
reaches for to split the emitted sequence by per-CR CRD-group/
version-registration before probing a per-CR body-axis.
Composition-symmetric to kube_api_version_is: the lifted
predicate answers “does this one document match CRD-group/
version <GV>?”, the lifted navigator answers “find the first
document of CRD-group/version <GV> in this list?”. Same
axis, different arity — the two call shapes emit-side /
operator-side harnesses reach for when splitting multi-doc CR
emissions by per-CR CRD-group/version-registration. Peer of
find_by_kind (b73a13e) on the sibling kind: half of the
same canonical (apiVersion, kind) coordinate pair:
find_by_kind navigates by CR shape coordinate (there is
exactly one document per unique kind: inside a per-Aplicacao
mesh emission at V0); find_by_api_version navigates by CR
CRD-group/version-registration coordinate (there may be many
CRs sharing an apiVersion: — the “first match” contract
deliberately returns the first-emitted, matching the sibling
navigator’s first-match contract on the identity + namespace-
scoping axes find_by_name / find_by_namespace).
This closes the three-arity closure on the top-level
apiVersion: per-CR CRD-group/version axis — accessor
kube_api_version (cf97d0a), predicate
kube_api_version_is, navigator find_by_api_version —
bringing it to structural parity with the three-arity closure on
the sibling top-level kind: half (accessor kube_kind
89a49a4, predicate kube_kind_is 2902d9d, navigator
find_by_kind b73a13e) + the two sub-metadata.* coordinates
(accessor kube_name c9cdecb, predicate kube_name_is
092965d, navigator find_by_name 092965d; accessor
kube_namespace e18297b, predicate kube_namespace_is
9f4a600, navigator find_by_namespace 9f4a600). Together the
four three-arity closures bracket every accessor arity on the
canonical per-CR-registration + per-CR-identity/scoping
coordinates the K8s API-machinery pins as the four load-bearing
axes every namespaced CustomResource carries.
Every future per-CRD-group/version multi-doc-navigator site (the
future app-operator’s per-Aplicacao
mesh.pleme.io/v1alpha1/Aplicacao CR CRD-group/version join
over emitted status docs, MESH-COMPOSITION §III.2 #5; the M4
cross-cluster fan-out’s per-cluster Flux-triplet split by
apiVersion: across the .toolkit.fluxcd.io root, §III.2 #3;
the future per-:politicas CiliumClusterwideEnvoyConfig
per-CRD-group/version audit surface that locates the first
emitted L7 policy inside a given CRD-group/version slice)
reaches this same helper by construction, with no inline
.iter().find(closure) combinator chain and no drift surface on
the receiver-widen or combinator axes.