A mapping at `path` that holds a reference in its kind/name/namespace.
| 1515 | |
| 1516 | // A mapping at `path` that holds a reference in its kind/name/namespace. |
| 1517 | static void k8s_mapping(k8s_walk_t *w, const char *path, TSNode mapping) { |
| 1518 | k8s_container(w, path, mapping); |
| 1519 | for (size_t i = 0; i < sizeof(k8s_mapping_refs) / sizeof(k8s_mapping_refs[0]); i++) { |
| 1520 | const k8s_mapping_ref_t *r = &k8s_mapping_refs[i]; |
| 1521 | if (k8s_kind_in(r->kinds, w->kind) && strcmp(path, r->path) == 0) { |
| 1522 | k8s_mapping_ref(w, mapping, r->kind, r->allowed, r->dflt, r->via, r->edge); |
| 1523 | } |
| 1524 | } |
| 1525 | for (size_t i = 0; i < sizeof(k8s_crd_mapping_refs) / sizeof(k8s_crd_mapping_refs[0]); i++) { |
| 1526 | const k8s_crd_mapping_ref_t *r = &k8s_crd_mapping_refs[i]; |
| 1527 | if (k8s_source_is(w, r->groups, r->kinds) && k8s_path_match(r->path, path)) { |
| 1528 | k8s_mapping_ref(w, mapping, r->kind, r->allowed, r->dflt, r->via, r->edge); |
| 1529 | } |
| 1530 | } |
| 1531 | if (k8s_source_is(w, "|networking.k8s.io|extensions|", "|Ingress|") && |
| 1532 | strcmp(path, "spec.rules[]") == 0) { |
| 1533 | k8s_ingress_rule(w, mapping); |
| 1534 | } |
| 1535 | if (k8s_source_is(w, "|gateway.networking.k8s.io|", "|HTTPRoute|") && |
| 1536 | strcmp(path, "spec") == 0) { |
| 1537 | k8s_httproute_spec(w, mapping); |
| 1538 | } |
| 1539 | } |
| 1540 | |
| 1541 | // Walk `node` (reached at `path`) for references. |
| 1542 | static void k8s_walk(k8s_walk_t *w, TSNode node, char *path, size_t len, size_t cap) { |
no test coverage detected