@intentius/chant-lexicon-k8s 0.46.0 → 0.50.0
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.
- package/dist/components/kubectl-apply.d.ts +5 -0
- package/dist/components/kubectl-apply.d.ts.map +1 -1
- package/dist/composites/flux-app.d.ts +12 -0
- package/dist/composites/flux-app.d.ts.map +1 -1
- package/dist/composites/index.d.ts +8 -0
- package/dist/composites/index.d.ts.map +1 -1
- package/dist/composites/inference-service.d.ts +86 -0
- package/dist/composites/inference-service.d.ts.map +1 -0
- package/dist/composites/model.d.ts +80 -0
- package/dist/composites/model.d.ts.map +1 -0
- package/dist/composites/operator-stack.d.ts +183 -0
- package/dist/composites/operator-stack.d.ts.map +1 -0
- package/dist/composites/vllm-serving-runtime.d.ts +100 -0
- package/dist/composites/vllm-serving-runtime.d.ts.map +1 -0
- package/dist/crd/crd-sources.d.ts.map +1 -1
- package/dist/deep-observe-hooks.d.ts.map +1 -1
- package/dist/generated/index.d.ts +167 -40
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/group-namespace.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/integrity.json +41 -33
- package/dist/kube/apply.d.ts.map +1 -1
- package/dist/lint/audit-catalog.d.ts.map +1 -1
- package/dist/lint/post-synth/argo-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/crd-schema-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/post-synth/k8s-helpers.d.ts +56 -6
- package/dist/lint/post-synth/k8s-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/sops-helpers.d.ts +38 -0
- package/dist/lint/post-synth/sops-helpers.d.ts.map +1 -0
- package/dist/lint/post-synth/wk8005.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8006.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8041.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8042.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8101.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8102.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8103.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8104.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8105.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8201.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8202.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8203.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8204.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8205.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8207.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8208.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8209.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8301.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8302.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8303.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8304.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8305.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8306.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8401.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8402.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8403.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8404.d.ts +12 -0
- package/dist/lint/post-synth/wk8404.d.ts.map +1 -0
- package/dist/lint/post-synth/wk8405.d.ts +13 -0
- package/dist/lint/post-synth/wk8405.d.ts.map +1 -0
- package/dist/lint/post-synth/wk8406.d.ts +12 -0
- package/dist/lint/post-synth/wk8406.d.ts.map +1 -0
- package/dist/lint/post-synth/wk8407.d.ts +21 -0
- package/dist/lint/post-synth/wk8407.d.ts.map +1 -0
- package/dist/lint/post-synth/wk8503.d.ts +39 -0
- package/dist/lint/post-synth/wk8503.d.ts.map +1 -0
- package/dist/lint/post-synth/wk8504.d.ts +28 -0
- package/dist/lint/post-synth/wk8504.d.ts.map +1 -0
- package/dist/lint/post-synth/wk8505.d.ts +28 -0
- package/dist/lint/post-synth/wk8505.d.ts.map +1 -0
- package/dist/manifest.json +1 -1
- package/dist/meta.json +1039 -68
- package/dist/okf/index.md +26 -2
- package/dist/okf/rules/FLUX002.md +0 -1
- package/dist/okf/rules/WK8404.md +11 -0
- package/dist/okf/rules/WK8405.md +17 -0
- package/dist/okf/rules/WK8406.md +11 -0
- package/dist/okf/rules/WK8407.md +15 -0
- package/dist/okf/rules/WK8503.md +17 -0
- package/dist/okf/rules/WK8504.md +11 -0
- package/dist/okf/rules/WK8505.md +15 -0
- package/dist/okf/types/AWSClusterControllerIdentity.md +14 -0
- package/dist/okf/types/AWSManagedCluster.md +14 -0
- package/dist/okf/types/AWSManagedControlPlane.md +14 -0
- package/dist/okf/types/AWSManagedMachinePool.md +14 -0
- package/dist/okf/types/CAPICluster.md +14 -0
- package/dist/okf/types/Certificate.md +1 -0
- package/dist/okf/types/ClusterResourceSet.md +14 -0
- package/dist/okf/types/ClusterServingRuntime.md +14 -0
- package/dist/okf/types/{Cluster.md → CnpgCluster.md} +2 -2
- package/dist/okf/types/DBInstance.md +14 -0
- package/dist/okf/types/{Bucket.md → FluxBucket.md} +2 -6
- package/dist/okf/types/HelmChartProxy.md +14 -0
- package/dist/okf/types/IamRole.md +14 -0
- package/dist/okf/types/InferenceService.md +19 -0
- package/dist/okf/types/InfisicalDynamicSecret.md +4 -0
- package/dist/okf/types/InfisicalSecret.md +4 -0
- package/dist/okf/types/Kustomization.md +1 -0
- package/dist/okf/types/MachinePool.md +14 -0
- package/dist/okf/types/PDB.md +1 -0
- package/dist/okf/types/PodIdentityAssociation.md +14 -0
- package/dist/okf/types/Policy.md +14 -0
- package/dist/okf/types/S3Bucket.md +14 -0
- package/dist/okf/types/ServingRuntime.md +14 -0
- package/dist/okf/types/StatefulSet.md +1 -0
- package/dist/okf/types/User.md +14 -0
- package/dist/op/activities/ensure-secret.d.ts +41 -0
- package/dist/op/activities/ensure-secret.d.ts.map +1 -0
- package/dist/op/activities/index.d.ts +2 -0
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/kubectl.d.ts +9 -0
- package/dist/op/activities/kubectl.d.ts.map +1 -1
- package/dist/op/activities/wait-for-ready.d.ts.map +1 -1
- package/dist/op/builders.d.ts +69 -0
- package/dist/op/builders.d.ts.map +1 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/rules/argo-helpers.ts +2 -6
- package/dist/rules/crd-schema-helpers.ts +4 -6
- package/dist/rules/k8s-helpers.ts +87 -24
- package/dist/rules/sops-helpers.ts +76 -0
- package/dist/rules/wk8005.ts +27 -32
- package/dist/rules/wk8006.ts +33 -38
- package/dist/rules/wk8041.ts +19 -24
- package/dist/rules/wk8042.ts +17 -22
- package/dist/rules/wk8101.ts +29 -34
- package/dist/rules/wk8102.ts +13 -18
- package/dist/rules/wk8103.ts +17 -22
- package/dist/rules/wk8104.ts +30 -35
- package/dist/rules/wk8105.ts +16 -21
- package/dist/rules/wk8201.ts +26 -31
- package/dist/rules/wk8202.ts +17 -22
- package/dist/rules/wk8203.ts +17 -22
- package/dist/rules/wk8204.ts +46 -51
- package/dist/rules/wk8205.ts +27 -32
- package/dist/rules/wk8207.ts +14 -19
- package/dist/rules/wk8208.ts +14 -19
- package/dist/rules/wk8209.ts +14 -19
- package/dist/rules/wk8301.ts +25 -30
- package/dist/rules/wk8302.ts +19 -24
- package/dist/rules/wk8303.ts +23 -26
- package/dist/rules/wk8304.ts +35 -40
- package/dist/rules/wk8305.ts +39 -42
- package/dist/rules/wk8306.ts +20 -25
- package/dist/rules/wk8401.ts +59 -64
- package/dist/rules/wk8402.ts +13 -18
- package/dist/rules/wk8403.ts +32 -37
- package/dist/rules/wk8404.ts +49 -0
- package/dist/rules/wk8405.ts +85 -0
- package/dist/rules/wk8406.ts +55 -0
- package/dist/rules/wk8407.ts +66 -0
- package/dist/rules/wk8503.ts +220 -0
- package/dist/rules/wk8504.ts +51 -0
- package/dist/rules/wk8505.ts +63 -0
- package/dist/secret-labels.d.ts +31 -0
- package/dist/secret-labels.d.ts.map +1 -0
- package/dist/secret-store.d.ts +73 -0
- package/dist/secret-store.d.ts.map +1 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/sops/encrypted-secret-file.d.ts +52 -0
- package/dist/sops/encrypted-secret-file.d.ts.map +1 -0
- package/dist/sops/entity.d.ts +31 -0
- package/dist/sops/entity.d.ts.map +1 -0
- package/dist/teardown.d.ts.map +1 -1
- package/dist/types/index.d.ts +261 -9
- package/package.json +4 -4
- package/src/components/kubectl-apply.ts +5 -0
- package/src/composites/composites.test.ts +556 -0
- package/src/composites/flux-app.ts +23 -0
- package/src/composites/index.ts +15 -0
- package/src/composites/inference-service.ts +140 -0
- package/src/composites/model.ts +150 -0
- package/src/composites/operator-stack.ts +385 -0
- package/src/composites/vllm-serving-runtime.test.ts +167 -0
- package/src/composites/vllm-serving-runtime.ts +196 -0
- package/src/crd/cnpg.test.ts +8 -3
- package/src/crd/crd-sources.ts +183 -0
- package/src/crd/parser.test.ts +14 -0
- package/src/deep-observe-hooks.ts +24 -0
- package/src/deep-observe.test.ts +89 -0
- package/src/generated/index.d.ts +261 -9
- package/src/generated/index.ts +167 -40
- package/src/generated/lexicon-k8s.json +1039 -68
- package/src/generated/operations.json +272 -0
- package/src/group-namespace.test.ts +31 -0
- package/src/group-namespace.ts +13 -0
- package/src/index.ts +17 -0
- package/src/kube/apply.ts +5 -0
- package/src/lint/audit-catalog.ts +7 -0
- package/src/lint/post-synth/argo-helpers.ts +2 -6
- package/src/lint/post-synth/crd-schema-helpers.ts +4 -6
- package/src/lint/post-synth/index.ts +14 -0
- package/src/lint/post-synth/k8s-helpers.test.ts +26 -9
- package/src/lint/post-synth/k8s-helpers.ts +87 -24
- package/src/lint/post-synth/post-synth.test.ts +826 -0
- package/src/lint/post-synth/sops-helpers.ts +76 -0
- package/src/lint/post-synth/wk8005.ts +27 -32
- package/src/lint/post-synth/wk8006.ts +33 -38
- package/src/lint/post-synth/wk8041.ts +19 -24
- package/src/lint/post-synth/wk8042.ts +17 -22
- package/src/lint/post-synth/wk8101.ts +29 -34
- package/src/lint/post-synth/wk8102.ts +13 -18
- package/src/lint/post-synth/wk8103.ts +17 -22
- package/src/lint/post-synth/wk8104.ts +30 -35
- package/src/lint/post-synth/wk8105.ts +16 -21
- package/src/lint/post-synth/wk8201.ts +26 -31
- package/src/lint/post-synth/wk8202.ts +17 -22
- package/src/lint/post-synth/wk8203.ts +17 -22
- package/src/lint/post-synth/wk8204.ts +46 -51
- package/src/lint/post-synth/wk8205.ts +27 -32
- package/src/lint/post-synth/wk8207.ts +14 -19
- package/src/lint/post-synth/wk8208.ts +14 -19
- package/src/lint/post-synth/wk8209.ts +14 -19
- package/src/lint/post-synth/wk8301.ts +25 -30
- package/src/lint/post-synth/wk8302.ts +19 -24
- package/src/lint/post-synth/wk8303.ts +23 -26
- package/src/lint/post-synth/wk8304.ts +35 -40
- package/src/lint/post-synth/wk8305.ts +39 -42
- package/src/lint/post-synth/wk8306.ts +20 -25
- package/src/lint/post-synth/wk8401.ts +59 -64
- package/src/lint/post-synth/wk8402.ts +13 -18
- package/src/lint/post-synth/wk8403.ts +32 -37
- package/src/lint/post-synth/wk8404.ts +49 -0
- package/src/lint/post-synth/wk8405.ts +85 -0
- package/src/lint/post-synth/wk8406.ts +55 -0
- package/src/lint/post-synth/wk8407.ts +66 -0
- package/src/lint/post-synth/wk8503.ts +220 -0
- package/src/lint/post-synth/wk8504.ts +51 -0
- package/src/lint/post-synth/wk8505.ts +63 -0
- package/src/op/activities/ensure-secret.ts +71 -0
- package/src/op/activities/index.ts +7 -0
- package/src/op/activities/kubectl.test.ts +32 -0
- package/src/op/activities/kubectl.ts +28 -5
- package/src/op/activities/wait-for-ready.test.ts +34 -0
- package/src/op/activities/wait-for-ready.ts +26 -0
- package/src/op/builders.test.ts +82 -0
- package/src/op/builders.ts +95 -0
- package/src/plugin.ts +21 -2
- package/src/secret-labels.ts +36 -0
- package/src/secret-store.test.ts +184 -0
- package/src/secret-store.ts +165 -0
- package/src/serializer.ts +41 -2
- package/src/sops/encrypted-secret-file.test.ts +333 -0
- package/src/sops/encrypted-secret-file.ts +264 -0
- package/src/sops/entity.ts +53 -0
- package/src/teardown.test.ts +36 -0
- package/src/teardown.ts +14 -0
- package/src/testdata/sops/db-credentials.sops.yaml +23 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared helpers for Kubernetes post-synthesis lint rules.
|
|
3
3
|
*
|
|
4
|
-
* Provides
|
|
5
|
-
* extraction logic that handles all common workload types.
|
|
4
|
+
* Provides the `ctx.docs` → `K8sManifest[]` bridge every check reads through,
|
|
5
|
+
* and container extraction logic that handles all common workload types.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
export { getPrimaryOutput } from "@intentius/chant/lint/post-synth";
|
|
8
|
+
import { parseOutputDocs, type PostSynthContext } from "@intentius/chant/lint/post-synth";
|
|
9
|
+
export { getPrimaryOutput, getAdditionalFiles } from "@intentius/chant/lint/post-synth";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A parsed Kubernetes manifest (loosely typed).
|
|
@@ -45,27 +45,36 @@ export interface K8sContainer {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* Every parsed Kubernetes manifest across all lexicon outputs, via `ctx.docs`
|
|
49
|
+
* (chant #975) — the shared, parse-once view every k8s post-synth check
|
|
50
|
+
* reads, in place of the old per-check `parseK8sManifests(getPrimaryOutput(output))`
|
|
51
|
+
* splitter (chant #976). Two documents are dropped rather than passed through
|
|
52
|
+
* as a "manifest":
|
|
53
|
+
*
|
|
54
|
+
* - `d.error` — a document `parseOutputDocs` could not make sense of.
|
|
55
|
+
* - `d.file` — a document that came from a `SerializerResult.files` sidecar
|
|
56
|
+
* (a committed-encrypted secret's ciphertext, in this lexicon) rather than
|
|
57
|
+
* a lexicon's primary output. `parseK8sManifests` only ever saw
|
|
58
|
+
* `getPrimaryOutput(output)`, so a sidecar was invisible to every general
|
|
59
|
+
* manifest-consuming check — see `getAdditionalFiles`'s doc comment on why
|
|
60
|
+
* that separation is deliberate. Only `sops-helpers.ts`'s
|
|
61
|
+
* `resolveEncryptedSecretClaims` (WK8504/WK8503's producer join) reads
|
|
62
|
+
* `.files` explicitly; this bridge must keep it that way.
|
|
63
|
+
*
|
|
64
|
+
* `ctx.docs` is populated by every context chant itself builds (`chant
|
|
65
|
+
* build`, `@intentius/chant-test-utils`'s `createPostSynthContext` /
|
|
66
|
+
* `makePostSynthCtx*`) — see `PostSynthContext.docs`'s doc comment for why
|
|
67
|
+
* it is still optional at the type level. A handful of this lexicon's own
|
|
68
|
+
* hand-rolled `PostSynthContext` test literals (`post-synth.test.ts`'s
|
|
69
|
+
* `makeCtx`) predate that field and never set it; for those, fall back to
|
|
70
|
+
* parsing `ctx.outputs` directly with the same `parseOutputDocs` primitive,
|
|
71
|
+
* rather than silently returning no manifests.
|
|
50
72
|
*/
|
|
51
|
-
export function
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const trimmed = doc.trim();
|
|
57
|
-
if (trimmed === "" || trimmed === "---") continue;
|
|
58
|
-
try {
|
|
59
|
-
const parsed = parseYAML(trimmed);
|
|
60
|
-
if (typeof parsed === "object" && parsed !== null) {
|
|
61
|
-
manifests.push(parsed as K8sManifest);
|
|
62
|
-
}
|
|
63
|
-
} catch {
|
|
64
|
-
// Skip unparseable documents
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return manifests;
|
|
73
|
+
export function docsToManifests(ctx: PostSynthContext): K8sManifest[] {
|
|
74
|
+
const docs = ctx.docs ?? parseOutputDocs(ctx.outputs);
|
|
75
|
+
return docs
|
|
76
|
+
.filter((d) => !d.error && !d.file)
|
|
77
|
+
.map((d) => d.value as K8sManifest);
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
/**
|
|
@@ -103,6 +112,13 @@ export function extractPodSpec(
|
|
|
103
112
|
return (template?.spec as Record<string, unknown>) ?? null;
|
|
104
113
|
}
|
|
105
114
|
|
|
115
|
+
// KServe ServingRuntime/ClusterServingRuntime carry `containers` and
|
|
116
|
+
// `tolerations` directly on spec — no template wrapper, unlike the
|
|
117
|
+
// built-in workload kinds above.
|
|
118
|
+
case "ServingRuntime":
|
|
119
|
+
case "ClusterServingRuntime":
|
|
120
|
+
return spec;
|
|
121
|
+
|
|
106
122
|
default:
|
|
107
123
|
return null;
|
|
108
124
|
}
|
|
@@ -148,6 +164,53 @@ export const WORKLOAD_KINDS = new Set([
|
|
|
148
164
|
"CronJob",
|
|
149
165
|
]);
|
|
150
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Workload kinds that can request `nvidia.com/gpu` — the built-in workload
|
|
169
|
+
* kinds plus KServe's ServingRuntime/ClusterServingRuntime, which declare
|
|
170
|
+
* `containers`/`tolerations` directly on spec (see `extractPodSpec`).
|
|
171
|
+
*/
|
|
172
|
+
export const GPU_POD_KINDS = new Set([
|
|
173
|
+
...WORKLOAD_KINDS,
|
|
174
|
+
"ServingRuntime",
|
|
175
|
+
"ClusterServingRuntime",
|
|
176
|
+
]);
|
|
177
|
+
|
|
178
|
+
/** A Kubernetes toleration (loosely typed). */
|
|
179
|
+
export interface K8sToleration {
|
|
180
|
+
key?: string;
|
|
181
|
+
operator?: "Exists" | "Equal";
|
|
182
|
+
value?: string;
|
|
183
|
+
effect?: string;
|
|
184
|
+
[key: string]: unknown;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Resource name used for GPU requests/limits across the lexicon. */
|
|
188
|
+
export const NVIDIA_GPU_RESOURCE = "nvidia.com/gpu";
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* True when any container in `containers` requests or limits
|
|
192
|
+
* `nvidia.com/gpu`.
|
|
193
|
+
*/
|
|
194
|
+
export function requestsGpu(containers: K8sContainer[]): boolean {
|
|
195
|
+
return containers.some((c) => {
|
|
196
|
+
const requests = c.resources?.requests as Record<string, unknown> | undefined;
|
|
197
|
+
const limits = c.resources?.limits as Record<string, unknown> | undefined;
|
|
198
|
+
return Boolean(requests?.[NVIDIA_GPU_RESOURCE]) || Boolean(limits?.[NVIDIA_GPU_RESOURCE]);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* True when `tolerations` includes one that tolerates the `nvidia.com/gpu`
|
|
204
|
+
* taint — either an explicit `key: "nvidia.com/gpu"` toleration, or a
|
|
205
|
+
* wildcard `{ operator: "Exists" }` with no key (tolerates every taint).
|
|
206
|
+
*/
|
|
207
|
+
export function toleratesGpu(tolerations: unknown): boolean {
|
|
208
|
+
if (!Array.isArray(tolerations)) return false;
|
|
209
|
+
return (tolerations as K8sToleration[]).some(
|
|
210
|
+
(t) => t.key === NVIDIA_GPU_RESOURCE || (t.operator === "Exists" && !t.key),
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
151
214
|
/**
|
|
152
215
|
* Parse a Kubernetes memory string to bytes.
|
|
153
216
|
*
|