MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / k8s_mapping

Function k8s_mapping

internal/cbm/extract_k8s.c:1517–1539  ·  view source on GitHub ↗

A mapping at `path` that holds a reference in its kind/name/namespace.

Source from the content-addressed store, hash-verified

1515
1516// A mapping at `path` that holds a reference in its kind/name/namespace.
1517static 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.
1542static void k8s_walk(k8s_walk_t *w, TSNode node, char *path, size_t len, size_t cap) {

Callers 1

k8s_walkFunction · 0.85

Calls 7

k8s_containerFunction · 0.85
k8s_kind_inFunction · 0.85
k8s_mapping_refFunction · 0.85
k8s_source_isFunction · 0.85
k8s_path_matchFunction · 0.85
k8s_ingress_ruleFunction · 0.85
k8s_httproute_specFunction · 0.85

Tested by

no test coverage detected