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

Function k8s_deploy_leaf

internal/cbm/extract_k8s.c:1093–1132  ·  view source on GitHub ↗

A Flux Kustomization / Argo Application deploys a repository directory.

Source from the content-addressed store, hash-verified

1091
1092// A Flux Kustomization / Argo Application deploys a repository directory.
1093static void k8s_deploy_leaf(k8s_walk_t *w, const char *path, const char *value) {
1094 bool flux = k8s_source_is(w, K8S_FLUX_KS, "|Kustomization|");
1095 bool argo = k8s_source_is(w, K8S_ARGO, "|Application|");
1096 if ((flux && strcmp(path, "spec.targetNamespace") == 0) ||
1097 (argo && strcmp(path, "spec.destination.namespace") == 0)) {
1098 w->deploy_ns = strstr(value, "{{") ? NULL : value;
1099 return;
1100 }
1101 if (k8s_source_is(w, K8S_FLUX_HELM, "|HelmRelease|")) {
1102 if (strcmp(path, "spec.chart.spec.chart") == 0 && !strstr(value, "{{")) {
1103 w->hr_chart = value;
1104 } else if (strcmp(path, "spec.chart.spec.sourceRef.kind") == 0) {
1105 w->hr_source = value;
1106 }
1107 return;
1108 }
1109 /* the chart an OCIRepository fetches (a HelmRelease's chartRef) */
1110 if (k8s_source_is(w, K8S_FLUX_SRC, "|OCIRepository|") && strcmp(path, "spec.url") == 0) {
1111 if (!strstr(value, "{{") && !strstr(value, "${")) {
1112 CBMK8sFact f = {.fact = CBM_K8S_FACT_SOURCE,
1113 .def_index = w->def_index,
1114 .name = cbm_arena_strdup(w->ctx->arena, value),
1115 .via = "ocirepository"};
1116 cbm_k8sfact_push(&w->ctx->result->k8s_facts, w->ctx->arena, f);
1117 }
1118 return;
1119 }
1120 if ((flux && strcmp(path, "spec.path") == 0) ||
1121 (argo &&
1122 (strcmp(path, "spec.source.path") == 0 || strcmp(path, "spec.sources[].path") == 0))) {
1123 if (strstr(value, "{{")) {
1124 return;
1125 }
1126 CBMK8sFact f = {.fact = CBM_K8S_FACT_DEPLOY,
1127 .def_index = w->def_index,
1128 .name = cbm_arena_strdup(w->ctx->arena, value),
1129 .via = flux ? "flux" : "argo"};
1130 cbm_k8sfact_push(&w->ctx->result->k8s_facts, w->ctx->arena, f);
1131 }
1132}
1133
1134static void k8s_emit_ref(k8s_walk_t *w, const char *kind, const char *ns, const char *name,
1135 const char *via, const char *edge) {

Callers 1

k8s_leafFunction · 0.85

Calls 3

k8s_source_isFunction · 0.85
cbm_k8sfact_pushFunction · 0.85
cbm_arena_strdupFunction · 0.70

Tested by

no test coverage detected