@intentius/chant-lexicon-k8s 0.124.97 → 0.124.98
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/application-paths.d.ts +4 -0
- package/dist/application-paths.d.ts.map +1 -0
- package/dist/application-paths.js +95 -0
- package/dist/application-set.d.ts +46 -0
- package/dist/application-set.d.ts.map +1 -0
- package/dist/application-set.js +303 -0
- package/dist/cluster-secret.d.ts +36 -0
- package/dist/cluster-secret.d.ts.map +1 -0
- package/dist/cluster-secret.js +55 -0
- package/dist/components/kustomize-apply.d.ts +6 -0
- package/dist/components/kustomize-apply.d.ts.map +1 -1
- package/dist/components/kustomize-apply.js +1 -1
- package/dist/config-schema.d.ts +8 -0
- package/dist/config-schema.d.ts.map +1 -1
- package/dist/config-schema.js +6 -2
- package/dist/config.d.ts +26 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/helm-references.d.ts +113 -0
- package/dist/helm-references.d.ts.map +1 -0
- package/dist/helm-references.js +389 -0
- package/dist/import/generator.d.ts +11 -2
- package/dist/import/generator.d.ts.map +1 -1
- package/dist/import/generator.js +37 -55
- package/dist/import/parser.d.ts.map +1 -1
- package/dist/import/parser.js +34 -5
- package/dist/import/typed-classes.d.ts +57 -0
- package/dist/import/typed-classes.d.ts.map +1 -0
- package/dist/import/typed-classes.js +126 -0
- package/dist/integrity.json +41 -41
- package/dist/kustomize/render.d.ts +41 -2
- package/dist/kustomize/render.d.ts.map +1 -1
- package/dist/kustomize/render.js +114 -7
- package/dist/kustomize/root.d.ts +3 -3
- package/dist/kustomize/root.d.ts.map +1 -1
- package/dist/kustomize/root.js +6 -1
- package/dist/lint/post-synth/argo-helpers.d.ts +3 -0
- package/dist/lint/post-synth/argo-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/argo-helpers.js +8 -2
- package/dist/lint/post-synth/argo002.d.ts.map +1 -1
- package/dist/lint/post-synth/argo002.js +2 -1
- package/dist/lint/post-synth/argo003.d.ts.map +1 -1
- package/dist/lint/post-synth/argo003.js +2 -1
- package/dist/lint/post-synth/argo005.d.ts.map +1 -1
- package/dist/lint/post-synth/argo005.js +36 -9
- package/dist/lint/post-synth/crd-schema-helpers.d.ts +1 -1
- package/dist/lint/post-synth/crd-schema-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/crd-schema-helpers.js +3 -3
- package/dist/lint/post-synth/flux002.d.ts.map +1 -1
- package/dist/lint/post-synth/flux002.js +2 -1
- package/dist/lint/post-synth/flux003.d.ts.map +1 -1
- package/dist/lint/post-synth/flux003.js +2 -1
- package/dist/lint/post-synth/k8s-helpers.d.ts +32 -0
- package/dist/lint/post-synth/k8s-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/k8s-helpers.js +57 -10
- package/dist/lint/post-synth/wk8005.d.ts +9 -0
- package/dist/lint/post-synth/wk8005.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8005.js +53 -3
- package/dist/lint/post-synth/wk8006.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8006.js +4 -2
- package/dist/lint/post-synth/wk8041.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8041.js +3 -2
- package/dist/lint/post-synth/wk8042.js +2 -2
- package/dist/lint/post-synth/wk8101.js +2 -2
- package/dist/lint/post-synth/wk8102.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8102.js +7 -3
- package/dist/lint/post-synth/wk8103.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8103.js +3 -2
- package/dist/lint/post-synth/wk8104.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8104.js +3 -2
- package/dist/lint/post-synth/wk8105.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8105.js +3 -2
- package/dist/lint/post-synth/wk8201.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8201.js +3 -2
- package/dist/lint/post-synth/wk8202.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8202.js +3 -2
- package/dist/lint/post-synth/wk8203.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8203.js +3 -2
- package/dist/lint/post-synth/wk8204.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8204.js +5 -2
- package/dist/lint/post-synth/wk8205.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8205.js +3 -2
- package/dist/lint/post-synth/wk8207.js +2 -2
- package/dist/lint/post-synth/wk8208.js +2 -2
- package/dist/lint/post-synth/wk8209.js +2 -2
- package/dist/lint/post-synth/wk8301.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8301.js +3 -2
- package/dist/lint/post-synth/wk8302.js +2 -2
- package/dist/lint/post-synth/wk8303.js +2 -2
- package/dist/lint/post-synth/wk8304.js +2 -2
- package/dist/lint/post-synth/wk8305.js +2 -2
- package/dist/lint/post-synth/wk8306.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8306.js +3 -2
- package/dist/lint/post-synth/wk8401.js +2 -2
- package/dist/lint/post-synth/wk8402.js +2 -2
- package/dist/lint/post-synth/wk8403.js +2 -2
- package/dist/lint/post-synth/wk8404.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8404.js +2 -2
- package/dist/lint/post-synth/wk8405.js +2 -2
- package/dist/lint/post-synth/wk8406.d.ts.map +1 -1
- package/dist/lint/post-synth/wk8406.js +3 -2
- package/dist/lint/post-synth/wk8407.js +2 -2
- package/dist/lint/post-synth/wk8503.js +2 -2
- package/dist/manifest.json +1 -1
- package/dist/reference-catalog.d.ts +3 -1
- package/dist/reference-catalog.d.ts.map +1 -1
- package/dist/reference-catalog.js +283 -15
- package/dist/rules/argo-helpers.ts +9 -2
- package/dist/rules/argo002.ts +2 -1
- package/dist/rules/argo003.ts +2 -1
- package/dist/rules/argo005.ts +36 -10
- package/dist/rules/crd-schema-helpers.ts +3 -3
- package/dist/rules/flux002.ts +2 -1
- package/dist/rules/flux003.ts +2 -1
- package/dist/rules/k8s-helpers.ts +56 -11
- package/dist/rules/wk8005.ts +56 -3
- package/dist/rules/wk8006.ts +4 -2
- package/dist/rules/wk8041.ts +3 -2
- package/dist/rules/wk8042.ts +2 -2
- package/dist/rules/wk8101.ts +2 -2
- package/dist/rules/wk8102.ts +7 -3
- package/dist/rules/wk8103.ts +3 -2
- package/dist/rules/wk8104.ts +3 -2
- package/dist/rules/wk8105.ts +3 -2
- package/dist/rules/wk8201.ts +3 -2
- package/dist/rules/wk8202.ts +3 -2
- package/dist/rules/wk8203.ts +3 -2
- package/dist/rules/wk8204.ts +5 -2
- package/dist/rules/wk8205.ts +3 -2
- package/dist/rules/wk8207.ts +2 -2
- package/dist/rules/wk8208.ts +2 -2
- package/dist/rules/wk8209.ts +2 -2
- package/dist/rules/wk8301.ts +3 -2
- package/dist/rules/wk8302.ts +2 -2
- package/dist/rules/wk8303.ts +2 -2
- package/dist/rules/wk8304.ts +2 -2
- package/dist/rules/wk8305.ts +2 -2
- package/dist/rules/wk8306.ts +3 -2
- package/dist/rules/wk8401.ts +2 -2
- package/dist/rules/wk8402.ts +2 -2
- package/dist/rules/wk8403.ts +2 -2
- package/dist/rules/wk8404.ts +2 -1
- package/dist/rules/wk8405.ts +2 -2
- package/dist/rules/wk8406.ts +3 -2
- package/dist/rules/wk8407.ts +2 -2
- package/dist/rules/wk8503.ts +2 -2
- package/dist/workspace-member.d.ts +15 -3
- package/dist/workspace-member.d.ts.map +1 -1
- package/dist/workspace-member.js +151 -21
- package/package.json +5 -5
- package/src/application-paths.ts +96 -0
- package/src/application-set.test.ts +130 -0
- package/src/application-set.ts +336 -0
- package/src/cluster-secret.test.ts +117 -0
- package/src/cluster-secret.ts +76 -0
- package/src/components/kustomize-apply.ts +7 -1
- package/src/config-schema.ts +6 -2
- package/src/config.ts +24 -4
- package/src/helm-references.test.ts +149 -0
- package/src/helm-references.ts +425 -0
- package/src/import/generator.test.ts +57 -0
- package/src/import/generator.ts +35 -61
- package/src/import/parser.test.ts +59 -0
- package/src/import/parser.ts +38 -5
- package/src/import/roundtrip-build.test.ts +91 -0
- package/src/import/typed-classes.ts +168 -0
- package/src/kustomize/helm.test.ts +183 -0
- package/src/kustomize/render.ts +142 -6
- package/src/kustomize/root.ts +8 -3
- package/src/lint/post-synth/argo-helpers.ts +9 -2
- package/src/lint/post-synth/argo002.ts +2 -1
- package/src/lint/post-synth/argo003.ts +2 -1
- package/src/lint/post-synth/argo005.ts +36 -10
- package/src/lint/post-synth/audit-identity.test.ts +65 -0
- package/src/lint/post-synth/crd-schema-helpers.ts +3 -3
- package/src/lint/post-synth/flux002.ts +2 -1
- package/src/lint/post-synth/flux003.ts +2 -1
- package/src/lint/post-synth/k8s-helpers.ts +56 -11
- package/src/lint/post-synth/post-synth.test.ts +144 -0
- package/src/lint/post-synth/wk8005.ts +56 -3
- package/src/lint/post-synth/wk8006.ts +4 -2
- package/src/lint/post-synth/wk8041.ts +3 -2
- package/src/lint/post-synth/wk8042.ts +2 -2
- package/src/lint/post-synth/wk8101.ts +2 -2
- package/src/lint/post-synth/wk8102.ts +7 -3
- package/src/lint/post-synth/wk8103.ts +3 -2
- package/src/lint/post-synth/wk8104.ts +3 -2
- package/src/lint/post-synth/wk8105.ts +3 -2
- package/src/lint/post-synth/wk8201.ts +3 -2
- package/src/lint/post-synth/wk8202.ts +3 -2
- package/src/lint/post-synth/wk8203.ts +3 -2
- package/src/lint/post-synth/wk8204.ts +5 -2
- package/src/lint/post-synth/wk8205.ts +3 -2
- package/src/lint/post-synth/wk8207.ts +2 -2
- package/src/lint/post-synth/wk8208.ts +2 -2
- package/src/lint/post-synth/wk8209.ts +2 -2
- package/src/lint/post-synth/wk8301.ts +3 -2
- package/src/lint/post-synth/wk8302.ts +2 -2
- package/src/lint/post-synth/wk8303.ts +2 -2
- package/src/lint/post-synth/wk8304.ts +2 -2
- package/src/lint/post-synth/wk8305.ts +2 -2
- package/src/lint/post-synth/wk8306.ts +3 -2
- package/src/lint/post-synth/wk8401.ts +2 -2
- package/src/lint/post-synth/wk8402.ts +2 -2
- package/src/lint/post-synth/wk8403.ts +2 -2
- package/src/lint/post-synth/wk8404.ts +2 -1
- package/src/lint/post-synth/wk8405.ts +2 -2
- package/src/lint/post-synth/wk8406.ts +3 -2
- package/src/lint/post-synth/wk8407.ts +2 -2
- package/src/lint/post-synth/wk8503.ts +2 -2
- package/src/reference-catalog.test.ts +78 -0
- package/src/reference-catalog.ts +297 -16
- package/src/testdata/helm-chart-missing/kustomization.yaml +8 -0
- package/src/testdata/helm-chart-root/charts/webchart/Chart.yaml +3 -0
- package/src/testdata/helm-chart-root/charts/webchart/templates/configmap.yaml +6 -0
- package/src/testdata/helm-chart-root/charts/webchart/values.yaml +1 -0
- package/src/testdata/helm-chart-root/kustomization.yaml +9 -0
- package/src/testdata/helm-chart-root/values.yaml +1 -0
- package/src/testdata/workspace-members/argo-clusters/clusters.yaml +34 -0
- package/src/testdata/workspace-members/argo-set/all.yaml +43 -0
- package/src/testdata/workspace-members/plain/deploy.yaml +27 -0
- package/src/testdata/workspace-members/plain/es.yaml +15 -0
- package/src/testdata/workspace-members/templated/block.yaml +6 -0
- package/src/testdata/workspace-members/templated/chart-cm.yaml +4 -0
- package/src/testdata/workspace-members/templated/cm.yaml +6 -0
- package/src/workspace-kinds.test.ts +9 -1
- package/src/workspace-member.test.ts +69 -3
- package/src/workspace-member.ts +165 -24
- package/workspace-kinds.json +45 -6
package/dist/rules/wk8203.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests, extractContainers, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, extractContainers, containerLocator, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8203: PostSynthCheck = {
|
|
13
13
|
id: "WK8203",
|
|
@@ -20,7 +20,7 @@ export const wk8203: PostSynthCheck = {
|
|
|
20
20
|
if (!manifest.kind || !WORKLOAD_KINDS.has(manifest.kind)) continue;
|
|
21
21
|
|
|
22
22
|
const containers = extractContainers(manifest);
|
|
23
|
-
const resourceName = manifest
|
|
23
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
24
24
|
|
|
25
25
|
for (const container of containers) {
|
|
26
26
|
const secCtx = container.securityContext;
|
|
@@ -30,6 +30,7 @@ export const wk8203: PostSynthCheck = {
|
|
|
30
30
|
severity: "warning",
|
|
31
31
|
message: `Container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" does not set readOnlyRootFilesystem: true — set it to reduce the attack surface`,
|
|
32
32
|
entity: resourceName,
|
|
33
|
+
locator: containerLocator(manifest, container),
|
|
33
34
|
lexicon: "k8s",
|
|
34
35
|
});
|
|
35
36
|
}
|
package/dist/rules/wk8204.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
14
|
-
import { docsToManifests, extractContainers, extractPodSpec, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
14
|
+
import { docsToManifests, extractContainers, containerLocator, extractPodSpec, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
15
15
|
|
|
16
16
|
export const wk8204: PostSynthCheck = {
|
|
17
17
|
id: "WK8204",
|
|
@@ -23,7 +23,7 @@ export const wk8204: PostSynthCheck = {
|
|
|
23
23
|
for (const manifest of docsToManifests(ctx)) {
|
|
24
24
|
if (!manifest.kind || !WORKLOAD_KINDS.has(manifest.kind)) continue;
|
|
25
25
|
|
|
26
|
-
const resourceName = manifest
|
|
26
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
27
27
|
const podSpec = extractPodSpec(manifest);
|
|
28
28
|
if (!podSpec) continue;
|
|
29
29
|
|
|
@@ -46,6 +46,7 @@ export const wk8204: PostSynthCheck = {
|
|
|
46
46
|
severity: "warning",
|
|
47
47
|
message: `Container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" does not set runAsNonRoot: true — set it at container or pod level`,
|
|
48
48
|
entity: resourceName,
|
|
49
|
+
locator: containerLocator(manifest, container),
|
|
49
50
|
lexicon: "k8s",
|
|
50
51
|
});
|
|
51
52
|
continue;
|
|
@@ -61,6 +62,7 @@ export const wk8204: PostSynthCheck = {
|
|
|
61
62
|
severity: "warning",
|
|
62
63
|
message: `Container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" has runAsNonRoot: true but runAsUser: 0 — these settings are contradictory and the container will fail to start`,
|
|
63
64
|
entity: resourceName,
|
|
65
|
+
locator: containerLocator(manifest, container),
|
|
64
66
|
lexicon: "k8s",
|
|
65
67
|
});
|
|
66
68
|
} else if (effectiveRunAsUser === undefined || effectiveRunAsUser === null) {
|
|
@@ -70,6 +72,7 @@ export const wk8204: PostSynthCheck = {
|
|
|
70
72
|
severity: "warning",
|
|
71
73
|
message: `Container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" has runAsNonRoot: true but no explicit runAsUser — set a numeric UID to ensure the container doesn't run as root`,
|
|
72
74
|
entity: resourceName,
|
|
75
|
+
locator: containerLocator(manifest, container),
|
|
73
76
|
lexicon: "k8s",
|
|
74
77
|
});
|
|
75
78
|
}
|
package/dist/rules/wk8205.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests, extractContainers, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, extractContainers, containerLocator, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8205: PostSynthCheck = {
|
|
13
13
|
id: "WK8205",
|
|
@@ -20,7 +20,7 @@ export const wk8205: PostSynthCheck = {
|
|
|
20
20
|
if (!manifest.kind || !WORKLOAD_KINDS.has(manifest.kind)) continue;
|
|
21
21
|
|
|
22
22
|
const containers = extractContainers(manifest);
|
|
23
|
-
const resourceName = manifest
|
|
23
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
24
24
|
|
|
25
25
|
for (const container of containers) {
|
|
26
26
|
const secCtx = container.securityContext;
|
|
@@ -40,6 +40,7 @@ export const wk8205: PostSynthCheck = {
|
|
|
40
40
|
severity: "warning",
|
|
41
41
|
message: `Container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" does not drop ALL capabilities — add securityContext.capabilities.drop: ["ALL"]`,
|
|
42
42
|
entity: resourceName,
|
|
43
|
+
locator: containerLocator(manifest, container),
|
|
43
44
|
lexicon: "k8s",
|
|
44
45
|
});
|
|
45
46
|
}
|
package/dist/rules/wk8207.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests, extractPodSpec, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, extractPodSpec, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8207: PostSynthCheck = {
|
|
13
13
|
id: "WK8207",
|
|
@@ -22,7 +22,7 @@ export const wk8207: PostSynthCheck = {
|
|
|
22
22
|
const podSpec = extractPodSpec(manifest);
|
|
23
23
|
if (!podSpec) continue;
|
|
24
24
|
|
|
25
|
-
const resourceName = manifest
|
|
25
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
26
26
|
|
|
27
27
|
if (podSpec.hostNetwork === true) {
|
|
28
28
|
diagnostics.push({
|
package/dist/rules/wk8208.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests, extractPodSpec, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, extractPodSpec, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8208: PostSynthCheck = {
|
|
13
13
|
id: "WK8208",
|
|
@@ -22,7 +22,7 @@ export const wk8208: PostSynthCheck = {
|
|
|
22
22
|
const podSpec = extractPodSpec(manifest);
|
|
23
23
|
if (!podSpec) continue;
|
|
24
24
|
|
|
25
|
-
const resourceName = manifest
|
|
25
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
26
26
|
|
|
27
27
|
if (podSpec.hostPID === true) {
|
|
28
28
|
diagnostics.push({
|
package/dist/rules/wk8209.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests, extractPodSpec, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, extractPodSpec, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8209: PostSynthCheck = {
|
|
13
13
|
id: "WK8209",
|
|
@@ -22,7 +22,7 @@ export const wk8209: PostSynthCheck = {
|
|
|
22
22
|
const podSpec = extractPodSpec(manifest);
|
|
23
23
|
if (!podSpec) continue;
|
|
24
24
|
|
|
25
|
-
const resourceName = manifest
|
|
25
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
26
26
|
|
|
27
27
|
if (podSpec.hostIPC === true) {
|
|
28
28
|
diagnostics.push({
|
package/dist/rules/wk8301.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
15
|
-
import { docsToManifests, extractContainers, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
15
|
+
import { docsToManifests, extractContainers, containerLocator, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
16
16
|
|
|
17
17
|
export const wk8301: PostSynthCheck = {
|
|
18
18
|
id: "WK8301",
|
|
@@ -27,7 +27,7 @@ export const wk8301: PostSynthCheck = {
|
|
|
27
27
|
if (manifest.kind === "Job" || manifest.kind === "CronJob") continue;
|
|
28
28
|
|
|
29
29
|
const containers = extractContainers(manifest);
|
|
30
|
-
const resourceName = manifest
|
|
30
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
31
31
|
|
|
32
32
|
for (const container of containers) {
|
|
33
33
|
// No declared port → no inbound traffic → nothing to HTTP-probe.
|
|
@@ -43,6 +43,7 @@ export const wk8301: PostSynthCheck = {
|
|
|
43
43
|
severity: "warning",
|
|
44
44
|
message: `Container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" is missing ${missing.join(" and ")}`,
|
|
45
45
|
entity: resourceName,
|
|
46
|
+
locator: containerLocator(manifest, container),
|
|
46
47
|
lexicon: "k8s",
|
|
47
48
|
});
|
|
48
49
|
}
|
package/dist/rules/wk8302.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
9
|
-
import { docsToManifests } from "./k8s-helpers";
|
|
9
|
+
import { docsToManifests, nameOf } from "./k8s-helpers";
|
|
10
10
|
|
|
11
11
|
export const wk8302: PostSynthCheck = {
|
|
12
12
|
id: "WK8302",
|
|
@@ -18,7 +18,7 @@ export const wk8302: PostSynthCheck = {
|
|
|
18
18
|
for (const manifest of docsToManifests(ctx)) {
|
|
19
19
|
if (manifest.kind !== "Deployment") continue;
|
|
20
20
|
|
|
21
|
-
const resourceName = manifest
|
|
21
|
+
const resourceName = nameOf(manifest, "Deployment");
|
|
22
22
|
const spec = manifest.spec;
|
|
23
23
|
if (!spec) continue;
|
|
24
24
|
|
package/dist/rules/wk8303.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, nameOf } from "./k8s-helpers";
|
|
11
11
|
import type { K8sManifest } from "./k8s-helpers";
|
|
12
12
|
|
|
13
13
|
export const wk8303: PostSynthCheck = {
|
|
@@ -32,7 +32,7 @@ export const wk8303: PostSynthCheck = {
|
|
|
32
32
|
// Only check HA deployments (replicas >= 2)
|
|
33
33
|
if (typeof replicas !== "number" || replicas < 2) continue;
|
|
34
34
|
|
|
35
|
-
const resourceName = manifest
|
|
35
|
+
const resourceName = nameOf(manifest, "Deployment");
|
|
36
36
|
|
|
37
37
|
// Check if any PDB targets this Deployment's labels
|
|
38
38
|
const selector = spec.selector as Record<string, unknown> | undefined;
|
package/dist/rules/wk8304.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8304: PostSynthCheck = {
|
|
13
13
|
id: "WK8304",
|
|
@@ -25,7 +25,7 @@ export const wk8304: PostSynthCheck = {
|
|
|
25
25
|
const sslRedirect = annotations["alb.ingress.kubernetes.io/ssl-redirect"];
|
|
26
26
|
if (!sslRedirect) continue;
|
|
27
27
|
|
|
28
|
-
const resourceName = manifest
|
|
28
|
+
const resourceName = nameOf(manifest, "Ingress");
|
|
29
29
|
const certArn = annotations["alb.ingress.kubernetes.io/certificate-arn"];
|
|
30
30
|
|
|
31
31
|
if (!certArn) {
|
package/dist/rules/wk8305.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
9
|
-
import { docsToManifests } from "./k8s-helpers";
|
|
9
|
+
import { docsToManifests, nameOf } from "./k8s-helpers";
|
|
10
10
|
import type { K8sManifest } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8305: PostSynthCheck = {
|
|
@@ -24,7 +24,7 @@ export const wk8305: PostSynthCheck = {
|
|
|
24
24
|
for (const manifest of manifests) {
|
|
25
25
|
if (manifest.kind !== "Ingress") continue;
|
|
26
26
|
|
|
27
|
-
const ingressName = manifest
|
|
27
|
+
const ingressName = nameOf(manifest, "Ingress");
|
|
28
28
|
const ingressNamespace = manifest.metadata?.namespace ?? "default";
|
|
29
29
|
const spec = manifest.spec;
|
|
30
30
|
if (!spec) continue;
|
package/dist/rules/wk8306.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
11
|
-
import { docsToManifests, extractContainers, WORKLOAD_KINDS } from "./k8s-helpers";
|
|
11
|
+
import { docsToManifests, extractContainers, containerLocator, WORKLOAD_KINDS, nameOf } from "./k8s-helpers";
|
|
12
12
|
|
|
13
13
|
export const wk8306: PostSynthCheck = {
|
|
14
14
|
id: "WK8306",
|
|
@@ -20,7 +20,7 @@ export const wk8306: PostSynthCheck = {
|
|
|
20
20
|
for (const manifest of docsToManifests(ctx)) {
|
|
21
21
|
if (!manifest.kind || !WORKLOAD_KINDS.has(manifest.kind)) continue;
|
|
22
22
|
|
|
23
|
-
const resourceName = manifest
|
|
23
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
24
24
|
const containers = extractContainers(manifest);
|
|
25
25
|
|
|
26
26
|
for (const container of containers) {
|
|
@@ -34,6 +34,7 @@ export const wk8306: PostSynthCheck = {
|
|
|
34
34
|
severity: "error",
|
|
35
35
|
message: `Container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" has command[0]="${firstArg}" which starts with a flag — the first element should be the binary, flags belong in args`,
|
|
36
36
|
entity: resourceName,
|
|
37
|
+
locator: containerLocator(manifest, container),
|
|
37
38
|
lexicon: "k8s",
|
|
38
39
|
});
|
|
39
40
|
}
|
package/dist/rules/wk8401.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
11
|
-
import { docsToManifests, parseMemoryBytes } from "./k8s-helpers";
|
|
11
|
+
import { docsToManifests, parseMemoryBytes, nameOf } from "./k8s-helpers";
|
|
12
12
|
|
|
13
13
|
export const wk8401: PostSynthCheck = {
|
|
14
14
|
id: "WK8401",
|
|
@@ -20,7 +20,7 @@ export const wk8401: PostSynthCheck = {
|
|
|
20
20
|
for (const manifest of docsToManifests(ctx)) {
|
|
21
21
|
if (manifest.kind !== "RayCluster") continue;
|
|
22
22
|
|
|
23
|
-
const clusterName = manifest
|
|
23
|
+
const clusterName = nameOf(manifest, "RayCluster");
|
|
24
24
|
const spec = manifest.spec as Record<string, unknown> | undefined;
|
|
25
25
|
if (!spec) continue;
|
|
26
26
|
|
package/dist/rules/wk8402.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8402: PostSynthCheck = {
|
|
13
13
|
id: "WK8402",
|
|
@@ -19,7 +19,7 @@ export const wk8402: PostSynthCheck = {
|
|
|
19
19
|
for (const manifest of docsToManifests(ctx)) {
|
|
20
20
|
if (manifest.kind !== "RayCluster") continue;
|
|
21
21
|
|
|
22
|
-
const name = manifest
|
|
22
|
+
const name = nameOf(manifest, "RayCluster");
|
|
23
23
|
const rayVersion = (manifest.spec as Record<string, unknown> | undefined)?.rayVersion;
|
|
24
24
|
|
|
25
25
|
if (!rayVersion) {
|
package/dist/rules/wk8403.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
10
|
-
import { docsToManifests, extractRayVersion } from "./k8s-helpers";
|
|
10
|
+
import { docsToManifests, extractRayVersion, nameOf } from "./k8s-helpers";
|
|
11
11
|
|
|
12
12
|
export const wk8403: PostSynthCheck = {
|
|
13
13
|
id: "WK8403",
|
|
@@ -19,7 +19,7 @@ export const wk8403: PostSynthCheck = {
|
|
|
19
19
|
for (const manifest of docsToManifests(ctx)) {
|
|
20
20
|
if (manifest.kind !== "RayCluster") continue;
|
|
21
21
|
|
|
22
|
-
const clusterName = manifest
|
|
22
|
+
const clusterName = nameOf(manifest, "RayCluster");
|
|
23
23
|
const spec = manifest.spec as Record<string, unknown> | undefined;
|
|
24
24
|
if (!spec) continue;
|
|
25
25
|
|
package/dist/rules/wk8404.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
requestsGpu,
|
|
17
17
|
toleratesGpu,
|
|
18
18
|
GPU_POD_KINDS,
|
|
19
|
+
nameOf,
|
|
19
20
|
} from "./k8s-helpers";
|
|
20
21
|
|
|
21
22
|
export const wk8404: PostSynthCheck = {
|
|
@@ -34,7 +35,7 @@ export const wk8404: PostSynthCheck = {
|
|
|
34
35
|
const podSpec = extractPodSpec(manifest);
|
|
35
36
|
if (toleratesGpu(podSpec?.tolerations)) continue;
|
|
36
37
|
|
|
37
|
-
const resourceName = manifest
|
|
38
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
38
39
|
diagnostics.push({
|
|
39
40
|
checkId: "WK8404",
|
|
40
41
|
severity: "error",
|
package/dist/rules/wk8405.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
13
|
-
import { docsToManifests } from "./k8s-helpers";
|
|
13
|
+
import { docsToManifests, nameOf } from "./k8s-helpers";
|
|
14
14
|
import type { K8sManifest } from "./k8s-helpers";
|
|
15
15
|
|
|
16
16
|
/** `app.kubernetes.io/component` values this lexicon's composites use for serving workloads. */
|
|
@@ -38,7 +38,7 @@ export const wk8405: PostSynthCheck = {
|
|
|
38
38
|
if (!isServingWorkload(manifest)) continue;
|
|
39
39
|
|
|
40
40
|
const labels = manifest.metadata?.labels;
|
|
41
|
-
const resourceName = manifest
|
|
41
|
+
const resourceName = nameOf(manifest, manifest.kind ?? "workload");
|
|
42
42
|
|
|
43
43
|
if (!labels || !hasCoveringPdb(labels, pdbSelectors)) {
|
|
44
44
|
diagnostics.push({
|
package/dist/rules/wk8406.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
12
|
-
import { docsToManifests, extractContainers, GPU_POD_KINDS, NVIDIA_GPU_RESOURCE } from "./k8s-helpers";
|
|
12
|
+
import { docsToManifests, extractContainers, containerLocator, GPU_POD_KINDS, NVIDIA_GPU_RESOURCE, nameOf } from "./k8s-helpers";
|
|
13
13
|
|
|
14
14
|
export const wk8406: PostSynthCheck = {
|
|
15
15
|
id: "WK8406",
|
|
@@ -22,7 +22,7 @@ export const wk8406: PostSynthCheck = {
|
|
|
22
22
|
if (!manifest.kind || !GPU_POD_KINDS.has(manifest.kind)) continue;
|
|
23
23
|
|
|
24
24
|
const containers = extractContainers(manifest);
|
|
25
|
-
const resourceName = manifest
|
|
25
|
+
const resourceName = nameOf(manifest, manifest.kind);
|
|
26
26
|
|
|
27
27
|
for (const container of containers) {
|
|
28
28
|
const requests = container.resources?.requests as Record<string, unknown> | undefined;
|
|
@@ -44,6 +44,7 @@ export const wk8406: PostSynthCheck = {
|
|
|
44
44
|
severity: "warning",
|
|
45
45
|
message: `GPU container "${container.name ?? "(unnamed)"}" in ${manifest.kind} "${resourceName}" is missing resource limits for ${missing.join(", ")} — a GPU pod without cpu/memory limits can starve its (scarce, expensive) node`,
|
|
46
46
|
entity: resourceName,
|
|
47
|
+
locator: containerLocator(manifest, container),
|
|
47
48
|
lexicon: "k8s",
|
|
48
49
|
});
|
|
49
50
|
}
|
package/dist/rules/wk8407.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
15
|
-
import { docsToManifests } from "./k8s-helpers";
|
|
15
|
+
import { docsToManifests, nameOf } from "./k8s-helpers";
|
|
16
16
|
|
|
17
17
|
/** Trailing path segments that mean "no explicit version" even though present. */
|
|
18
18
|
const FLOATING_TAGS = new Set(["latest", "main", "master", "head"]);
|
|
@@ -50,7 +50,7 @@ export const wk8407: PostSynthCheck = {
|
|
|
50
50
|
if (!storageUri) continue;
|
|
51
51
|
|
|
52
52
|
if (!isPinnedStorageUri(storageUri)) {
|
|
53
|
-
const resourceName = manifest
|
|
53
|
+
const resourceName = nameOf(manifest, "InferenceService");
|
|
54
54
|
diagnostics.push({
|
|
55
55
|
checkId: "WK8407",
|
|
56
56
|
severity: "warning",
|
package/dist/rules/wk8503.ts
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
38
38
|
import { collectSecretDeclarations } from "@intentius/chant/secret-provenance";
|
|
39
|
-
import { extractPodSpec, type K8sManifest } from "./k8s-helpers";
|
|
39
|
+
import { extractPodSpec, type K8sManifest, nameOf } from "./k8s-helpers";
|
|
40
40
|
import { allManifests } from "./argo-helpers";
|
|
41
41
|
import { resolveEncryptedSecretClaims } from "./sops-helpers";
|
|
42
42
|
|
|
@@ -192,7 +192,7 @@ export const wk8503: PostSynthCheck = {
|
|
|
192
192
|
for (const manifest of manifests) {
|
|
193
193
|
const podSpec = extractPodSpec(manifest);
|
|
194
194
|
if (!podSpec) continue;
|
|
195
|
-
const workload = manifest
|
|
195
|
+
const workload = nameOf(manifest, manifest.kind ?? "workload");
|
|
196
196
|
const namespace = manifest.metadata?.namespace;
|
|
197
197
|
|
|
198
198
|
const reported = new Set<string>();
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import type { Declarable } from "@intentius/chant/declarable";
|
|
2
|
-
import { type KustomizeRunner } from "./kustomize/render.js";
|
|
3
|
-
export type K8sMemberKind = "kustomize" | "argo-app" | "flux-kustomization";
|
|
2
|
+
import { type KustomizeHelmOptions, type KustomizeRunner } from "./kustomize/render.js";
|
|
3
|
+
export type K8sMemberKind = "kustomize" | "argo-app" | "flux-kustomization" | "manifests";
|
|
4
4
|
export interface K8sMemberConfig {
|
|
5
5
|
kind: K8sMemberKind;
|
|
6
6
|
dir: string;
|
|
7
7
|
label?: string;
|
|
8
|
+
/** Kustomize only: pass `--enable-helm` (#5112). Also set by `CHANT_K8S_ENABLE_HELM=1` in the environment, which is how `chant workspace graph` is told, since it writes this config itself. */
|
|
9
|
+
enableHelm?: boolean;
|
|
10
|
+
/** Kustomize only: the `helm` binary for `--helm-command`. Environment: `CHANT_K8S_HELM_COMMAND`. */
|
|
11
|
+
helmCommand?: string;
|
|
12
|
+
/** Kustomize only: let kustomize pull a chart that is not in the chart home, which uses the network. Environment: `CHANT_K8S_FETCH_CHARTS=1`. */
|
|
13
|
+
fetchCharts?: boolean;
|
|
14
|
+
/** The workspace root, absolute. `manifests` uses it to find the kustomizations that list its directory, and every kind reads the values files a chart reference names from it (#5100). */
|
|
15
|
+
workspace?: string;
|
|
8
16
|
}
|
|
9
17
|
/** What one member's read found, carried on the graph's `meta.k8sMember`. */
|
|
10
18
|
export interface K8sMemberReport {
|
|
11
19
|
kind: K8sMemberKind;
|
|
12
20
|
/** Kustomize only: false when the render could not run. */
|
|
13
21
|
rendered?: boolean;
|
|
14
|
-
/** Why nothing was read; set with `rendered: false`. */
|
|
22
|
+
/** Why nothing was read; set with `rendered: false`, or with `coveredBy`. */
|
|
15
23
|
reason?: string;
|
|
24
|
+
/** `manifests` only: the kustomization directory (workspace-relative) that lists this directory in `resources`, so its objects are read there. */
|
|
25
|
+
coveredBy?: string;
|
|
16
26
|
/** The objects the member contributed. */
|
|
17
27
|
objects: number;
|
|
18
28
|
}
|
|
29
|
+
/** The Helm settings of a kustomize member: its config, or the environment when the config sets none. */
|
|
30
|
+
export declare function memberHelmOptions(member: K8sMemberConfig, env?: NodeJS.ProcessEnv): KustomizeHelmOptions;
|
|
19
31
|
export declare function readK8sMember(opts: {
|
|
20
32
|
member: K8sMemberConfig;
|
|
21
33
|
/** Injectable renderer (tests); defaults to the real subprocess runner. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-member.d.ts","sourceRoot":"","sources":["../src/workspace-member.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace-member.d.ts","sourceRoot":"","sources":["../src/workspace-member.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAK5B,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,oBAAoB,GAAG,WAAW,CAAC;AAE1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gMAAgM;IAChM,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iJAAiJ;IACjJ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2LAA2L;IAC3L,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kJAAkJ;IAClJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAsGD,yGAAyG;AACzG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,oBAAoB,CAMrH;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,MAAM,EAAE,eAAe,CAAC;IACxB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,eAAe,CAAC;CACvB,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAgE9F;AAID;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,CAE7E;AAED,wBAAgB,gBAAgB,IAAI,eAAe,GAAG,SAAS,CAE9D"}
|