@intentius/chant-lexicon-k8s 0.124.45 → 0.124.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  * Only components a pipeline runs count, since the collector starts no
8
8
  * other. A config that reads nothing from the node gets nothing, so its
9
9
  * DaemonSet is unchanged. Each requirement cites the component's README at
10
- * collector-contrib v0.130.0, the version the otel lexicon pins:
10
+ * collector-contrib v0.130.0:
11
11
  *
12
12
  * - The node's name, from the downward API (`spec.nodeName`), in each
13
13
  * variable a `k8sattributes` processor names in `filter.node_from_env_var`
@@ -7,7 +7,7 @@
7
7
  * Only components a pipeline runs count, since the collector starts no
8
8
  * other. A config that reads nothing from the node gets nothing, so its
9
9
  * DaemonSet is unchanged. Each requirement cites the component's README at
10
- * collector-contrib v0.130.0, the version the otel lexicon pins:
10
+ * collector-contrib v0.130.0:
11
11
  *
12
12
  * - The node's name, from the downward API (`spec.nodeName`), in each
13
13
  * variable a `k8sattributes` processor names in `filter.node_from_env_var`
@@ -5,8 +5,7 @@
5
5
  * `agentClusterRules` is the ClusterRole `OtelCollector` and
6
6
  * `GkeOtelCollector` share: what the `k8sattributes` processor needs, plus
7
7
  * what the config's Kubernetes receivers need. Each rule cites the
8
- * component's RBAC requirements at collector-contrib v0.130.0, the version the
9
- * otel lexicon pins.
8
+ * component's RBAC requirements as read at collector-contrib v0.130.0.
10
9
  *
11
10
  * `namespacedRoles` builds one Role and RoleBinding per namespace, for access
12
11
  * a collector needs in namespaces other than its own: Endpoints for a
@@ -1 +1 @@
1
- {"version":3,"file":"otel-collector-rbac.d.ts","sourceRoot":"","sources":["../../src/composites/otel-collector-rbac.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAA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AAW,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAWD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,mBAAmB,EAAE,CA+BhF;AAUD,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,oGAAoG;IACpG,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,kDAAkD;IAClD,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,yDAAyD;IACzD,YAAY,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACtC,mBAAmB,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,CAqB1I"}
@@ -5,8 +5,7 @@
5
5
  * `agentClusterRules` is the ClusterRole `OtelCollector` and
6
6
  * `GkeOtelCollector` share: what the `k8sattributes` processor needs, plus
7
7
  * what the config's Kubernetes receivers need. Each rule cites the
8
- * component's RBAC requirements at collector-contrib v0.130.0, the version the
9
- * otel lexicon pins.
8
+ * component's RBAC requirements as read at collector-contrib v0.130.0.
10
9
  *
11
10
  * `namespacedRoles` builds one Role and RoleBinding per namespace, for access
12
11
  * a collector needs in namespaces other than its own: Endpoints for a
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "27d7ed31eb69e27601a4aad734ed7bad3c3983715bd08720b7081408339d9e3e",
4
+ "manifest.json": "cbbb15925fb68d43b5ebb8cae59a944b482697fdd1bd749c69a6c0aaa8303635",
5
5
  "meta.json": "c1831ac15083f5e0e45b29698d7b77f1c01646240fe6de5d6320753188594f69",
6
6
  "types/index.d.ts": "5c5340046d090ae9db5553039d923cf92a8b2eb57aa4dc941273ed5bcfb5bc9d",
7
7
  "rules/argo-appset-single-project.ts": "afa9f310753aa2d475f35012b13135b2dfaebed2a35d44edbe185ebc07673674",
@@ -59,7 +59,7 @@
59
59
  "rules/wk8505.ts": "b866168e8c8ed55edb5d69666258cdb6c4a2e2db3e41951a59fe54fd7d5bda5b",
60
60
  "rules/wk8601.ts": "d086334847a083f2c90cbf0232a34af9df2b794d69f8b136227de34b04ca0147",
61
61
  "rules/wk8602.ts": "631bf3eec929ca61c2e8757db9ea5f7757b957db3314ca6f16a10d4d780f4375",
62
- "rules/wk8603.ts": "483c6deb66f542f7d685b8e2ed4f646956c7585860fc52216641a3fc398c4137",
62
+ "rules/wk8603.ts": "0cccd9793a905e85132a8e9ce428623af9aa095ecabc43b1b6c6a7c90603dbd4",
63
63
  "rules/wk8604.ts": "2b15c1c9e06cda0074c17787740c0ee07f49642035bb04a8015284f5e4d4f067",
64
64
  "rules/wk8605.ts": "c60fad041e1253c398afa6ade2593799be96677af27eed0260f701885a67564a",
65
65
  "rules/wk8606.ts": "ff637cfc91d0fb0e988993044dce2fdd019482a5e3a29ecba9459249550b13fa",
@@ -78,5 +78,5 @@
78
78
  "skills/chant-k8s-argo.md": "24c9a85b78a2fc5c6657424baac9cc6d6caff6f47605b8146b2c0082133181cf",
79
79
  "skills/chant-k8s-flux.md": "9670efc2e9854bd14686b5adeb707396b9030a4dcaee6529b30abf56efe2c50c"
80
80
  },
81
- "composite": "2c3a2bef3ff073572d059dbcbb45ba376ae8f63f629bdb3007daf6c03b357c88"
81
+ "composite": "b401b5929a79ab5f3705a92f3fb377496aba09206878fab0a8ddcbfba3a9cf33"
82
82
  }
@@ -9,7 +9,7 @@
9
9
  * duplicated series and N watches against the API server. Run it in a
10
10
  * single-replica Deployment, or set the receiver's `k8s_leader_elector` to a
11
11
  * `k8s_leader_elector` extension enabled in `service.extensions` (both ship in
12
- * otelcol-contrib and otelcol-k8s at the pinned v0.130.0), so only the
12
+ * otelcol-contrib and otelcol-k8s at the pinned v0.162.0), so only the
13
13
  * leader collects.
14
14
  *
15
15
  * One build root at a time (chant #1939).
@@ -9,7 +9,7 @@
9
9
  * duplicated series and N watches against the API server. Run it in a
10
10
  * single-replica Deployment, or set the receiver's `k8s_leader_elector` to a
11
11
  * `k8s_leader_elector` extension enabled in `service.extensions` (both ship in
12
- * otelcol-contrib and otelcol-k8s at the pinned v0.130.0), so only the
12
+ * otelcol-contrib and otelcol-k8s at the pinned v0.162.0), so only the
13
13
  * leader collects.
14
14
  *
15
15
  * One build root at a time (chant #1939).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k8s",
3
- "version": "0.124.45",
3
+ "version": "0.124.48",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "K8s",
6
6
  "intrinsics": [],
@@ -9,7 +9,7 @@
9
9
  * duplicated series and N watches against the API server. Run it in a
10
10
  * single-replica Deployment, or set the receiver's `k8s_leader_elector` to a
11
11
  * `k8s_leader_elector` extension enabled in `service.extensions` (both ship in
12
- * otelcol-contrib and otelcol-k8s at the pinned v0.130.0), so only the
12
+ * otelcol-contrib and otelcol-k8s at the pinned v0.162.0), so only the
13
13
  * leader collects.
14
14
  *
15
15
  * One build root at a time (chant #1939).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-k8s",
3
- "version": "0.124.45",
3
+ "version": "0.124.48",
4
4
  "description": "Kubernetes lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -72,13 +72,13 @@
72
72
  "build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && cp src/generated/index.d.ts dist/generated/index.d.d.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@intentius/chant-lexicon-otel": "^0.124.45",
76
- "@intentius/chant-lexicon-prometheus": "^0.124.45",
75
+ "@intentius/chant-lexicon-otel": "^0.124.48",
76
+ "@intentius/chant-lexicon-prometheus": "^0.124.48",
77
77
  "js-yaml": "^4.3.1",
78
78
  "@types/js-yaml": "^4.0.9"
79
79
  },
80
80
  "optionalDependencies": {
81
- "@intentius/chant-k8s-client": "^0.124.45"
81
+ "@intentius/chant-k8s-client": "^0.124.48"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@intentius/chant": "*",
@@ -86,6 +86,6 @@
86
86
  },
87
87
  "peerDependencies": {
88
88
  "zod": "^4.3.6",
89
- "@intentius/chant": "^0.124.45"
89
+ "@intentius/chant": "^0.124.48"
90
90
  }
91
91
  }
@@ -7,7 +7,7 @@
7
7
  * Only components a pipeline runs count, since the collector starts no
8
8
  * other. A config that reads nothing from the node gets nothing, so its
9
9
  * DaemonSet is unchanged. Each requirement cites the component's README at
10
- * collector-contrib v0.130.0, the version the otel lexicon pins:
10
+ * collector-contrib v0.130.0:
11
11
  *
12
12
  * - The node's name, from the downward API (`spec.nodeName`), in each
13
13
  * variable a `k8sattributes` processor names in `filter.node_from_env_var`
@@ -5,8 +5,7 @@
5
5
  * `agentClusterRules` is the ClusterRole `OtelCollector` and
6
6
  * `GkeOtelCollector` share: what the `k8sattributes` processor needs, plus
7
7
  * what the config's Kubernetes receivers need. Each rule cites the
8
- * component's RBAC requirements at collector-contrib v0.130.0, the version the
9
- * otel lexicon pins.
8
+ * component's RBAC requirements as read at collector-contrib v0.130.0.
10
9
  *
11
10
  * `namespacedRoles` builds one Role and RoleBinding per namespace, for access
12
11
  * a collector needs in namespaces other than its own: Endpoints for a
@@ -0,0 +1,101 @@
1
+ /**
2
+ * `chant search` over a `k8s.kustomize.roots` project (chant #4365): the
3
+ * rendered objects are build-root entities, so search must merge them the way
4
+ * `chant graph` does, and give them the ids `chant graph --format ir` prints.
5
+ *
6
+ * The render goes through the real hook's helper with a canned runner, the
7
+ * same output `root.test.ts` pins, so the test needs neither kustomize nor
8
+ * kubectl.
9
+ */
10
+ import { afterAll, beforeAll, describe, expect, test, vi } from "vitest";
11
+ import { fileURLToPath } from "node:url";
12
+ import { dirname, join } from "node:path";
13
+ import { cp, mkdtemp, rm, writeFile } from "node:fs/promises";
14
+ import { tmpdir } from "node:os";
15
+ import type { GraphIR } from "@intentius/chant/graph-ir";
16
+ import type { LexiconPlugin } from "@intentius/chant/lexicon";
17
+ import { runGraph } from "@intentius/chant/cli/handlers/graph";
18
+ import { runSearch, type SearchJson } from "@intentius/chant/cli/handlers/search";
19
+ import { renderKustomizeRoots } from "./root";
20
+ import { k8sPlugin } from "../plugin";
21
+
22
+ const fixtureRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "testdata", "kustomize-root");
23
+
24
+ const RENDERED = `apiVersion: v1
25
+ kind: Service
26
+ metadata:
27
+ name: prod-web
28
+ spec:
29
+ ports:
30
+ - port: 80
31
+ selector:
32
+ app: web
33
+ ---
34
+ apiVersion: apps/v1
35
+ kind: Deployment
36
+ metadata:
37
+ name: prod-web
38
+ spec:
39
+ replicas: 3
40
+ selector:
41
+ matchLabels:
42
+ app: web
43
+ `;
44
+
45
+ /** The k8s plugin, with its kustomize render swapped for the canned output. */
46
+ const plugin: LexiconPlugin = {
47
+ ...k8sPlugin,
48
+ buildRoots: async (ctx) => {
49
+ const roots = (ctx.config as { k8s?: { kustomize?: { roots?: string[] } } }).k8s?.kustomize?.roots ?? [];
50
+ return renderKustomizeRoots({ projectRoot: ctx.projectRoot, roots, run: async () => ({ stdout: RENDERED }) });
51
+ },
52
+ };
53
+
54
+ let project: string;
55
+
56
+ async function inProject(run: () => Promise<number>): Promise<{ exit: number; out: string[]; err: string[] }> {
57
+ const out: string[] = [];
58
+ const err: string[] = [];
59
+ vi.spyOn(console, "log").mockImplementation((line: unknown) => void out.push(String(line)));
60
+ vi.spyOn(console, "error").mockImplementation((line: unknown) => void err.push(String(line)));
61
+ const cwd = process.cwd();
62
+ process.chdir(project);
63
+ try {
64
+ return { exit: await run(), out, err };
65
+ } finally {
66
+ process.chdir(cwd);
67
+ vi.restoreAllMocks();
68
+ }
69
+ }
70
+
71
+ beforeAll(async () => {
72
+ project = await mkdtemp(join(tmpdir(), "chant-kustomize-search-"));
73
+ await cp(fixtureRoot, project, { recursive: true });
74
+ await writeFile(
75
+ join(project, "chant.config.json"),
76
+ JSON.stringify({ lexicons: ["k8s"], k8s: { kustomize: { roots: ["overlays/prod"] } } }),
77
+ );
78
+ });
79
+
80
+ afterAll(async () => {
81
+ await rm(project, { recursive: true, force: true });
82
+ });
83
+
84
+ describe("search over a k8s.kustomize.roots project (#4365)", () => {
85
+ test("a kind query returns the rendered objects under graph --format ir's ids", async () => {
86
+ const graphRun = await inProject(() =>
87
+ runGraph({ args: { command: "graph", path: ".", format: "ir" } as never, plugins: [plugin], serializers: [] }),
88
+ );
89
+ expect(graphRun.exit, graphRun.err.join("\n")).toBe(0);
90
+ const graph = JSON.parse(graphRun.out.join("\n")) as GraphIR;
91
+ const drawn = graph.nodes.filter((n) => n.kind?.startsWith("K8s::")).map((n) => n.id).sort();
92
+ expect(drawn).toEqual(["overlays/prod/deploymentProdWeb", "overlays/prod/serviceProdWeb"]);
93
+
94
+ const searchRun = await inProject(() =>
95
+ runSearch({ args: { path: "kind:K8s::", json: true } as never, plugins: [plugin], serializers: [] }),
96
+ );
97
+ expect(searchRun.exit, searchRun.err.join("\n")).toBe(0);
98
+ const json = JSON.parse(searchRun.out.join("\n")) as SearchJson;
99
+ expect(json.matches.map((m) => m.id).sort()).toEqual(drawn);
100
+ });
101
+ });
@@ -9,7 +9,7 @@
9
9
  * duplicated series and N watches against the API server. Run it in a
10
10
  * single-replica Deployment, or set the receiver's `k8s_leader_elector` to a
11
11
  * `k8s_leader_elector` extension enabled in `service.extensions` (both ship in
12
- * otelcol-contrib and otelcol-k8s at the pinned v0.130.0), so only the
12
+ * otelcol-contrib and otelcol-k8s at the pinned v0.162.0), so only the
13
13
  * leader collects.
14
14
  *
15
15
  * One build root at a time (chant #1939).