@intentius/chant-lexicon-k8s 0.124.97 → 0.124.99
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/actions/apps.d.ts +0 -1
- package/dist/actions/batch.d.ts +0 -1
- package/dist/actions/core.d.ts +0 -1
- package/dist/actions/index.d.ts +0 -1
- package/dist/actions/networking.d.ts +0 -1
- package/dist/actions/rbac.d.ts +0 -1
- package/dist/api/classify.d.ts +0 -1
- package/dist/api/connect.d.ts +0 -1
- package/dist/api/fake-cluster.d.ts +0 -1
- package/dist/api/operation-surface.d.ts +0 -1
- package/dist/api/owner-chain.d.ts +0 -1
- package/dist/api/sweep-types.d.ts +0 -1
- package/dist/application-paths.d.ts +3 -0
- package/dist/application-paths.js +95 -0
- package/dist/application-set.d.ts +45 -0
- package/dist/application-set.js +303 -0
- package/dist/behaviour-kinds.d.ts +0 -1
- package/dist/cluster-secret.d.ts +35 -0
- package/dist/cluster-secret.js +55 -0
- package/dist/codegen/docs-cli.d.ts +0 -1
- package/dist/codegen/docs.d.ts +0 -1
- package/dist/codegen/generate-cli.d.ts +0 -1
- package/dist/codegen/generate-lexicon.d.ts +7 -1
- package/dist/codegen/generate-lexicon.js +2 -0
- package/dist/codegen/generate-list-map-keys.d.ts +0 -1
- package/dist/codegen/generate-operations.d.ts +0 -1
- package/dist/codegen/generate-typescript.d.ts +0 -1
- package/dist/codegen/generate.d.ts +0 -1
- package/dist/codegen/naming.d.ts +0 -1
- package/dist/codegen/package.d.ts +0 -1
- package/dist/codegen/patches.d.ts +0 -1
- package/dist/codegen/typecheck.d.ts +0 -1
- package/dist/codegen/versions.d.ts +0 -1
- package/dist/components/argo-app.d.ts +0 -1
- package/dist/components/builders.d.ts +0 -1
- package/dist/components/capability-plugin.d.ts +0 -1
- package/dist/components/flux-reconcile.d.ts +0 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/kubectl-apply.d.ts +0 -1
- package/dist/components/kustomize-apply.d.ts +6 -1
- package/dist/components/kustomize-apply.js +1 -1
- package/dist/composites/adot-collector.d.ts +0 -1
- package/dist/composites/agic-ingress.d.ts +0 -1
- package/dist/composites/aks-external-dns-agent.d.ts +0 -1
- package/dist/composites/alb-ingress.d.ts +0 -1
- package/dist/composites/argo-app.d.ts +0 -1
- package/dist/composites/autoscaled-service.d.ts +0 -1
- package/dist/composites/azure-disk-storage-class.d.ts +0 -1
- package/dist/composites/azure-file-storage-class.d.ts +0 -1
- package/dist/composites/azure-monitor-collector.d.ts +0 -1
- package/dist/composites/batch-job.d.ts +0 -1
- package/dist/composites/catalog.d.ts +0 -1
- package/dist/composites/cockroachdb-cluster.d.ts +0 -1
- package/dist/composites/cockroachdb-region-stack.d.ts +0 -1
- package/dist/composites/config-connector-context.d.ts +0 -1
- package/dist/composites/configured-app.d.ts +0 -1
- package/dist/composites/cron-schedule.d.ts +0 -1
- package/dist/composites/cron-workload.d.ts +0 -1
- package/dist/composites/ebs-storage-class.d.ts +0 -1
- package/dist/composites/efs-storage-class.d.ts +0 -1
- package/dist/composites/external-dns-agent.d.ts +0 -1
- package/dist/composites/filestore-storage-class.d.ts +0 -1
- package/dist/composites/fluent-bit-agent.d.ts +0 -1
- package/dist/composites/flux-app.d.ts +0 -1
- package/dist/composites/gce-ingress.d.ts +0 -1
- package/dist/composites/gce-pd-storage-class.d.ts +0 -1
- package/dist/composites/gke-external-dns-agent.d.ts +0 -1
- package/dist/composites/gke-fluent-bit-agent.d.ts +0 -1
- package/dist/composites/gke-gateway.d.ts +0 -1
- package/dist/composites/gke-otel-collector.d.ts +0 -1
- package/dist/composites/index.d.ts +0 -1
- package/dist/composites/inference-service.d.ts +0 -1
- package/dist/composites/irsa-service-account.d.ts +0 -1
- package/dist/composites/member-defaults.d.ts +0 -1
- package/dist/composites/metrics-server.d.ts +0 -1
- package/dist/composites/model.d.ts +0 -1
- package/dist/composites/monitored-service.d.ts +0 -1
- package/dist/composites/namespace-env.d.ts +0 -1
- package/dist/composites/network-isolated-app.d.ts +0 -1
- package/dist/composites/node-agent.d.ts +0 -1
- package/dist/composites/operator-stack.d.ts +0 -1
- package/dist/composites/otel-collector-agent.d.ts +0 -1
- package/dist/composites/otel-collector-gateway.d.ts +0 -1
- package/dist/composites/otel-collector-node.d.ts +0 -1
- package/dist/composites/otel-collector-rbac.d.ts +0 -1
- package/dist/composites/otel-collector-shape.d.ts +0 -1
- package/dist/composites/otel-collector.d.ts +0 -1
- package/dist/composites/otel-operator-collector.d.ts +0 -1
- package/dist/composites/ray-cluster.d.ts +0 -1
- package/dist/composites/ray-job.d.ts +0 -1
- package/dist/composites/ray-service.d.ts +0 -1
- package/dist/composites/secure-ingress.d.ts +0 -1
- package/dist/composites/security-context.d.ts +0 -1
- package/dist/composites/sidecar-app.d.ts +0 -1
- package/dist/composites/stateful-app.d.ts +0 -1
- package/dist/composites/vllm-serving-runtime.d.ts +0 -1
- package/dist/composites/web-app.d.ts +0 -1
- package/dist/composites/worker-pool.d.ts +0 -1
- package/dist/composites/workload-identity-sa.d.ts +0 -1
- package/dist/composites/workload-identity-service-account.d.ts +0 -1
- package/dist/config-schema.d.ts +8 -1
- package/dist/config-schema.js +6 -2
- package/dist/config.d.ts +26 -4
- package/dist/coverage.d.ts +0 -1
- package/dist/crd/crd-sources.d.ts +0 -1
- package/dist/crd/loader.d.ts +0 -1
- package/dist/crd/oci-chart.d.ts +0 -1
- package/dist/crd/parser.d.ts +0 -1
- package/dist/crd/parser.js +3 -0
- package/dist/crd/project-codegen.d.ts +0 -1
- package/dist/crd/types.d.ts +0 -1
- package/dist/deep-observe-hooks.d.ts +0 -1
- package/dist/deep-observe.d.ts +0 -1
- package/dist/default-labels.d.ts +0 -1
- package/dist/describe-resources.d.ts +0 -1
- package/dist/describe-stack-status.d.ts +0 -1
- package/dist/detect.d.ts +0 -1
- package/dist/effect-receipt-row.d.ts +0 -1
- package/dist/export-resources.d.ts +0 -1
- package/dist/generated/index.d.ts +0 -1
- package/{src → dist}/generated/lexicon-k8s.json +1984 -155
- package/dist/generated/runtime.d.ts +0 -1
- package/dist/group-namespace.d.ts +0 -1
- package/dist/helm-references.d.ts +112 -0
- package/dist/helm-references.js +389 -0
- package/dist/import/directory.d.ts +7 -0
- package/dist/import/directory.js +103 -0
- package/dist/import/embedded.d.ts +3 -1
- package/dist/import/embedded.js +34 -0
- package/dist/import/generator.d.ts +13 -5
- package/dist/import/generator.js +43 -57
- package/dist/import/live-export.d.ts +0 -1
- package/dist/import/parser.d.ts +0 -1
- package/dist/import/parser.js +62 -6
- package/dist/import/testdata/embedded/fixtures.d.ts +0 -1
- package/dist/import/typed-classes.d.ts +76 -0
- package/dist/import/typed-classes.js +164 -0
- package/dist/include/entity.d.ts +0 -1
- package/dist/include/resolve.d.ts +0 -1
- package/dist/index-identity.d.ts +0 -1
- package/dist/index-import.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/integrity.json +44 -42
- package/dist/kube/apply.d.ts +0 -1
- package/dist/kube/connect.d.ts +0 -1
- package/dist/kube/delete.d.ts +0 -1
- package/dist/kube/describe.d.ts +0 -1
- package/dist/kube/events.d.ts +0 -1
- package/dist/kube/flags.d.ts +0 -1
- package/dist/kube/get.d.ts +0 -1
- package/dist/kube/group.d.ts +0 -1
- package/dist/kube/logs.d.ts +0 -1
- package/dist/kube/project.d.ts +0 -1
- package/dist/kube/render.d.ts +0 -1
- package/dist/kube/source.d.ts +0 -1
- package/dist/kube/target.d.ts +0 -1
- package/dist/kube/testing.d.ts +0 -1
- package/dist/kube/top.d.ts +0 -1
- package/dist/kube/verdict.d.ts +0 -1
- package/dist/kube/wait.d.ts +0 -1
- package/dist/kustomize/render.d.ts +41 -3
- package/dist/kustomize/render.js +114 -7
- package/dist/kustomize/rendered-entity.d.ts +0 -1
- package/dist/kustomize/root.d.ts +3 -4
- package/dist/kustomize/root.js +6 -1
- package/dist/lint/audit-catalog.d.ts +0 -1
- package/dist/lint/audit-catalog.js +1 -0
- package/dist/lint/audit-lineage.d.ts +0 -1
- package/dist/lint/post-synth/argo-helpers.d.ts +3 -1
- package/dist/lint/post-synth/argo-helpers.js +8 -2
- package/dist/lint/post-synth/argo002.d.ts +0 -1
- package/dist/lint/post-synth/argo002.js +2 -1
- package/dist/lint/post-synth/argo003.d.ts +0 -1
- package/dist/lint/post-synth/argo003.js +2 -1
- package/dist/lint/post-synth/argo005.d.ts +0 -1
- package/dist/lint/post-synth/argo005.js +36 -9
- package/dist/lint/post-synth/crd-schema-helpers.d.ts +1 -2
- package/dist/lint/post-synth/crd-schema-helpers.js +3 -3
- package/dist/lint/post-synth/flux002.d.ts +0 -1
- package/dist/lint/post-synth/flux002.js +2 -1
- package/dist/lint/post-synth/flux003.d.ts +0 -1
- package/dist/lint/post-synth/flux003.js +2 -1
- package/dist/lint/post-synth/index.d.ts +0 -1
- package/dist/lint/post-synth/index.js +2 -0
- package/dist/lint/post-synth/k8s-helpers.d.ts +32 -1
- package/dist/lint/post-synth/k8s-helpers.js +57 -10
- package/dist/lint/post-synth/monitoring-selection-helpers.d.ts +0 -1
- package/dist/lint/post-synth/otel-placement-helpers.d.ts +0 -1
- package/dist/lint/post-synth/sops-helpers.d.ts +0 -1
- package/dist/lint/post-synth/top-level-fields-helpers.d.ts +16 -0
- package/dist/lint/post-synth/top-level-fields-helpers.js +45 -0
- package/dist/lint/post-synth/wk8005.d.ts +9 -1
- package/dist/lint/post-synth/wk8005.js +53 -3
- package/dist/lint/post-synth/wk8006.d.ts +0 -1
- package/dist/lint/post-synth/wk8006.js +4 -2
- package/dist/lint/post-synth/wk8041.d.ts +0 -1
- package/dist/lint/post-synth/wk8041.js +3 -2
- package/dist/lint/post-synth/wk8042.d.ts +0 -1
- package/dist/lint/post-synth/wk8042.js +2 -2
- package/dist/lint/post-synth/wk8101.d.ts +0 -1
- package/dist/lint/post-synth/wk8101.js +2 -2
- package/dist/lint/post-synth/wk8102.d.ts +0 -1
- package/dist/lint/post-synth/wk8102.js +7 -3
- package/dist/lint/post-synth/wk8103.d.ts +0 -1
- package/dist/lint/post-synth/wk8103.js +3 -2
- package/dist/lint/post-synth/wk8104.d.ts +0 -1
- package/dist/lint/post-synth/wk8104.js +3 -2
- package/dist/lint/post-synth/wk8105.d.ts +0 -1
- package/dist/lint/post-synth/wk8105.js +3 -2
- package/dist/lint/post-synth/wk8201.d.ts +0 -1
- package/dist/lint/post-synth/wk8201.js +3 -2
- package/dist/lint/post-synth/wk8202.d.ts +0 -1
- package/dist/lint/post-synth/wk8202.js +3 -2
- package/dist/lint/post-synth/wk8203.d.ts +0 -1
- package/dist/lint/post-synth/wk8203.js +3 -2
- package/dist/lint/post-synth/wk8204.d.ts +0 -1
- package/dist/lint/post-synth/wk8204.js +5 -2
- package/dist/lint/post-synth/wk8205.d.ts +0 -1
- package/dist/lint/post-synth/wk8205.js +3 -2
- package/dist/lint/post-synth/wk8207.d.ts +0 -1
- package/dist/lint/post-synth/wk8207.js +2 -2
- package/dist/lint/post-synth/wk8208.d.ts +0 -1
- package/dist/lint/post-synth/wk8208.js +2 -2
- package/dist/lint/post-synth/wk8209.d.ts +0 -1
- package/dist/lint/post-synth/wk8209.js +2 -2
- package/dist/lint/post-synth/wk8301.d.ts +0 -1
- package/dist/lint/post-synth/wk8301.js +3 -2
- package/dist/lint/post-synth/wk8302.d.ts +0 -1
- package/dist/lint/post-synth/wk8302.js +2 -2
- package/dist/lint/post-synth/wk8303.d.ts +0 -1
- package/dist/lint/post-synth/wk8303.js +2 -2
- package/dist/lint/post-synth/wk8304.d.ts +0 -1
- package/dist/lint/post-synth/wk8304.js +2 -2
- package/dist/lint/post-synth/wk8305.d.ts +0 -1
- package/dist/lint/post-synth/wk8305.js +2 -2
- package/dist/lint/post-synth/wk8306.d.ts +0 -1
- package/dist/lint/post-synth/wk8306.js +3 -2
- package/dist/lint/post-synth/wk8401.d.ts +0 -1
- package/dist/lint/post-synth/wk8401.js +2 -2
- package/dist/lint/post-synth/wk8402.d.ts +0 -1
- package/dist/lint/post-synth/wk8402.js +2 -2
- package/dist/lint/post-synth/wk8403.d.ts +0 -1
- package/dist/lint/post-synth/wk8403.js +2 -2
- package/dist/lint/post-synth/wk8404.d.ts +0 -1
- package/dist/lint/post-synth/wk8404.js +2 -2
- package/dist/lint/post-synth/wk8405.d.ts +0 -1
- package/dist/lint/post-synth/wk8405.js +2 -2
- package/dist/lint/post-synth/wk8406.d.ts +0 -1
- package/dist/lint/post-synth/wk8406.js +3 -2
- package/dist/lint/post-synth/wk8407.d.ts +0 -1
- package/dist/lint/post-synth/wk8407.js +2 -2
- package/dist/lint/post-synth/wk8501.d.ts +0 -1
- package/dist/lint/post-synth/wk8502.d.ts +0 -1
- package/dist/lint/post-synth/wk8503.d.ts +0 -1
- package/dist/lint/post-synth/wk8503.js +2 -2
- package/dist/lint/post-synth/wk8504.d.ts +0 -1
- package/dist/lint/post-synth/wk8505.d.ts +0 -1
- package/dist/lint/post-synth/wk8506.d.ts +14 -0
- package/dist/lint/post-synth/wk8506.js +38 -0
- package/dist/lint/post-synth/wk8601.d.ts +0 -1
- package/dist/lint/post-synth/wk8602.d.ts +0 -1
- package/dist/lint/post-synth/wk8603.d.ts +0 -1
- package/dist/lint/post-synth/wk8604.d.ts +0 -1
- package/dist/lint/post-synth/wk8605.d.ts +0 -1
- package/dist/lint/post-synth/wk8606.d.ts +0 -1
- package/dist/lint/post-synth/wk8701.d.ts +0 -1
- package/dist/lint/post-synth/wk8702.d.ts +0 -1
- package/dist/lint/post-synth/wk8703.d.ts +0 -1
- package/dist/lint/post-synth/wk8704.d.ts +0 -1
- package/dist/lint/post-synth/wk8705.d.ts +0 -1
- package/dist/lint/rules/argo-appset-single-project.d.ts +0 -1
- package/dist/lint/rules/argo-ast.d.ts +0 -1
- package/dist/lint/rules/argo-automated-prune.d.ts +0 -1
- package/dist/lint/rules/flux-source-ref-pin.d.ts +0 -1
- package/dist/lint/rules/hardcoded-namespace.d.ts +0 -1
- package/dist/lint/rules/latest-image-tag.d.ts +0 -1
- package/dist/lint/rules/missing-resource-limits.d.ts +0 -1
- package/dist/listed-types.d.ts +0 -1
- package/dist/lsp/completions.d.ts +0 -1
- package/dist/lsp/hover.d.ts +0 -1
- package/dist/manifest-entity.d.ts +0 -1
- package/dist/manifest-files.d.ts +16 -0
- package/dist/manifest-files.js +24 -0
- package/dist/manifest.json +1 -1
- package/dist/meta.json +1984 -155
- package/dist/micro-time.d.ts +0 -1
- package/dist/okf/index.md +1 -0
- package/dist/okf/rules/WK8506.md +11 -0
- package/dist/op/activities/apply-diff.d.ts +0 -1
- package/dist/op/activities/argo.d.ts +0 -1
- package/dist/op/activities/ensure-secret.d.ts +0 -1
- package/dist/op/activities/index.d.ts +0 -1
- package/dist/op/activities/kubectl.d.ts +0 -1
- package/dist/op/activities/wait-for-ready.d.ts +0 -1
- package/dist/op/builders.d.ts +0 -1
- package/dist/package-cli.d.ts +0 -1
- package/dist/patch/json-patch.d.ts +0 -1
- package/dist/patch/rendered-patch.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plugin.js +2 -0
- package/dist/project-kinds.d.ts +0 -1
- package/dist/receipt-store.d.ts +0 -1
- package/dist/reference-catalog.d.ts +3 -2
- 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/top-level-fields-helpers.ts +54 -0
- 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/rules/wk8506.ts +43 -0
- package/dist/secret-labels.d.ts +0 -1
- package/dist/secret-store.d.ts +0 -1
- package/dist/serializer.d.ts +0 -1
- package/dist/sops/encrypted-secret-file.d.ts +0 -1
- package/dist/sops/entity.d.ts +0 -1
- package/dist/spec/fetch.d.ts +0 -1
- package/dist/spec/parse.d.ts +6 -1
- package/dist/spec/parse.js +1 -0
- package/dist/subscribe-changes.d.ts +0 -1
- package/dist/teardown.d.ts +0 -1
- package/dist/telemetry-release.d.ts +0 -1
- package/dist/top-level-fields.d.ts +24 -0
- package/dist/top-level-fields.js +35 -0
- package/dist/validate-cli.d.ts +0 -1
- package/dist/validate.d.ts +0 -1
- package/dist/variables.d.ts +0 -1
- package/dist/whoami.d.ts +0 -1
- package/dist/workspace-member.d.ts +15 -4
- package/dist/workspace-member.js +143 -21
- package/package.json +6 -7
- package/workspace-kinds.json +45 -6
- package/dist/actions/apps.d.ts.map +0 -1
- package/dist/actions/batch.d.ts.map +0 -1
- package/dist/actions/core.d.ts.map +0 -1
- package/dist/actions/index.d.ts.map +0 -1
- package/dist/actions/networking.d.ts.map +0 -1
- package/dist/actions/rbac.d.ts.map +0 -1
- package/dist/api/classify.d.ts.map +0 -1
- package/dist/api/connect.d.ts.map +0 -1
- package/dist/api/fake-cluster.d.ts.map +0 -1
- package/dist/api/operation-surface.d.ts.map +0 -1
- package/dist/api/owner-chain.d.ts.map +0 -1
- package/dist/api/sweep-types.d.ts.map +0 -1
- package/dist/behaviour-kinds.d.ts.map +0 -1
- package/dist/codegen/docs-cli.d.ts.map +0 -1
- package/dist/codegen/docs.d.ts.map +0 -1
- package/dist/codegen/generate-cli.d.ts.map +0 -1
- package/dist/codegen/generate-lexicon.d.ts.map +0 -1
- package/dist/codegen/generate-list-map-keys.d.ts.map +0 -1
- package/dist/codegen/generate-operations.d.ts.map +0 -1
- package/dist/codegen/generate-typescript.d.ts.map +0 -1
- package/dist/codegen/generate.d.ts.map +0 -1
- package/dist/codegen/naming.d.ts.map +0 -1
- package/dist/codegen/package.d.ts.map +0 -1
- package/dist/codegen/patches.d.ts.map +0 -1
- package/dist/codegen/typecheck.d.ts.map +0 -1
- package/dist/codegen/versions.d.ts.map +0 -1
- package/dist/components/argo-app.d.ts.map +0 -1
- package/dist/components/builders.d.ts.map +0 -1
- package/dist/components/capability-plugin.d.ts.map +0 -1
- package/dist/components/flux-reconcile.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/kubectl-apply.d.ts.map +0 -1
- package/dist/components/kustomize-apply.d.ts.map +0 -1
- package/dist/composites/adot-collector.d.ts.map +0 -1
- package/dist/composites/agic-ingress.d.ts.map +0 -1
- package/dist/composites/aks-external-dns-agent.d.ts.map +0 -1
- package/dist/composites/alb-ingress.d.ts.map +0 -1
- package/dist/composites/argo-app.d.ts.map +0 -1
- package/dist/composites/autoscaled-service.d.ts.map +0 -1
- package/dist/composites/azure-disk-storage-class.d.ts.map +0 -1
- package/dist/composites/azure-file-storage-class.d.ts.map +0 -1
- package/dist/composites/azure-monitor-collector.d.ts.map +0 -1
- package/dist/composites/batch-job.d.ts.map +0 -1
- package/dist/composites/catalog.d.ts.map +0 -1
- package/dist/composites/cockroachdb-cluster.d.ts.map +0 -1
- package/dist/composites/cockroachdb-region-stack.d.ts.map +0 -1
- package/dist/composites/config-connector-context.d.ts.map +0 -1
- package/dist/composites/configured-app.d.ts.map +0 -1
- package/dist/composites/cron-schedule.d.ts.map +0 -1
- package/dist/composites/cron-workload.d.ts.map +0 -1
- package/dist/composites/ebs-storage-class.d.ts.map +0 -1
- package/dist/composites/efs-storage-class.d.ts.map +0 -1
- package/dist/composites/external-dns-agent.d.ts.map +0 -1
- package/dist/composites/filestore-storage-class.d.ts.map +0 -1
- package/dist/composites/fluent-bit-agent.d.ts.map +0 -1
- package/dist/composites/flux-app.d.ts.map +0 -1
- package/dist/composites/gce-ingress.d.ts.map +0 -1
- package/dist/composites/gce-pd-storage-class.d.ts.map +0 -1
- package/dist/composites/gke-external-dns-agent.d.ts.map +0 -1
- package/dist/composites/gke-fluent-bit-agent.d.ts.map +0 -1
- package/dist/composites/gke-gateway.d.ts.map +0 -1
- package/dist/composites/gke-otel-collector.d.ts.map +0 -1
- package/dist/composites/index.d.ts.map +0 -1
- package/dist/composites/inference-service.d.ts.map +0 -1
- package/dist/composites/irsa-service-account.d.ts.map +0 -1
- package/dist/composites/member-defaults.d.ts.map +0 -1
- package/dist/composites/metrics-server.d.ts.map +0 -1
- package/dist/composites/model.d.ts.map +0 -1
- package/dist/composites/monitored-service.d.ts.map +0 -1
- package/dist/composites/namespace-env.d.ts.map +0 -1
- package/dist/composites/network-isolated-app.d.ts.map +0 -1
- package/dist/composites/node-agent.d.ts.map +0 -1
- package/dist/composites/operator-stack.d.ts.map +0 -1
- package/dist/composites/otel-collector-agent.d.ts.map +0 -1
- package/dist/composites/otel-collector-gateway.d.ts.map +0 -1
- package/dist/composites/otel-collector-node.d.ts.map +0 -1
- package/dist/composites/otel-collector-rbac.d.ts.map +0 -1
- package/dist/composites/otel-collector-shape.d.ts.map +0 -1
- package/dist/composites/otel-collector.d.ts.map +0 -1
- package/dist/composites/otel-operator-collector.d.ts.map +0 -1
- package/dist/composites/ray-cluster.d.ts.map +0 -1
- package/dist/composites/ray-job.d.ts.map +0 -1
- package/dist/composites/ray-service.d.ts.map +0 -1
- package/dist/composites/secure-ingress.d.ts.map +0 -1
- package/dist/composites/security-context.d.ts.map +0 -1
- package/dist/composites/sidecar-app.d.ts.map +0 -1
- package/dist/composites/stateful-app.d.ts.map +0 -1
- package/dist/composites/vllm-serving-runtime.d.ts.map +0 -1
- package/dist/composites/web-app.d.ts.map +0 -1
- package/dist/composites/worker-pool.d.ts.map +0 -1
- package/dist/composites/workload-identity-sa.d.ts.map +0 -1
- package/dist/composites/workload-identity-service-account.d.ts.map +0 -1
- package/dist/config-schema.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/coverage.d.ts.map +0 -1
- package/dist/crd/crd-sources.d.ts.map +0 -1
- package/dist/crd/loader.d.ts.map +0 -1
- package/dist/crd/oci-chart.d.ts.map +0 -1
- package/dist/crd/parser.d.ts.map +0 -1
- package/dist/crd/project-codegen.d.ts.map +0 -1
- package/dist/crd/types.d.ts.map +0 -1
- package/dist/deep-observe-hooks.d.ts.map +0 -1
- package/dist/deep-observe.d.ts.map +0 -1
- package/dist/default-labels.d.ts.map +0 -1
- package/dist/describe-resources.d.ts.map +0 -1
- package/dist/describe-stack-status.d.ts.map +0 -1
- package/dist/detect.d.ts.map +0 -1
- package/dist/effect-receipt-row.d.ts.map +0 -1
- package/dist/export-resources.d.ts.map +0 -1
- package/dist/generated/index.d.ts.map +0 -1
- package/dist/generated/runtime.d.ts.map +0 -1
- package/dist/group-namespace.d.ts.map +0 -1
- package/dist/import/embedded.d.ts.map +0 -1
- package/dist/import/generator.d.ts.map +0 -1
- package/dist/import/live-export.d.ts.map +0 -1
- package/dist/import/parser.d.ts.map +0 -1
- package/dist/import/testdata/embedded/fixtures.d.ts.map +0 -1
- package/dist/include/entity.d.ts.map +0 -1
- package/dist/include/resolve.d.ts.map +0 -1
- package/dist/index-identity.d.ts.map +0 -1
- package/dist/index-import.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/kube/apply.d.ts.map +0 -1
- package/dist/kube/connect.d.ts.map +0 -1
- package/dist/kube/delete.d.ts.map +0 -1
- package/dist/kube/describe.d.ts.map +0 -1
- package/dist/kube/events.d.ts.map +0 -1
- package/dist/kube/flags.d.ts.map +0 -1
- package/dist/kube/get.d.ts.map +0 -1
- package/dist/kube/group.d.ts.map +0 -1
- package/dist/kube/logs.d.ts.map +0 -1
- package/dist/kube/project.d.ts.map +0 -1
- package/dist/kube/render.d.ts.map +0 -1
- package/dist/kube/source.d.ts.map +0 -1
- package/dist/kube/target.d.ts.map +0 -1
- package/dist/kube/testing.d.ts.map +0 -1
- package/dist/kube/top.d.ts.map +0 -1
- package/dist/kube/verdict.d.ts.map +0 -1
- package/dist/kube/wait.d.ts.map +0 -1
- package/dist/kustomize/render.d.ts.map +0 -1
- package/dist/kustomize/rendered-entity.d.ts.map +0 -1
- package/dist/kustomize/root.d.ts.map +0 -1
- package/dist/lint/audit-catalog.d.ts.map +0 -1
- package/dist/lint/audit-lineage.d.ts.map +0 -1
- package/dist/lint/post-synth/argo-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/argo002.d.ts.map +0 -1
- package/dist/lint/post-synth/argo003.d.ts.map +0 -1
- package/dist/lint/post-synth/argo005.d.ts.map +0 -1
- package/dist/lint/post-synth/crd-schema-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/flux002.d.ts.map +0 -1
- package/dist/lint/post-synth/flux003.d.ts.map +0 -1
- package/dist/lint/post-synth/index.d.ts.map +0 -1
- package/dist/lint/post-synth/k8s-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/monitoring-selection-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/otel-placement-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/sops-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8005.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8006.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8041.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8042.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8101.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8102.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8103.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8104.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8105.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8201.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8202.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8203.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8204.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8205.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8207.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8208.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8209.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8301.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8302.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8303.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8304.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8305.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8306.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8401.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8402.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8403.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8404.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8405.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8406.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8407.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8501.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8502.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8503.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8504.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8505.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8601.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8602.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8603.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8604.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8605.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8606.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8701.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8702.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8703.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8704.d.ts.map +0 -1
- package/dist/lint/post-synth/wk8705.d.ts.map +0 -1
- package/dist/lint/rules/argo-appset-single-project.d.ts.map +0 -1
- package/dist/lint/rules/argo-ast.d.ts.map +0 -1
- package/dist/lint/rules/argo-automated-prune.d.ts.map +0 -1
- package/dist/lint/rules/flux-source-ref-pin.d.ts.map +0 -1
- package/dist/lint/rules/hardcoded-namespace.d.ts.map +0 -1
- package/dist/lint/rules/latest-image-tag.d.ts.map +0 -1
- package/dist/lint/rules/missing-resource-limits.d.ts.map +0 -1
- package/dist/listed-types.d.ts.map +0 -1
- package/dist/lsp/completions.d.ts.map +0 -1
- package/dist/lsp/hover.d.ts.map +0 -1
- package/dist/manifest-entity.d.ts.map +0 -1
- package/dist/micro-time.d.ts.map +0 -1
- package/dist/op/activities/apply-diff.d.ts.map +0 -1
- package/dist/op/activities/argo.d.ts.map +0 -1
- package/dist/op/activities/ensure-secret.d.ts.map +0 -1
- package/dist/op/activities/index.d.ts.map +0 -1
- package/dist/op/activities/kubectl.d.ts.map +0 -1
- package/dist/op/activities/wait-for-ready.d.ts.map +0 -1
- package/dist/op/builders.d.ts.map +0 -1
- package/dist/package-cli.d.ts.map +0 -1
- package/dist/patch/json-patch.d.ts.map +0 -1
- package/dist/patch/rendered-patch.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/project-kinds.d.ts.map +0 -1
- package/dist/receipt-store.d.ts.map +0 -1
- package/dist/reference-catalog.d.ts.map +0 -1
- package/dist/secret-labels.d.ts.map +0 -1
- package/dist/secret-store.d.ts.map +0 -1
- package/dist/serializer.d.ts.map +0 -1
- package/dist/sops/encrypted-secret-file.d.ts.map +0 -1
- package/dist/sops/entity.d.ts.map +0 -1
- package/dist/spec/fetch.d.ts.map +0 -1
- package/dist/spec/parse.d.ts.map +0 -1
- package/dist/subscribe-changes.d.ts.map +0 -1
- package/dist/teardown.d.ts.map +0 -1
- package/dist/telemetry-release.d.ts.map +0 -1
- package/dist/validate-cli.d.ts.map +0 -1
- package/dist/validate.d.ts.map +0 -1
- package/dist/variables.d.ts.map +0 -1
- package/dist/whoami.d.ts.map +0 -1
- package/dist/workspace-member.d.ts.map +0 -1
- package/src/actions/actions.test.ts +0 -83
- package/src/actions/apps.ts +0 -23
- package/src/actions/batch.ts +0 -9
- package/src/actions/core.ts +0 -62
- package/src/actions/index.ts +0 -50
- package/src/actions/networking.ts +0 -15
- package/src/actions/rbac.ts +0 -13
- package/src/api/classify.test.ts +0 -170
- package/src/api/classify.ts +0 -154
- package/src/api/connect.ts +0 -104
- package/src/api/fake-cluster.ts +0 -231
- package/src/api/operation-surface.test.ts +0 -116
- package/src/api/operation-surface.ts +0 -130
- package/src/api/owner-chain.test.ts +0 -171
- package/src/api/owner-chain.ts +0 -144
- package/src/api/sweep-types.ts +0 -35
- package/src/behaviour-kinds.ts +0 -88
- package/src/codegen/declarations.test.ts +0 -118
- package/src/codegen/docs-cli.ts +0 -3
- package/src/codegen/docs.ts +0 -156
- package/src/codegen/generate-cli.ts +0 -41
- package/src/codegen/generate-crd-sources.test.ts +0 -49
- package/src/codegen/generate-lexicon.ts +0 -105
- package/src/codegen/generate-list-map-keys.test.ts +0 -112
- package/src/codegen/generate-list-map-keys.ts +0 -99
- package/src/codegen/generate-operations.ts +0 -56
- package/src/codegen/generate-typescript.ts +0 -162
- package/src/codegen/generate.ts +0 -231
- package/src/codegen/naming.test.ts +0 -63
- package/src/codegen/naming.ts +0 -201
- package/src/codegen/package.ts +0 -53
- package/src/codegen/patches.ts +0 -108
- package/src/codegen/snapshot.test.ts +0 -115
- package/src/codegen/typecheck.test.ts +0 -24
- package/src/codegen/typecheck.ts +0 -4
- package/src/codegen/versions.ts +0 -50
- package/src/components/argo-app.test.ts +0 -137
- package/src/components/argo-app.ts +0 -163
- package/src/components/builders.ts +0 -30
- package/src/components/capability-plugin.test.ts +0 -20
- package/src/components/capability-plugin.ts +0 -44
- package/src/components/flux-reconcile.test.ts +0 -145
- package/src/components/flux-reconcile.ts +0 -159
- package/src/components/index.ts +0 -44
- package/src/components/kubectl-apply-plan.k3d.e2e.test.ts +0 -127
- package/src/components/kubectl-apply.test.ts +0 -465
- package/src/components/kubectl-apply.ts +0 -570
- package/src/components/kustomize-apply.test.ts +0 -98
- package/src/components/kustomize-apply.ts +0 -104
- package/src/composites/__snapshots__/gke-otel-collector.snapshot.test.ts.snap +0 -335
- package/src/composites/adot-collector.ts +0 -258
- package/src/composites/agic-ingress.ts +0 -157
- package/src/composites/aks-external-dns-agent.ts +0 -211
- package/src/composites/alb-ingress.ts +0 -161
- package/src/composites/argo-app.ts +0 -381
- package/src/composites/autoscaled-service.ts +0 -293
- package/src/composites/azure-disk-storage-class.ts +0 -91
- package/src/composites/azure-file-storage-class.ts +0 -86
- package/src/composites/azure-monitor-collector.ts +0 -245
- package/src/composites/batch-job.ts +0 -230
- package/src/composites/catalog.test.ts +0 -39
- package/src/composites/catalog.ts +0 -4115
- package/src/composites/cockroachdb-cluster.ts +0 -528
- package/src/composites/cockroachdb-region-stack.ts +0 -553
- package/src/composites/composites.test.ts +0 -4291
- package/src/composites/config-connector-context.ts +0 -69
- package/src/composites/configured-app.ts +0 -231
- package/src/composites/cron-schedule.ts +0 -47
- package/src/composites/cron-workload.ts +0 -182
- package/src/composites/ebs-storage-class.ts +0 -105
- package/src/composites/efs-storage-class.ts +0 -86
- package/src/composites/external-dns-agent.ts +0 -181
- package/src/composites/filestore-storage-class.ts +0 -88
- package/src/composites/fluent-bit-agent.ts +0 -227
- package/src/composites/flux-app.ts +0 -298
- package/src/composites/gce-ingress.ts +0 -152
- package/src/composites/gce-pd-storage-class.ts +0 -94
- package/src/composites/gke-external-dns-agent.ts +0 -189
- package/src/composites/gke-fluent-bit-agent.ts +0 -232
- package/src/composites/gke-gateway.ts +0 -150
- package/src/composites/gke-otel-collector.snapshot.test.ts +0 -53
- package/src/composites/gke-otel-collector.ts +0 -156
- package/src/composites/index.ts +0 -133
- package/src/composites/inference-service.ts +0 -141
- package/src/composites/irsa-service-account.ts +0 -123
- package/src/composites/member-defaults.test.ts +0 -63
- package/src/composites/member-defaults.ts +0 -29
- package/src/composites/metrics-server.ts +0 -240
- package/src/composites/model.ts +0 -151
- package/src/composites/monitored-service.ts +0 -252
- package/src/composites/namespace-env.ts +0 -173
- package/src/composites/network-isolated-app.ts +0 -208
- package/src/composites/node-agent.ts +0 -242
- package/src/composites/operator-stack.ts +0 -387
- package/src/composites/otel-collector-agent.ts +0 -230
- package/src/composites/otel-collector-gateway.test.ts +0 -380
- package/src/composites/otel-collector-gateway.ts +0 -404
- package/src/composites/otel-collector-node.test.ts +0 -193
- package/src/composites/otel-collector-node.ts +0 -211
- package/src/composites/otel-collector-rbac.test.ts +0 -125
- package/src/composites/otel-collector-rbac.ts +0 -146
- package/src/composites/otel-collector-shape.ts +0 -163
- package/src/composites/otel-collector.ts +0 -209
- package/src/composites/otel-operator-collector.test.ts +0 -267
- package/src/composites/otel-operator-collector.ts +0 -221
- package/src/composites/ray-cluster.ts +0 -591
- package/src/composites/ray-job.ts +0 -236
- package/src/composites/ray-service.ts +0 -272
- package/src/composites/secure-ingress.ts +0 -160
- package/src/composites/security-context.ts +0 -10
- package/src/composites/sidecar-app.ts +0 -213
- package/src/composites/stateful-app.ts +0 -196
- package/src/composites/vllm-serving-runtime.test.ts +0 -167
- package/src/composites/vllm-serving-runtime.ts +0 -197
- package/src/composites/web-app.ts +0 -254
- package/src/composites/worker-pool.ts +0 -279
- package/src/composites/workload-identity-sa.ts +0 -127
- package/src/composites/workload-identity-service-account.ts +0 -123
- package/src/config-augmentation.test.ts +0 -100
- package/src/config-schema.ts +0 -109
- package/src/config.ts +0 -215
- package/src/coverage.test.ts +0 -27
- package/src/coverage.ts +0 -35
- package/src/crd/clickhouse-operators.test.ts +0 -105
- package/src/crd/cnpg.test.ts +0 -191
- package/src/crd/crd-sources.ts +0 -688
- package/src/crd/infisical.test.ts +0 -100
- package/src/crd/loader.test.ts +0 -90
- package/src/crd/loader.ts +0 -214
- package/src/crd/oci-chart.test.ts +0 -149
- package/src/crd/oci-chart.ts +0 -178
- package/src/crd/parser.test.ts +0 -585
- package/src/crd/parser.ts +0 -437
- package/src/crd/project-codegen.e2e.test.ts +0 -239
- package/src/crd/project-codegen.ts +0 -327
- package/src/crd/traefik.test.ts +0 -108
- package/src/crd/types.ts +0 -92
- package/src/deep-observe-hooks.ts +0 -361
- package/src/deep-observe.test.ts +0 -1160
- package/src/deep-observe.ts +0 -290
- package/src/default-labels.test.ts +0 -111
- package/src/default-labels.ts +0 -122
- package/src/describe-resources.test.ts +0 -1873
- package/src/describe-resources.ts +0 -839
- package/src/describe-stack-status.test.ts +0 -169
- package/src/describe-stack-status.ts +0 -143
- package/src/detect.ts +0 -9
- package/src/effect-receipt-row.test.ts +0 -285
- package/src/effect-receipt-row.ts +0 -268
- package/src/export-resources-io.test.ts +0 -97
- package/src/export-resources.ts +0 -72
- package/src/generated/index.d.ts +0 -8909
- package/src/generated/index.ts +0 -1153
- package/src/generated/runtime.ts +0 -4
- package/src/group-namespace.test.ts +0 -99
- package/src/group-namespace.ts +0 -103
- package/src/import/embedded-live.test.ts +0 -180
- package/src/import/embedded-roundtrip.test.ts +0 -298
- package/src/import/embedded-types.e2e.test.ts +0 -45
- package/src/import/embedded.test.ts +0 -189
- package/src/import/embedded.ts +0 -208
- package/src/import/generator.test.ts +0 -140
- package/src/import/generator.ts +0 -374
- package/src/import/live-export.test.ts +0 -114
- package/src/import/live-export.ts +0 -97
- package/src/import/operator-alerting-roundtrip.test.ts +0 -158
- package/src/import/operator-collector-roundtrip.test.ts +0 -105
- package/src/import/parser.test.ts +0 -174
- package/src/import/parser.ts +0 -230
- package/src/import/roundtrip-build.test.ts +0 -133
- package/src/import/roundtrip.test.ts +0 -86
- package/src/import/testdata/embedded/README.md +0 -14
- package/src/import/testdata/embedded/agent-observability.yaml +0 -2905
- package/src/import/testdata/embedded/alertmanager-configmap.yaml +0 -91
- package/src/import/testdata/embedded/fixtures.ts +0 -71
- package/src/import/testdata/embedded/grafana-dashboard-configmap.yaml +0 -364
- package/src/import/testdata/embedded/grafana-operator-dashboard.yaml +0 -363
- package/src/import/testdata/embedded/grafana-v2-dashboard-configmap.yaml +0 -851
- package/src/import/testdata/embedded/node-exporter-prometheusrule.yaml +0 -425
- package/src/import/testdata/embedded/otel-collector-daemonset.yaml +0 -225
- package/src/include/entity.ts +0 -119
- package/src/include/include.test.ts +0 -345
- package/src/include/resolve.ts +0 -204
- package/src/index-identity.ts +0 -119
- package/src/index-import.test.ts +0 -244
- package/src/index-import.ts +0 -181
- package/src/index.ts +0 -172
- package/src/kube/apply.test.ts +0 -105
- package/src/kube/apply.ts +0 -106
- package/src/kube/connect.ts +0 -55
- package/src/kube/delete.test.ts +0 -123
- package/src/kube/delete.ts +0 -174
- package/src/kube/describe.test.ts +0 -106
- package/src/kube/describe.ts +0 -195
- package/src/kube/events.test.ts +0 -115
- package/src/kube/events.ts +0 -160
- package/src/kube/flags.test.ts +0 -65
- package/src/kube/flags.ts +0 -114
- package/src/kube/get.test.ts +0 -195
- package/src/kube/get.ts +0 -190
- package/src/kube/group.test.ts +0 -33
- package/src/kube/group.ts +0 -125
- package/src/kube/logs.test.ts +0 -126
- package/src/kube/logs.ts +0 -96
- package/src/kube/project.test.ts +0 -57
- package/src/kube/project.ts +0 -106
- package/src/kube/render.test.ts +0 -142
- package/src/kube/render.ts +0 -252
- package/src/kube/source.test.ts +0 -138
- package/src/kube/source.ts +0 -139
- package/src/kube/target.test.ts +0 -67
- package/src/kube/target.ts +0 -89
- package/src/kube/testing.ts +0 -42
- package/src/kube/top.test.ts +0 -149
- package/src/kube/top.ts +0 -120
- package/src/kube/verdict.test.ts +0 -48
- package/src/kube/verdict.ts +0 -77
- package/src/kube/wait.test.ts +0 -125
- package/src/kube/wait.ts +0 -160
- package/src/kustomize/render.ts +0 -96
- package/src/kustomize/rendered-entity.ts +0 -82
- package/src/kustomize/root.test.ts +0 -309
- package/src/kustomize/root.ts +0 -95
- package/src/kustomize/search.test.ts +0 -101
- package/src/lifecycle-integration.test.ts +0 -325
- package/src/lint/audit-catalog.ts +0 -63
- package/src/lint/audit-lineage.ts +0 -127
- package/src/lint/post-synth/argo-helpers.ts +0 -47
- package/src/lint/post-synth/argo002.ts +0 -47
- package/src/lint/post-synth/argo003.ts +0 -80
- package/src/lint/post-synth/argo005.ts +0 -59
- package/src/lint/post-synth/crd-schema-helpers.ts +0 -235
- package/src/lint/post-synth/flux002.ts +0 -77
- package/src/lint/post-synth/flux003.ts +0 -75
- package/src/lint/post-synth/index.ts +0 -107
- package/src/lint/post-synth/k8s-helpers.test.ts +0 -236
- package/src/lint/post-synth/k8s-helpers.ts +0 -251
- package/src/lint/post-synth/monitoring-selection-helpers.ts +0 -185
- package/src/lint/post-synth/monitoring-selection.test.ts +0 -316
- package/src/lint/post-synth/otel-placement-helpers.ts +0 -333
- package/src/lint/post-synth/otel-placement.test.ts +0 -450
- package/src/lint/post-synth/post-synth.test.ts +0 -2798
- package/src/lint/post-synth/sops-helpers.ts +0 -76
- package/src/lint/post-synth/wk8005.ts +0 -54
- package/src/lint/post-synth/wk8006.ts +0 -63
- package/src/lint/post-synth/wk8041.ts +0 -68
- package/src/lint/post-synth/wk8042.ts +0 -43
- package/src/lint/post-synth/wk8101.ts +0 -60
- package/src/lint/post-synth/wk8102.ts +0 -37
- package/src/lint/post-synth/wk8103.ts +0 -40
- package/src/lint/post-synth/wk8104.ts +0 -64
- package/src/lint/post-synth/wk8105.ts +0 -40
- package/src/lint/post-synth/wk8201.ts +0 -50
- package/src/lint/post-synth/wk8202.ts +0 -41
- package/src/lint/post-synth/wk8203.ts +0 -41
- package/src/lint/post-synth/wk8204.ts +0 -81
- package/src/lint/post-synth/wk8205.ts +0 -51
- package/src/lint/post-synth/wk8207.ts +0 -40
- package/src/lint/post-synth/wk8208.ts +0 -40
- package/src/lint/post-synth/wk8209.ts +0 -40
- package/src/lint/post-synth/wk8301.ts +0 -54
- package/src/lint/post-synth/wk8302.ts +0 -41
- package/src/lint/post-synth/wk8303.ts +0 -93
- package/src/lint/post-synth/wk8304.ts +0 -65
- package/src/lint/post-synth/wk8305.ts +0 -112
- package/src/lint/post-synth/wk8306.ts +0 -45
- package/src/lint/post-synth/wk8401.ts +0 -93
- package/src/lint/post-synth/wk8402.ts +0 -38
- package/src/lint/post-synth/wk8403.ts +0 -55
- package/src/lint/post-synth/wk8404.ts +0 -49
- package/src/lint/post-synth/wk8405.ts +0 -85
- package/src/lint/post-synth/wk8406.ts +0 -55
- package/src/lint/post-synth/wk8407.ts +0 -66
- package/src/lint/post-synth/wk8501.ts +0 -40
- package/src/lint/post-synth/wk8502.ts +0 -39
- package/src/lint/post-synth/wk8503.ts +0 -220
- package/src/lint/post-synth/wk8504.ts +0 -51
- package/src/lint/post-synth/wk8505.ts +0 -65
- package/src/lint/post-synth/wk8601.ts +0 -44
- package/src/lint/post-synth/wk8602.ts +0 -133
- package/src/lint/post-synth/wk8603.ts +0 -66
- package/src/lint/post-synth/wk8604.ts +0 -36
- package/src/lint/post-synth/wk8605.test.ts +0 -153
- package/src/lint/post-synth/wk8605.ts +0 -133
- package/src/lint/post-synth/wk8606.ts +0 -27
- package/src/lint/post-synth/wk8701.ts +0 -37
- package/src/lint/post-synth/wk8702.ts +0 -43
- package/src/lint/post-synth/wk8703.ts +0 -37
- package/src/lint/post-synth/wk8704.ts +0 -134
- package/src/lint/post-synth/wk8705.ts +0 -45
- package/src/lint/rules/argo-appset-single-project.ts +0 -66
- package/src/lint/rules/argo-ast.ts +0 -121
- package/src/lint/rules/argo-automated-prune.ts +0 -75
- package/src/lint/rules/flux-source-ref-pin.ts +0 -52
- package/src/lint/rules/hardcoded-namespace.ts +0 -71
- package/src/lint/rules/latest-image-tag.ts +0 -121
- package/src/lint/rules/missing-resource-limits.ts +0 -111
- package/src/lint/rules/rules.test.ts +0 -421
- package/src/list-map-key-table.test.ts +0 -83
- package/src/list-map-order-key.test.ts +0 -119
- package/src/listed-types.test.ts +0 -76
- package/src/listed-types.ts +0 -70
- package/src/lsp/completions.test.ts +0 -64
- package/src/lsp/completions.ts +0 -21
- package/src/lsp/hover.test.ts +0 -69
- package/src/lsp/hover.ts +0 -69
- package/src/manifest-entity.test.ts +0 -78
- package/src/manifest-entity.ts +0 -82
- package/src/micro-time.test.ts +0 -48
- package/src/micro-time.ts +0 -51
- package/src/op/activities/apply-diff.ts +0 -87
- package/src/op/activities/argo.test.ts +0 -79
- package/src/op/activities/argo.ts +0 -163
- package/src/op/activities/ensure-secret.ts +0 -71
- package/src/op/activities/index.ts +0 -79
- package/src/op/activities/kubectl-plan.test.ts +0 -224
- package/src/op/activities/kubectl.test.ts +0 -662
- package/src/op/activities/kubectl.ts +0 -723
- package/src/op/activities/wait-for-ready.test.ts +0 -260
- package/src/op/activities/wait-for-ready.ts +0 -371
- package/src/op/builders.test.ts +0 -82
- package/src/op/builders.ts +0 -95
- package/src/package-cli.ts +0 -28
- package/src/patch/json-patch.test.ts +0 -91
- package/src/patch/json-patch.ts +0 -189
- package/src/patch/rendered-patch.test.ts +0 -143
- package/src/patch/rendered-patch.ts +0 -180
- package/src/plugin.test.ts +0 -273
- package/src/plugin.ts +0 -827
- package/src/project-kinds.ts +0 -75
- package/src/prometheus-rule-groups.test.ts +0 -135
- package/src/receipt-store.test.ts +0 -380
- package/src/receipt-store.ts +0 -290
- package/src/reference-catalog.test.ts +0 -173
- package/src/reference-catalog.ts +0 -157
- package/src/secret-labels.ts +0 -36
- package/src/secret-store.test.ts +0 -184
- package/src/secret-store.ts +0 -165
- package/src/serializer-ownership.test.ts +0 -44
- package/src/serializer-telemetry.test.ts +0 -146
- package/src/serializer.test.ts +0 -640
- package/src/serializer.ts +0 -655
- package/src/skills/chant-k8s-aks.md +0 -146
- package/src/skills/chant-k8s-argo.md +0 -190
- package/src/skills/chant-k8s-deployment-strategies.md +0 -183
- package/src/skills/chant-k8s-eks.md +0 -171
- package/src/skills/chant-k8s-flux.md +0 -162
- package/src/skills/chant-k8s-gke.md +0 -246
- package/src/skills/chant-k8s-patterns.md +0 -245
- package/src/skills/chant-k8s-ray.md +0 -252
- package/src/skills/chant-k8s-security.md +0 -237
- package/src/skills/chant-k8s.md +0 -307
- package/src/sops/encrypted-secret-file.test.ts +0 -333
- package/src/sops/encrypted-secret-file.ts +0 -264
- package/src/sops/entity.ts +0 -53
- package/src/spec/fetch.test.ts +0 -24
- package/src/spec/fetch.ts +0 -68
- package/src/spec/parse.test.ts +0 -262
- package/src/spec/parse.ts +0 -864
- package/src/subscribe-changes.test.ts +0 -368
- package/src/subscribe-changes.ts +0 -210
- package/src/teardown.test.ts +0 -240
- package/src/teardown.ts +0 -239
- package/src/telemetry-build.test.ts +0 -79
- package/src/telemetry-release.ts +0 -93
- package/src/testdata/include/bundle.yaml +0 -45
- package/src/testdata/indexed/listing.json +0 -67
- package/src/testdata/kustomize-root/base/deployment.yaml +0 -17
- package/src/testdata/kustomize-root/base/kustomization.yaml +0 -3
- package/src/testdata/kustomize-root/base/service.yaml +0 -9
- package/src/testdata/kustomize-root/overlays/prod/kustomization.yaml +0 -6
- package/src/testdata/manifests/configmap.yaml +0 -7
- package/src/testdata/manifests/deployment.yaml +0 -22
- package/src/testdata/manifests/full-app.yaml +0 -61
- package/src/testdata/manifests/secret.yaml +0 -7
- package/src/testdata/manifests/service.yaml +0 -15
- package/src/testdata/sops/db-credentials.sops.yaml +0 -23
- package/src/testdata/workspace-members/argo/guestbook.yaml +0 -28
- package/src/testdata/workspace-members/argo/namespace.yaml +0 -4
- package/src/testdata/workspace-members/flux/apps.yaml +0 -12
- package/src/testdata/workspace-members/flux/kustomization.yaml +0 -4
- package/src/validate-cli.ts +0 -21
- package/src/validate.test.ts +0 -29
- package/src/validate.ts +0 -53
- package/src/variables.ts +0 -36
- package/src/whoami.test.ts +0 -203
- package/src/whoami.ts +0 -122
- package/src/workspace-kinds.test.ts +0 -35
- package/src/workspace-member.test.ts +0 -154
- package/src/workspace-member.ts +0 -128
- /package/{src → dist}/generated/list-map-keys.json +0 -0
- /package/{src → dist}/generated/operations.json +0 -0
|
@@ -1,2798 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "vitest";
|
|
2
|
-
import type { PostSynthContext } from "@intentius/chant/lint/post-synth";
|
|
3
|
-
|
|
4
|
-
// Import all checks
|
|
5
|
-
import { wk8005 } from "./wk8005";
|
|
6
|
-
import { wk8006 } from "./wk8006";
|
|
7
|
-
import { wk8041 } from "./wk8041";
|
|
8
|
-
import { wk8042 } from "./wk8042";
|
|
9
|
-
import { wk8101 } from "./wk8101";
|
|
10
|
-
import { wk8102 } from "./wk8102";
|
|
11
|
-
import { wk8103 } from "./wk8103";
|
|
12
|
-
import { wk8104 } from "./wk8104";
|
|
13
|
-
import { wk8105 } from "./wk8105";
|
|
14
|
-
import { wk8201 } from "./wk8201";
|
|
15
|
-
import { wk8202 } from "./wk8202";
|
|
16
|
-
import { wk8203 } from "./wk8203";
|
|
17
|
-
import { wk8204 } from "./wk8204";
|
|
18
|
-
import { wk8205 } from "./wk8205";
|
|
19
|
-
import { wk8207 } from "./wk8207";
|
|
20
|
-
import { wk8208 } from "./wk8208";
|
|
21
|
-
import { wk8209 } from "./wk8209";
|
|
22
|
-
import { wk8301 } from "./wk8301";
|
|
23
|
-
import { wk8302 } from "./wk8302";
|
|
24
|
-
import { wk8303 } from "./wk8303";
|
|
25
|
-
import { wk8304 } from "./wk8304";
|
|
26
|
-
import { wk8305 } from "./wk8305";
|
|
27
|
-
import { wk8306 } from "./wk8306";
|
|
28
|
-
import { wk8401 } from "./wk8401";
|
|
29
|
-
import { wk8402 } from "./wk8402";
|
|
30
|
-
import { wk8403 } from "./wk8403";
|
|
31
|
-
import { wk8404 } from "./wk8404";
|
|
32
|
-
import { wk8405 } from "./wk8405";
|
|
33
|
-
import { wk8406 } from "./wk8406";
|
|
34
|
-
import { wk8407 } from "./wk8407";
|
|
35
|
-
import { argo002 } from "./argo002";
|
|
36
|
-
import { argo003 } from "./argo003";
|
|
37
|
-
import { argo005 } from "./argo005";
|
|
38
|
-
import { flux002 } from "./flux002";
|
|
39
|
-
import { flux003 } from "./flux003";
|
|
40
|
-
import { wk8501 } from "./wk8501";
|
|
41
|
-
import { wk8502 } from "./wk8502";
|
|
42
|
-
import { wk8503 } from "./wk8503";
|
|
43
|
-
import { wk8504 } from "./wk8504";
|
|
44
|
-
import { wk8505 } from "./wk8505";
|
|
45
|
-
import { declareSecret, type SecretDeclarationInput } from "@intentius/chant/secret-provenance";
|
|
46
|
-
import type { Declarable } from "@intentius/chant/declarable";
|
|
47
|
-
import type { SerializerResult } from "@intentius/chant/serializer";
|
|
48
|
-
import { readFileSync } from "node:fs";
|
|
49
|
-
import { dirname, join } from "node:path";
|
|
50
|
-
import { fileURLToPath } from "node:url";
|
|
51
|
-
import { getCrdSchemaRegistry, setCrdSchemaRegistry, validateSpec } from "./crd-schema-helpers";
|
|
52
|
-
|
|
53
|
-
function makeCtx(yaml: string): PostSynthContext {
|
|
54
|
-
return {
|
|
55
|
-
outputs: new Map([["k8s", yaml]]),
|
|
56
|
-
entities: new Map(),
|
|
57
|
-
buildResult: {
|
|
58
|
-
outputs: new Map([["k8s", yaml]]),
|
|
59
|
-
entities: new Map(),
|
|
60
|
-
warnings: [],
|
|
61
|
-
errors: [],
|
|
62
|
-
sourceFileCount: 1,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** Join several manifests (objects) into a multi-document YAML string. */
|
|
68
|
-
function manifestsCtx(...objs: unknown[]): PostSynthContext {
|
|
69
|
-
return makeCtx(objs.map((o) => JSON.stringify(o)).join("\n---\n"));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ── WK8005: Secrets in env ──────────────────────────────────────────
|
|
73
|
-
// Note: tests with nested container properties (env, resources, securityContext,
|
|
74
|
-
// ports, probes) use JSON format, written when core's parseYAML was a line
|
|
75
|
-
// parser that misread them. It is js-yaml now (#3006), so YAML works too.
|
|
76
|
-
|
|
77
|
-
describe("WK8005: Hardcoded secrets in env", () => {
|
|
78
|
-
test("flags hardcoded password in env", () => {
|
|
79
|
-
const ctx = makeCtx(JSON.stringify({
|
|
80
|
-
apiVersion: "apps/v1",
|
|
81
|
-
kind: "Deployment",
|
|
82
|
-
metadata: { name: "app" },
|
|
83
|
-
spec: {
|
|
84
|
-
template: {
|
|
85
|
-
spec: {
|
|
86
|
-
containers: [
|
|
87
|
-
{ name: "app", image: "app:1.0", env: [{ name: "DB_PASSWORD", value: "secret123" }] },
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
}));
|
|
93
|
-
const diags = wk8005.check(ctx);
|
|
94
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
95
|
-
expect(diags[0].checkId).toBe("WK8005");
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test("passes when env uses secretKeyRef", () => {
|
|
99
|
-
const ctx = makeCtx(JSON.stringify({
|
|
100
|
-
apiVersion: "apps/v1",
|
|
101
|
-
kind: "Deployment",
|
|
102
|
-
metadata: { name: "app" },
|
|
103
|
-
spec: {
|
|
104
|
-
template: {
|
|
105
|
-
spec: {
|
|
106
|
-
containers: [
|
|
107
|
-
{ name: "app", image: "app:1.0", env: [{ name: "DB_PASSWORD", valueFrom: { secretKeyRef: { name: "db-secret", key: "password" } } }] },
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
}));
|
|
113
|
-
const diags = wk8005.check(ctx);
|
|
114
|
-
expect(diags.length).toBe(0);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("passes when env var name is not sensitive", () => {
|
|
118
|
-
const ctx = makeCtx(JSON.stringify({
|
|
119
|
-
apiVersion: "apps/v1",
|
|
120
|
-
kind: "Deployment",
|
|
121
|
-
metadata: { name: "app" },
|
|
122
|
-
spec: {
|
|
123
|
-
template: {
|
|
124
|
-
spec: {
|
|
125
|
-
containers: [
|
|
126
|
-
{ name: "app", image: "app:1.0", env: [{ name: "LOG_LEVEL", value: "info" }] },
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
}));
|
|
132
|
-
const diags = wk8005.check(ctx);
|
|
133
|
-
expect(diags.length).toBe(0);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// ── WK8006: Latest tag ──────────────────────────────────────────────
|
|
138
|
-
|
|
139
|
-
describe("WK8006: Latest/untagged images", () => {
|
|
140
|
-
test("flags image with :latest tag", () => {
|
|
141
|
-
const ctx = makeCtx(`
|
|
142
|
-
apiVersion: apps/v1
|
|
143
|
-
kind: Deployment
|
|
144
|
-
metadata:
|
|
145
|
-
name: app
|
|
146
|
-
spec:
|
|
147
|
-
template:
|
|
148
|
-
spec:
|
|
149
|
-
containers:
|
|
150
|
-
- name: app
|
|
151
|
-
image: nginx:latest
|
|
152
|
-
`);
|
|
153
|
-
const diags = wk8006.check(ctx);
|
|
154
|
-
expect(diags.length).toBe(1);
|
|
155
|
-
expect(diags[0].checkId).toBe("WK8006");
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test("flags untagged image", () => {
|
|
159
|
-
const ctx = makeCtx(`
|
|
160
|
-
apiVersion: apps/v1
|
|
161
|
-
kind: Deployment
|
|
162
|
-
metadata:
|
|
163
|
-
name: app
|
|
164
|
-
spec:
|
|
165
|
-
template:
|
|
166
|
-
spec:
|
|
167
|
-
containers:
|
|
168
|
-
- name: app
|
|
169
|
-
image: nginx
|
|
170
|
-
`);
|
|
171
|
-
const diags = wk8006.check(ctx);
|
|
172
|
-
expect(diags.length).toBe(1);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test("passes for explicitly tagged image", () => {
|
|
176
|
-
const ctx = makeCtx(`
|
|
177
|
-
apiVersion: apps/v1
|
|
178
|
-
kind: Deployment
|
|
179
|
-
metadata:
|
|
180
|
-
name: app
|
|
181
|
-
spec:
|
|
182
|
-
template:
|
|
183
|
-
spec:
|
|
184
|
-
containers:
|
|
185
|
-
- name: app
|
|
186
|
-
image: nginx:1.25
|
|
187
|
-
`);
|
|
188
|
-
const diags = wk8006.check(ctx);
|
|
189
|
-
expect(diags.length).toBe(0);
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
// ── WK8041: API keys ────────────────────────────────────────────────
|
|
194
|
-
|
|
195
|
-
describe("WK8041: API keys in env", () => {
|
|
196
|
-
test("flags Stripe key pattern", () => {
|
|
197
|
-
const ctx = makeCtx(JSON.stringify({
|
|
198
|
-
apiVersion: "apps/v1",
|
|
199
|
-
kind: "Deployment",
|
|
200
|
-
metadata: { name: "app" },
|
|
201
|
-
spec: {
|
|
202
|
-
template: {
|
|
203
|
-
spec: {
|
|
204
|
-
containers: [
|
|
205
|
-
{ name: "app", image: "app:1.0", env: [{ name: "STRIPE_KEY", value: "sk_live_abc123def456" }] },
|
|
206
|
-
],
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
}));
|
|
211
|
-
const diags = wk8041.check(ctx);
|
|
212
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
213
|
-
expect(diags[0].checkId).toBe("WK8041");
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
test("passes for normal values", () => {
|
|
217
|
-
const ctx = makeCtx(JSON.stringify({
|
|
218
|
-
apiVersion: "apps/v1",
|
|
219
|
-
kind: "Deployment",
|
|
220
|
-
metadata: { name: "app" },
|
|
221
|
-
spec: {
|
|
222
|
-
template: {
|
|
223
|
-
spec: {
|
|
224
|
-
containers: [
|
|
225
|
-
{ name: "app", image: "app:1.0", env: [{ name: "APP_MODE", value: "production" }] },
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
}));
|
|
231
|
-
const diags = wk8041.check(ctx);
|
|
232
|
-
expect(diags.length).toBe(0);
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
// ── WK8042: Private keys ───────────────────────────────────────────
|
|
237
|
-
|
|
238
|
-
describe("WK8042: Private keys in manifests", () => {
|
|
239
|
-
test("flags private key in ConfigMap", () => {
|
|
240
|
-
const ctx = makeCtx(JSON.stringify({
|
|
241
|
-
apiVersion: "v1",
|
|
242
|
-
kind: "ConfigMap",
|
|
243
|
-
metadata: { name: "config" },
|
|
244
|
-
data: {
|
|
245
|
-
"cert.pem": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA...\n-----END RSA PRIVATE KEY-----",
|
|
246
|
-
},
|
|
247
|
-
}));
|
|
248
|
-
const diags = wk8042.check(ctx);
|
|
249
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
250
|
-
expect(diags[0].checkId).toBe("WK8042");
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
test("passes for normal ConfigMap data", () => {
|
|
254
|
-
const ctx = makeCtx(JSON.stringify({
|
|
255
|
-
apiVersion: "v1",
|
|
256
|
-
kind: "ConfigMap",
|
|
257
|
-
metadata: { name: "config" },
|
|
258
|
-
data: { "config.json": '{"key": "value"}' },
|
|
259
|
-
}));
|
|
260
|
-
const diags = wk8042.check(ctx);
|
|
261
|
-
expect(diags.length).toBe(0);
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
// ── WK8101: Selector mismatch ──────────────────────────────────────
|
|
266
|
-
|
|
267
|
-
describe("WK8101: Selector must match template labels", () => {
|
|
268
|
-
test("flags when matchLabels != template labels", () => {
|
|
269
|
-
const ctx = makeCtx(`
|
|
270
|
-
apiVersion: apps/v1
|
|
271
|
-
kind: Deployment
|
|
272
|
-
metadata:
|
|
273
|
-
name: app
|
|
274
|
-
spec:
|
|
275
|
-
selector:
|
|
276
|
-
matchLabels:
|
|
277
|
-
app: my-app
|
|
278
|
-
template:
|
|
279
|
-
metadata:
|
|
280
|
-
labels:
|
|
281
|
-
app: different-app
|
|
282
|
-
spec:
|
|
283
|
-
containers:
|
|
284
|
-
- name: app
|
|
285
|
-
image: app:1.0
|
|
286
|
-
`);
|
|
287
|
-
const diags = wk8101.check(ctx);
|
|
288
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
289
|
-
expect(diags[0].checkId).toBe("WK8101");
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
test("passes when selector matches template labels", () => {
|
|
293
|
-
const ctx = makeCtx(`
|
|
294
|
-
apiVersion: apps/v1
|
|
295
|
-
kind: Deployment
|
|
296
|
-
metadata:
|
|
297
|
-
name: app
|
|
298
|
-
spec:
|
|
299
|
-
selector:
|
|
300
|
-
matchLabels:
|
|
301
|
-
app: my-app
|
|
302
|
-
template:
|
|
303
|
-
metadata:
|
|
304
|
-
labels:
|
|
305
|
-
app: my-app
|
|
306
|
-
spec:
|
|
307
|
-
containers:
|
|
308
|
-
- name: app
|
|
309
|
-
image: app:1.0
|
|
310
|
-
`);
|
|
311
|
-
const diags = wk8101.check(ctx);
|
|
312
|
-
expect(diags.length).toBe(0);
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// ── WK8102: Missing labels ─────────────────────────────────────────
|
|
317
|
-
|
|
318
|
-
describe("WK8102: Missing metadata.labels", () => {
|
|
319
|
-
test("flags resource without labels", () => {
|
|
320
|
-
const ctx = makeCtx(`
|
|
321
|
-
apiVersion: apps/v1
|
|
322
|
-
kind: Deployment
|
|
323
|
-
metadata:
|
|
324
|
-
name: app
|
|
325
|
-
spec:
|
|
326
|
-
template:
|
|
327
|
-
spec:
|
|
328
|
-
containers:
|
|
329
|
-
- name: app
|
|
330
|
-
image: app:1.0
|
|
331
|
-
`);
|
|
332
|
-
const diags = wk8102.check(ctx);
|
|
333
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
334
|
-
expect(diags[0].checkId).toBe("WK8102");
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
test("passes with labels present", () => {
|
|
338
|
-
const ctx = makeCtx(`
|
|
339
|
-
apiVersion: apps/v1
|
|
340
|
-
kind: Deployment
|
|
341
|
-
metadata:
|
|
342
|
-
name: app
|
|
343
|
-
labels:
|
|
344
|
-
app: my-app
|
|
345
|
-
spec:
|
|
346
|
-
template:
|
|
347
|
-
spec:
|
|
348
|
-
containers:
|
|
349
|
-
- name: app
|
|
350
|
-
image: app:1.0
|
|
351
|
-
`);
|
|
352
|
-
const diags = wk8102.check(ctx);
|
|
353
|
-
expect(diags.length).toBe(0);
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
// ── WK8103: Container name ─────────────────────────────────────────
|
|
358
|
-
|
|
359
|
-
describe("WK8103: Container missing name", () => {
|
|
360
|
-
test("flags container without name", () => {
|
|
361
|
-
const ctx = makeCtx(`
|
|
362
|
-
apiVersion: apps/v1
|
|
363
|
-
kind: Deployment
|
|
364
|
-
metadata:
|
|
365
|
-
name: app
|
|
366
|
-
spec:
|
|
367
|
-
template:
|
|
368
|
-
spec:
|
|
369
|
-
containers:
|
|
370
|
-
- image: app:1.0
|
|
371
|
-
`);
|
|
372
|
-
const diags = wk8103.check(ctx);
|
|
373
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
374
|
-
expect(diags[0].checkId).toBe("WK8103");
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
test("passes with container name", () => {
|
|
378
|
-
const ctx = makeCtx(`
|
|
379
|
-
apiVersion: apps/v1
|
|
380
|
-
kind: Deployment
|
|
381
|
-
metadata:
|
|
382
|
-
name: app
|
|
383
|
-
spec:
|
|
384
|
-
template:
|
|
385
|
-
spec:
|
|
386
|
-
containers:
|
|
387
|
-
- name: app
|
|
388
|
-
image: app:1.0
|
|
389
|
-
`);
|
|
390
|
-
const diags = wk8103.check(ctx);
|
|
391
|
-
expect(diags.length).toBe(0);
|
|
392
|
-
});
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// ── WK8104: Named ports ────────────────────────────────────────────
|
|
396
|
-
|
|
397
|
-
describe("WK8104: Unnamed container ports", () => {
|
|
398
|
-
test("flags unnamed ports", () => {
|
|
399
|
-
const ctx = makeCtx(JSON.stringify({
|
|
400
|
-
apiVersion: "apps/v1",
|
|
401
|
-
kind: "Deployment",
|
|
402
|
-
metadata: { name: "app" },
|
|
403
|
-
spec: {
|
|
404
|
-
template: {
|
|
405
|
-
spec: {
|
|
406
|
-
containers: [
|
|
407
|
-
{ name: "app", image: "app:1.0", ports: [{ containerPort: 8080 }] },
|
|
408
|
-
],
|
|
409
|
-
},
|
|
410
|
-
},
|
|
411
|
-
},
|
|
412
|
-
}));
|
|
413
|
-
const diags = wk8104.check(ctx);
|
|
414
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
415
|
-
expect(diags[0].checkId).toBe("WK8104");
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
test("passes with named ports", () => {
|
|
419
|
-
const ctx = makeCtx(JSON.stringify({
|
|
420
|
-
apiVersion: "apps/v1",
|
|
421
|
-
kind: "Deployment",
|
|
422
|
-
metadata: { name: "app" },
|
|
423
|
-
spec: {
|
|
424
|
-
template: {
|
|
425
|
-
spec: {
|
|
426
|
-
containers: [
|
|
427
|
-
{ name: "app", image: "app:1.0", ports: [{ containerPort: 8080, name: "http" }] },
|
|
428
|
-
],
|
|
429
|
-
},
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
}));
|
|
433
|
-
const diags = wk8104.check(ctx);
|
|
434
|
-
expect(diags.length).toBe(0);
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
// ── WK8105: imagePullPolicy ────────────────────────────────────────
|
|
439
|
-
|
|
440
|
-
describe("WK8105: Missing imagePullPolicy", () => {
|
|
441
|
-
test("flags missing imagePullPolicy", () => {
|
|
442
|
-
const ctx = makeCtx(JSON.stringify({
|
|
443
|
-
apiVersion: "apps/v1",
|
|
444
|
-
kind: "Deployment",
|
|
445
|
-
metadata: { name: "app" },
|
|
446
|
-
spec: {
|
|
447
|
-
template: {
|
|
448
|
-
spec: {
|
|
449
|
-
containers: [{ name: "app", image: "app:1.0" }],
|
|
450
|
-
},
|
|
451
|
-
},
|
|
452
|
-
},
|
|
453
|
-
}));
|
|
454
|
-
const diags = wk8105.check(ctx);
|
|
455
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
456
|
-
expect(diags[0].checkId).toBe("WK8105");
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
test("passes with explicit imagePullPolicy", () => {
|
|
460
|
-
const ctx = makeCtx(JSON.stringify({
|
|
461
|
-
apiVersion: "apps/v1",
|
|
462
|
-
kind: "Deployment",
|
|
463
|
-
metadata: { name: "app" },
|
|
464
|
-
spec: {
|
|
465
|
-
template: {
|
|
466
|
-
spec: {
|
|
467
|
-
containers: [{ name: "app", image: "app:1.0", imagePullPolicy: "IfNotPresent" }],
|
|
468
|
-
},
|
|
469
|
-
},
|
|
470
|
-
},
|
|
471
|
-
}));
|
|
472
|
-
const diags = wk8105.check(ctx);
|
|
473
|
-
expect(diags.length).toBe(0);
|
|
474
|
-
});
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
// ── WK8201: Resource limits ────────────────────────────────────────
|
|
478
|
-
|
|
479
|
-
describe("WK8201: Resource limits required", () => {
|
|
480
|
-
test("flags container without resource limits", () => {
|
|
481
|
-
const ctx = makeCtx(JSON.stringify({
|
|
482
|
-
apiVersion: "apps/v1",
|
|
483
|
-
kind: "Deployment",
|
|
484
|
-
metadata: { name: "app" },
|
|
485
|
-
spec: {
|
|
486
|
-
template: {
|
|
487
|
-
spec: {
|
|
488
|
-
containers: [{ name: "app", image: "app:1.0" }],
|
|
489
|
-
},
|
|
490
|
-
},
|
|
491
|
-
},
|
|
492
|
-
}));
|
|
493
|
-
const diags = wk8201.check(ctx);
|
|
494
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
495
|
-
expect(diags[0].checkId).toBe("WK8201");
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
test("passes with resource limits", () => {
|
|
499
|
-
const ctx = makeCtx(JSON.stringify({
|
|
500
|
-
apiVersion: "apps/v1",
|
|
501
|
-
kind: "Deployment",
|
|
502
|
-
metadata: { name: "app" },
|
|
503
|
-
spec: {
|
|
504
|
-
template: {
|
|
505
|
-
spec: {
|
|
506
|
-
containers: [
|
|
507
|
-
{ name: "app", image: "app:1.0", resources: { limits: { cpu: "500m", memory: "256Mi" } } },
|
|
508
|
-
],
|
|
509
|
-
},
|
|
510
|
-
},
|
|
511
|
-
},
|
|
512
|
-
}));
|
|
513
|
-
const diags = wk8201.check(ctx);
|
|
514
|
-
expect(diags.length).toBe(0);
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
// ── WK8202: Privileged ─────────────────────────────────────────────
|
|
519
|
-
|
|
520
|
-
describe("WK8202: Privileged containers", () => {
|
|
521
|
-
test("flags privileged: true", () => {
|
|
522
|
-
const ctx = makeCtx(JSON.stringify({
|
|
523
|
-
apiVersion: "apps/v1",
|
|
524
|
-
kind: "Deployment",
|
|
525
|
-
metadata: { name: "app" },
|
|
526
|
-
spec: {
|
|
527
|
-
template: {
|
|
528
|
-
spec: {
|
|
529
|
-
containers: [
|
|
530
|
-
{ name: "app", image: "app:1.0", securityContext: { privileged: true } },
|
|
531
|
-
],
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
},
|
|
535
|
-
}));
|
|
536
|
-
const diags = wk8202.check(ctx);
|
|
537
|
-
expect(diags.length).toBe(1);
|
|
538
|
-
expect(diags[0].checkId).toBe("WK8202");
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
test("passes with privileged: false", () => {
|
|
542
|
-
const ctx = makeCtx(JSON.stringify({
|
|
543
|
-
apiVersion: "apps/v1",
|
|
544
|
-
kind: "Deployment",
|
|
545
|
-
metadata: { name: "app" },
|
|
546
|
-
spec: {
|
|
547
|
-
template: {
|
|
548
|
-
spec: {
|
|
549
|
-
containers: [
|
|
550
|
-
{ name: "app", image: "app:1.0", securityContext: { privileged: false } },
|
|
551
|
-
],
|
|
552
|
-
},
|
|
553
|
-
},
|
|
554
|
-
},
|
|
555
|
-
}));
|
|
556
|
-
const diags = wk8202.check(ctx);
|
|
557
|
-
expect(diags.length).toBe(0);
|
|
558
|
-
});
|
|
559
|
-
});
|
|
560
|
-
|
|
561
|
-
// ── WK8203: readOnlyRootFilesystem ─────────────────────────────────
|
|
562
|
-
|
|
563
|
-
describe("WK8203: readOnlyRootFilesystem", () => {
|
|
564
|
-
test("flags missing readOnlyRootFilesystem", () => {
|
|
565
|
-
const ctx = makeCtx(JSON.stringify({
|
|
566
|
-
apiVersion: "apps/v1",
|
|
567
|
-
kind: "Deployment",
|
|
568
|
-
metadata: { name: "app" },
|
|
569
|
-
spec: {
|
|
570
|
-
template: {
|
|
571
|
-
spec: {
|
|
572
|
-
containers: [
|
|
573
|
-
{ name: "app", image: "app:1.0", securityContext: {} },
|
|
574
|
-
],
|
|
575
|
-
},
|
|
576
|
-
},
|
|
577
|
-
},
|
|
578
|
-
}));
|
|
579
|
-
const diags = wk8203.check(ctx);
|
|
580
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
581
|
-
expect(diags[0].checkId).toBe("WK8203");
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
test("passes with readOnlyRootFilesystem: true", () => {
|
|
585
|
-
const ctx = makeCtx(JSON.stringify({
|
|
586
|
-
apiVersion: "apps/v1",
|
|
587
|
-
kind: "Deployment",
|
|
588
|
-
metadata: { name: "app" },
|
|
589
|
-
spec: {
|
|
590
|
-
template: {
|
|
591
|
-
spec: {
|
|
592
|
-
containers: [
|
|
593
|
-
{ name: "app", image: "app:1.0", securityContext: { readOnlyRootFilesystem: true } },
|
|
594
|
-
],
|
|
595
|
-
},
|
|
596
|
-
},
|
|
597
|
-
},
|
|
598
|
-
}));
|
|
599
|
-
const diags = wk8203.check(ctx);
|
|
600
|
-
expect(diags.length).toBe(0);
|
|
601
|
-
});
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
// ── WK8204: runAsNonRoot ───────────────────────────────────────────
|
|
605
|
-
|
|
606
|
-
describe("WK8204: runAsNonRoot", () => {
|
|
607
|
-
test("flags missing runAsNonRoot", () => {
|
|
608
|
-
const ctx = makeCtx(JSON.stringify({
|
|
609
|
-
apiVersion: "apps/v1",
|
|
610
|
-
kind: "Deployment",
|
|
611
|
-
metadata: { name: "app" },
|
|
612
|
-
spec: {
|
|
613
|
-
template: {
|
|
614
|
-
spec: {
|
|
615
|
-
containers: [
|
|
616
|
-
{ name: "app", image: "app:1.0", securityContext: {} },
|
|
617
|
-
],
|
|
618
|
-
},
|
|
619
|
-
},
|
|
620
|
-
},
|
|
621
|
-
}));
|
|
622
|
-
const diags = wk8204.check(ctx);
|
|
623
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
624
|
-
expect(diags[0].checkId).toBe("WK8204");
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
test("warns when runAsNonRoot: true but no runAsUser", () => {
|
|
628
|
-
const ctx = makeCtx(JSON.stringify({
|
|
629
|
-
apiVersion: "apps/v1",
|
|
630
|
-
kind: "Deployment",
|
|
631
|
-
metadata: { name: "app" },
|
|
632
|
-
spec: {
|
|
633
|
-
template: {
|
|
634
|
-
spec: {
|
|
635
|
-
containers: [
|
|
636
|
-
{ name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true } },
|
|
637
|
-
],
|
|
638
|
-
},
|
|
639
|
-
},
|
|
640
|
-
},
|
|
641
|
-
}));
|
|
642
|
-
const diags = wk8204.check(ctx);
|
|
643
|
-
expect(diags.length).toBe(1);
|
|
644
|
-
expect(diags[0].checkId).toBe("WK8204");
|
|
645
|
-
expect(diags[0].message).toContain("no explicit runAsUser");
|
|
646
|
-
});
|
|
647
|
-
|
|
648
|
-
test("warns when runAsNonRoot: true with runAsUser: 0 (contradictory)", () => {
|
|
649
|
-
const ctx = makeCtx(JSON.stringify({
|
|
650
|
-
apiVersion: "apps/v1",
|
|
651
|
-
kind: "Deployment",
|
|
652
|
-
metadata: { name: "app" },
|
|
653
|
-
spec: {
|
|
654
|
-
template: {
|
|
655
|
-
spec: {
|
|
656
|
-
containers: [
|
|
657
|
-
{ name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true, runAsUser: 0 } },
|
|
658
|
-
],
|
|
659
|
-
},
|
|
660
|
-
},
|
|
661
|
-
},
|
|
662
|
-
}));
|
|
663
|
-
const diags = wk8204.check(ctx);
|
|
664
|
-
expect(diags.length).toBe(1);
|
|
665
|
-
expect(diags[0].checkId).toBe("WK8204");
|
|
666
|
-
expect(diags[0].message).toContain("contradictory");
|
|
667
|
-
});
|
|
668
|
-
|
|
669
|
-
test("passes with runAsNonRoot: true and runAsUser: 65534", () => {
|
|
670
|
-
const ctx = makeCtx(JSON.stringify({
|
|
671
|
-
apiVersion: "apps/v1",
|
|
672
|
-
kind: "Deployment",
|
|
673
|
-
metadata: { name: "app" },
|
|
674
|
-
spec: {
|
|
675
|
-
template: {
|
|
676
|
-
spec: {
|
|
677
|
-
containers: [
|
|
678
|
-
{ name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true, runAsUser: 65534 } },
|
|
679
|
-
],
|
|
680
|
-
},
|
|
681
|
-
},
|
|
682
|
-
},
|
|
683
|
-
}));
|
|
684
|
-
const diags = wk8204.check(ctx);
|
|
685
|
-
expect(diags.length).toBe(0);
|
|
686
|
-
});
|
|
687
|
-
|
|
688
|
-
// #1482 — the manifest arrives as real YAML, and the initContainer's args is
|
|
689
|
-
// a block scalar. The parser bug turned `- |` into the string "|" and hoisted
|
|
690
|
-
// every key after it (securityContext, the containers list itself) to the
|
|
691
|
-
// document root, so this check warned on a compliant initContainer and never
|
|
692
|
-
// saw the app container at all.
|
|
693
|
-
test("initContainer with a block-scalar arg keeps its securityContext, and the app container is still checked (#1482)", () => {
|
|
694
|
-
const yaml = [
|
|
695
|
-
"apiVersion: apps/v1",
|
|
696
|
-
"kind: Deployment",
|
|
697
|
-
"metadata:",
|
|
698
|
-
" name: app",
|
|
699
|
-
"spec:",
|
|
700
|
-
" template:",
|
|
701
|
-
" spec:",
|
|
702
|
-
" initContainers:",
|
|
703
|
-
" - name: wait",
|
|
704
|
-
" image: pg:16",
|
|
705
|
-
" args:",
|
|
706
|
-
" - |",
|
|
707
|
-
" set -eu",
|
|
708
|
-
" echo ready",
|
|
709
|
-
" securityContext:",
|
|
710
|
-
" runAsNonRoot: true",
|
|
711
|
-
" runAsUser: 1001",
|
|
712
|
-
" containers:",
|
|
713
|
-
" - name: app",
|
|
714
|
-
" image: app:1.0",
|
|
715
|
-
" securityContext: {}",
|
|
716
|
-
"",
|
|
717
|
-
].join("\n");
|
|
718
|
-
const ctx = makeCtx(yaml);
|
|
719
|
-
const diags = wk8204.check(ctx);
|
|
720
|
-
// The compliant initContainer produces nothing; the bare app container is
|
|
721
|
-
// the one — and the only one — that warns.
|
|
722
|
-
expect(diags.length).toBe(1);
|
|
723
|
-
expect(diags[0].message).toContain('"app"');
|
|
724
|
-
expect(diags[0].message).not.toContain("wait");
|
|
725
|
-
});
|
|
726
|
-
|
|
727
|
-
test("pod-level runAsUser satisfies container-level runAsNonRoot", () => {
|
|
728
|
-
const ctx = makeCtx(JSON.stringify({
|
|
729
|
-
apiVersion: "apps/v1",
|
|
730
|
-
kind: "Deployment",
|
|
731
|
-
metadata: { name: "app" },
|
|
732
|
-
spec: {
|
|
733
|
-
template: {
|
|
734
|
-
spec: {
|
|
735
|
-
securityContext: { runAsUser: 1000 },
|
|
736
|
-
containers: [
|
|
737
|
-
{ name: "app", image: "app:1.0", securityContext: { runAsNonRoot: true } },
|
|
738
|
-
],
|
|
739
|
-
},
|
|
740
|
-
},
|
|
741
|
-
},
|
|
742
|
-
}));
|
|
743
|
-
const diags = wk8204.check(ctx);
|
|
744
|
-
expect(diags.length).toBe(0);
|
|
745
|
-
});
|
|
746
|
-
});
|
|
747
|
-
|
|
748
|
-
// ── WK8205: Drop capabilities ──────────────────────────────────────
|
|
749
|
-
|
|
750
|
-
describe("WK8205: Drop all capabilities", () => {
|
|
751
|
-
test("flags missing capability drop", () => {
|
|
752
|
-
const ctx = makeCtx(JSON.stringify({
|
|
753
|
-
apiVersion: "apps/v1",
|
|
754
|
-
kind: "Deployment",
|
|
755
|
-
metadata: { name: "app" },
|
|
756
|
-
spec: {
|
|
757
|
-
template: {
|
|
758
|
-
spec: {
|
|
759
|
-
containers: [
|
|
760
|
-
{ name: "app", image: "app:1.0", securityContext: {} },
|
|
761
|
-
],
|
|
762
|
-
},
|
|
763
|
-
},
|
|
764
|
-
},
|
|
765
|
-
}));
|
|
766
|
-
const diags = wk8205.check(ctx);
|
|
767
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
768
|
-
expect(diags[0].checkId).toBe("WK8205");
|
|
769
|
-
});
|
|
770
|
-
|
|
771
|
-
test("passes with drop ALL", () => {
|
|
772
|
-
const ctx = makeCtx(JSON.stringify({
|
|
773
|
-
apiVersion: "apps/v1",
|
|
774
|
-
kind: "Deployment",
|
|
775
|
-
metadata: { name: "app" },
|
|
776
|
-
spec: {
|
|
777
|
-
template: {
|
|
778
|
-
spec: {
|
|
779
|
-
containers: [
|
|
780
|
-
{ name: "app", image: "app:1.0", securityContext: { capabilities: { drop: ["ALL"] } } },
|
|
781
|
-
],
|
|
782
|
-
},
|
|
783
|
-
},
|
|
784
|
-
},
|
|
785
|
-
}));
|
|
786
|
-
const diags = wk8205.check(ctx);
|
|
787
|
-
expect(diags.length).toBe(0);
|
|
788
|
-
});
|
|
789
|
-
});
|
|
790
|
-
|
|
791
|
-
// ── WK8207: hostNetwork ────────────────────────────────────────────
|
|
792
|
-
|
|
793
|
-
describe("WK8207: hostNetwork", () => {
|
|
794
|
-
test("flags hostNetwork: true", () => {
|
|
795
|
-
const ctx = makeCtx(`
|
|
796
|
-
apiVersion: apps/v1
|
|
797
|
-
kind: Deployment
|
|
798
|
-
metadata:
|
|
799
|
-
name: app
|
|
800
|
-
spec:
|
|
801
|
-
template:
|
|
802
|
-
spec:
|
|
803
|
-
hostNetwork: true
|
|
804
|
-
containers:
|
|
805
|
-
- name: app
|
|
806
|
-
image: app:1.0
|
|
807
|
-
`);
|
|
808
|
-
const diags = wk8207.check(ctx);
|
|
809
|
-
expect(diags.length).toBe(1);
|
|
810
|
-
expect(diags[0].checkId).toBe("WK8207");
|
|
811
|
-
});
|
|
812
|
-
|
|
813
|
-
test("passes without hostNetwork", () => {
|
|
814
|
-
const ctx = makeCtx(`
|
|
815
|
-
apiVersion: apps/v1
|
|
816
|
-
kind: Deployment
|
|
817
|
-
metadata:
|
|
818
|
-
name: app
|
|
819
|
-
spec:
|
|
820
|
-
template:
|
|
821
|
-
spec:
|
|
822
|
-
containers:
|
|
823
|
-
- name: app
|
|
824
|
-
image: app:1.0
|
|
825
|
-
`);
|
|
826
|
-
const diags = wk8207.check(ctx);
|
|
827
|
-
expect(diags.length).toBe(0);
|
|
828
|
-
});
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
// ── WK8208: hostPID ────────────────────────────────────────────────
|
|
832
|
-
|
|
833
|
-
describe("WK8208: hostPID", () => {
|
|
834
|
-
test("flags hostPID: true", () => {
|
|
835
|
-
const ctx = makeCtx(`
|
|
836
|
-
apiVersion: apps/v1
|
|
837
|
-
kind: Deployment
|
|
838
|
-
metadata:
|
|
839
|
-
name: app
|
|
840
|
-
spec:
|
|
841
|
-
template:
|
|
842
|
-
spec:
|
|
843
|
-
hostPID: true
|
|
844
|
-
containers:
|
|
845
|
-
- name: app
|
|
846
|
-
image: app:1.0
|
|
847
|
-
`);
|
|
848
|
-
const diags = wk8208.check(ctx);
|
|
849
|
-
expect(diags.length).toBe(1);
|
|
850
|
-
expect(diags[0].checkId).toBe("WK8208");
|
|
851
|
-
});
|
|
852
|
-
|
|
853
|
-
test("passes without hostPID", () => {
|
|
854
|
-
const ctx = makeCtx(`
|
|
855
|
-
apiVersion: apps/v1
|
|
856
|
-
kind: Deployment
|
|
857
|
-
metadata:
|
|
858
|
-
name: app
|
|
859
|
-
spec:
|
|
860
|
-
template:
|
|
861
|
-
spec:
|
|
862
|
-
containers:
|
|
863
|
-
- name: app
|
|
864
|
-
image: app:1.0
|
|
865
|
-
`);
|
|
866
|
-
const diags = wk8208.check(ctx);
|
|
867
|
-
expect(diags.length).toBe(0);
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
|
|
871
|
-
// ── WK8209: hostIPC ────────────────────────────────────────────────
|
|
872
|
-
|
|
873
|
-
describe("WK8209: hostIPC", () => {
|
|
874
|
-
test("flags hostIPC: true", () => {
|
|
875
|
-
const ctx = makeCtx(`
|
|
876
|
-
apiVersion: apps/v1
|
|
877
|
-
kind: Deployment
|
|
878
|
-
metadata:
|
|
879
|
-
name: app
|
|
880
|
-
spec:
|
|
881
|
-
template:
|
|
882
|
-
spec:
|
|
883
|
-
hostIPC: true
|
|
884
|
-
containers:
|
|
885
|
-
- name: app
|
|
886
|
-
image: app:1.0
|
|
887
|
-
`);
|
|
888
|
-
const diags = wk8209.check(ctx);
|
|
889
|
-
expect(diags.length).toBe(1);
|
|
890
|
-
expect(diags[0].checkId).toBe("WK8209");
|
|
891
|
-
});
|
|
892
|
-
|
|
893
|
-
test("passes without hostIPC", () => {
|
|
894
|
-
const ctx = makeCtx(`
|
|
895
|
-
apiVersion: apps/v1
|
|
896
|
-
kind: Deployment
|
|
897
|
-
metadata:
|
|
898
|
-
name: app
|
|
899
|
-
spec:
|
|
900
|
-
template:
|
|
901
|
-
spec:
|
|
902
|
-
containers:
|
|
903
|
-
- name: app
|
|
904
|
-
image: app:1.0
|
|
905
|
-
`);
|
|
906
|
-
const diags = wk8209.check(ctx);
|
|
907
|
-
expect(diags.length).toBe(0);
|
|
908
|
-
});
|
|
909
|
-
});
|
|
910
|
-
|
|
911
|
-
// ── WK8301: Probes required ────────────────────────────────────────
|
|
912
|
-
|
|
913
|
-
describe("WK8301: Probes required", () => {
|
|
914
|
-
test("flags port-serving container without probes", () => {
|
|
915
|
-
const ctx = makeCtx(JSON.stringify({
|
|
916
|
-
apiVersion: "apps/v1",
|
|
917
|
-
kind: "Deployment",
|
|
918
|
-
metadata: { name: "app" },
|
|
919
|
-
spec: {
|
|
920
|
-
template: {
|
|
921
|
-
spec: {
|
|
922
|
-
containers: [
|
|
923
|
-
{ name: "app", image: "app:1.0", ports: [{ containerPort: 8080 }] },
|
|
924
|
-
],
|
|
925
|
-
},
|
|
926
|
-
},
|
|
927
|
-
},
|
|
928
|
-
}));
|
|
929
|
-
const diags = wk8301.check(ctx);
|
|
930
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
931
|
-
expect(diags[0].checkId).toBe("WK8301");
|
|
932
|
-
});
|
|
933
|
-
|
|
934
|
-
test("skips port-less worker Deployment (no inbound traffic to probe)", () => {
|
|
935
|
-
const ctx = makeCtx(JSON.stringify({
|
|
936
|
-
apiVersion: "apps/v1",
|
|
937
|
-
kind: "Deployment",
|
|
938
|
-
metadata: { name: "worker" },
|
|
939
|
-
spec: {
|
|
940
|
-
template: {
|
|
941
|
-
spec: {
|
|
942
|
-
// A queue/Temporal worker — long-running, no port, no probes by design.
|
|
943
|
-
containers: [{ name: "worker", image: "worker:1.0" }],
|
|
944
|
-
},
|
|
945
|
-
},
|
|
946
|
-
},
|
|
947
|
-
}));
|
|
948
|
-
const diags = wk8301.check(ctx);
|
|
949
|
-
expect(diags.length).toBe(0);
|
|
950
|
-
});
|
|
951
|
-
|
|
952
|
-
test("passes with both probes", () => {
|
|
953
|
-
const ctx = makeCtx(JSON.stringify({
|
|
954
|
-
apiVersion: "apps/v1",
|
|
955
|
-
kind: "Deployment",
|
|
956
|
-
metadata: { name: "app" },
|
|
957
|
-
spec: {
|
|
958
|
-
template: {
|
|
959
|
-
spec: {
|
|
960
|
-
containers: [
|
|
961
|
-
{
|
|
962
|
-
name: "app",
|
|
963
|
-
image: "app:1.0",
|
|
964
|
-
ports: [{ containerPort: 8080 }],
|
|
965
|
-
livenessProbe: { httpGet: { path: "/healthz", port: 8080 } },
|
|
966
|
-
readinessProbe: { httpGet: { path: "/readyz", port: 8080 } },
|
|
967
|
-
},
|
|
968
|
-
],
|
|
969
|
-
},
|
|
970
|
-
},
|
|
971
|
-
},
|
|
972
|
-
}));
|
|
973
|
-
const diags = wk8301.check(ctx);
|
|
974
|
-
expect(diags.length).toBe(0);
|
|
975
|
-
});
|
|
976
|
-
|
|
977
|
-
test("skips Job (probes not needed)", () => {
|
|
978
|
-
const ctx = makeCtx(JSON.stringify({
|
|
979
|
-
apiVersion: "batch/v1",
|
|
980
|
-
kind: "Job",
|
|
981
|
-
metadata: { name: "job" },
|
|
982
|
-
spec: {
|
|
983
|
-
template: {
|
|
984
|
-
spec: {
|
|
985
|
-
containers: [{ name: "worker", image: "worker:1.0" }],
|
|
986
|
-
},
|
|
987
|
-
},
|
|
988
|
-
},
|
|
989
|
-
}));
|
|
990
|
-
const diags = wk8301.check(ctx);
|
|
991
|
-
expect(diags.length).toBe(0);
|
|
992
|
-
});
|
|
993
|
-
|
|
994
|
-
test("skips CronJob", () => {
|
|
995
|
-
const ctx = makeCtx(JSON.stringify({
|
|
996
|
-
apiVersion: "batch/v1",
|
|
997
|
-
kind: "CronJob",
|
|
998
|
-
metadata: { name: "cron" },
|
|
999
|
-
spec: {
|
|
1000
|
-
schedule: "0 * * * *",
|
|
1001
|
-
jobTemplate: {
|
|
1002
|
-
spec: {
|
|
1003
|
-
template: {
|
|
1004
|
-
spec: {
|
|
1005
|
-
containers: [{ name: "cron", image: "cron:1.0" }],
|
|
1006
|
-
},
|
|
1007
|
-
},
|
|
1008
|
-
},
|
|
1009
|
-
},
|
|
1010
|
-
},
|
|
1011
|
-
}));
|
|
1012
|
-
const diags = wk8301.check(ctx);
|
|
1013
|
-
expect(diags.length).toBe(0);
|
|
1014
|
-
});
|
|
1015
|
-
});
|
|
1016
|
-
|
|
1017
|
-
// ── WK8302: Single replica ─────────────────────────────────────────
|
|
1018
|
-
|
|
1019
|
-
describe("WK8302: Single replica deployment", () => {
|
|
1020
|
-
test("flags replicas: 1", () => {
|
|
1021
|
-
const ctx = makeCtx(`
|
|
1022
|
-
apiVersion: apps/v1
|
|
1023
|
-
kind: Deployment
|
|
1024
|
-
metadata:
|
|
1025
|
-
name: app
|
|
1026
|
-
spec:
|
|
1027
|
-
replicas: 1
|
|
1028
|
-
template:
|
|
1029
|
-
spec:
|
|
1030
|
-
containers:
|
|
1031
|
-
- name: app
|
|
1032
|
-
image: app:1.0
|
|
1033
|
-
`);
|
|
1034
|
-
const diags = wk8302.check(ctx);
|
|
1035
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
1036
|
-
expect(diags[0].checkId).toBe("WK8302");
|
|
1037
|
-
});
|
|
1038
|
-
|
|
1039
|
-
test("passes with replicas: 3", () => {
|
|
1040
|
-
const ctx = makeCtx(`
|
|
1041
|
-
apiVersion: apps/v1
|
|
1042
|
-
kind: Deployment
|
|
1043
|
-
metadata:
|
|
1044
|
-
name: app
|
|
1045
|
-
spec:
|
|
1046
|
-
replicas: 3
|
|
1047
|
-
template:
|
|
1048
|
-
spec:
|
|
1049
|
-
containers:
|
|
1050
|
-
- name: app
|
|
1051
|
-
image: app:1.0
|
|
1052
|
-
`);
|
|
1053
|
-
const diags = wk8302.check(ctx);
|
|
1054
|
-
expect(diags.length).toBe(0);
|
|
1055
|
-
});
|
|
1056
|
-
});
|
|
1057
|
-
|
|
1058
|
-
// ── WK8303: PDB missing ───────────────────────────────────────────
|
|
1059
|
-
|
|
1060
|
-
describe("WK8303: HA Deployment without PDB", () => {
|
|
1061
|
-
test("flags HA Deployment without PDB", () => {
|
|
1062
|
-
const ctx = makeCtx(`
|
|
1063
|
-
apiVersion: apps/v1
|
|
1064
|
-
kind: Deployment
|
|
1065
|
-
metadata:
|
|
1066
|
-
name: app
|
|
1067
|
-
labels:
|
|
1068
|
-
app: my-app
|
|
1069
|
-
spec:
|
|
1070
|
-
replicas: 3
|
|
1071
|
-
selector:
|
|
1072
|
-
matchLabels:
|
|
1073
|
-
app: my-app
|
|
1074
|
-
template:
|
|
1075
|
-
metadata:
|
|
1076
|
-
labels:
|
|
1077
|
-
app: my-app
|
|
1078
|
-
spec:
|
|
1079
|
-
containers:
|
|
1080
|
-
- name: app
|
|
1081
|
-
image: app:1.0
|
|
1082
|
-
`);
|
|
1083
|
-
const diags = wk8303.check(ctx);
|
|
1084
|
-
expect(diags.length).toBeGreaterThanOrEqual(1);
|
|
1085
|
-
expect(diags[0].checkId).toBe("WK8303");
|
|
1086
|
-
});
|
|
1087
|
-
|
|
1088
|
-
test("passes with PDB present", () => {
|
|
1089
|
-
const ctx = makeCtx(`
|
|
1090
|
-
apiVersion: apps/v1
|
|
1091
|
-
kind: Deployment
|
|
1092
|
-
metadata:
|
|
1093
|
-
name: app
|
|
1094
|
-
labels:
|
|
1095
|
-
app: my-app
|
|
1096
|
-
spec:
|
|
1097
|
-
replicas: 3
|
|
1098
|
-
selector:
|
|
1099
|
-
matchLabels:
|
|
1100
|
-
app: my-app
|
|
1101
|
-
template:
|
|
1102
|
-
metadata:
|
|
1103
|
-
labels:
|
|
1104
|
-
app: my-app
|
|
1105
|
-
spec:
|
|
1106
|
-
containers:
|
|
1107
|
-
- name: app
|
|
1108
|
-
image: app:1.0
|
|
1109
|
-
---
|
|
1110
|
-
apiVersion: policy/v1
|
|
1111
|
-
kind: PodDisruptionBudget
|
|
1112
|
-
metadata:
|
|
1113
|
-
name: app-pdb
|
|
1114
|
-
spec:
|
|
1115
|
-
minAvailable: 1
|
|
1116
|
-
selector:
|
|
1117
|
-
matchLabels:
|
|
1118
|
-
app: my-app
|
|
1119
|
-
`);
|
|
1120
|
-
const diags = wk8303.check(ctx);
|
|
1121
|
-
expect(diags.length).toBe(0);
|
|
1122
|
-
});
|
|
1123
|
-
});
|
|
1124
|
-
|
|
1125
|
-
// ── WK8304: SSL redirect without certificate ────────────────────────
|
|
1126
|
-
|
|
1127
|
-
describe("WK8304: SSL redirect without certificate", () => {
|
|
1128
|
-
test("flags ssl-redirect without certificate-arn", () => {
|
|
1129
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1130
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1131
|
-
kind: "Ingress",
|
|
1132
|
-
metadata: {
|
|
1133
|
-
name: "app-ingress",
|
|
1134
|
-
annotations: {
|
|
1135
|
-
"alb.ingress.kubernetes.io/ssl-redirect": "443",
|
|
1136
|
-
"alb.ingress.kubernetes.io/scheme": "internet-facing",
|
|
1137
|
-
},
|
|
1138
|
-
},
|
|
1139
|
-
spec: { rules: [] },
|
|
1140
|
-
}));
|
|
1141
|
-
const diags = wk8304.check(ctx);
|
|
1142
|
-
expect(diags.length).toBe(1);
|
|
1143
|
-
expect(diags[0].checkId).toBe("WK8304");
|
|
1144
|
-
expect(diags[0].severity).toBe("warning");
|
|
1145
|
-
});
|
|
1146
|
-
|
|
1147
|
-
test("flags ssl-redirect with valid cert but no HTTPS in listen-ports", () => {
|
|
1148
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1149
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1150
|
-
kind: "Ingress",
|
|
1151
|
-
metadata: {
|
|
1152
|
-
name: "app-ingress",
|
|
1153
|
-
annotations: {
|
|
1154
|
-
"alb.ingress.kubernetes.io/ssl-redirect": "443",
|
|
1155
|
-
"alb.ingress.kubernetes.io/certificate-arn": "arn:aws:acm:us-east-1:123:certificate/abc",
|
|
1156
|
-
"alb.ingress.kubernetes.io/listen-ports": '[{"HTTP":80}]',
|
|
1157
|
-
},
|
|
1158
|
-
},
|
|
1159
|
-
spec: { rules: [] },
|
|
1160
|
-
}));
|
|
1161
|
-
const diags = wk8304.check(ctx);
|
|
1162
|
-
expect(diags.length).toBe(1);
|
|
1163
|
-
expect(diags[0].checkId).toBe("WK8304");
|
|
1164
|
-
});
|
|
1165
|
-
|
|
1166
|
-
test("passes with valid cert and HTTPS listen-ports", () => {
|
|
1167
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1168
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1169
|
-
kind: "Ingress",
|
|
1170
|
-
metadata: {
|
|
1171
|
-
name: "app-ingress",
|
|
1172
|
-
annotations: {
|
|
1173
|
-
"alb.ingress.kubernetes.io/ssl-redirect": "443",
|
|
1174
|
-
"alb.ingress.kubernetes.io/certificate-arn": "arn:aws:acm:us-east-1:123:certificate/abc",
|
|
1175
|
-
"alb.ingress.kubernetes.io/listen-ports": '[{"HTTPS":443}]',
|
|
1176
|
-
},
|
|
1177
|
-
},
|
|
1178
|
-
spec: { rules: [] },
|
|
1179
|
-
}));
|
|
1180
|
-
const diags = wk8304.check(ctx);
|
|
1181
|
-
expect(diags.length).toBe(0);
|
|
1182
|
-
});
|
|
1183
|
-
|
|
1184
|
-
test("passes with no ssl-redirect annotation", () => {
|
|
1185
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1186
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1187
|
-
kind: "Ingress",
|
|
1188
|
-
metadata: {
|
|
1189
|
-
name: "app-ingress",
|
|
1190
|
-
annotations: {
|
|
1191
|
-
"alb.ingress.kubernetes.io/scheme": "internet-facing",
|
|
1192
|
-
},
|
|
1193
|
-
},
|
|
1194
|
-
spec: { rules: [] },
|
|
1195
|
-
}));
|
|
1196
|
-
const diags = wk8304.check(ctx);
|
|
1197
|
-
expect(diags.length).toBe(0);
|
|
1198
|
-
});
|
|
1199
|
-
});
|
|
1200
|
-
|
|
1201
|
-
// ── WK8305: Ingress port not matching Service ───────────────────────
|
|
1202
|
-
|
|
1203
|
-
describe("WK8305: Ingress port not matching Service", () => {
|
|
1204
|
-
test("flags Ingress backend port not on Service", () => {
|
|
1205
|
-
const svc = JSON.stringify({
|
|
1206
|
-
apiVersion: "v1",
|
|
1207
|
-
kind: "Service",
|
|
1208
|
-
metadata: { name: "api", namespace: "default" },
|
|
1209
|
-
spec: { ports: [{ port: 80, targetPort: 8080 }] },
|
|
1210
|
-
});
|
|
1211
|
-
const ingress = JSON.stringify({
|
|
1212
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1213
|
-
kind: "Ingress",
|
|
1214
|
-
metadata: { name: "api-ingress", namespace: "default" },
|
|
1215
|
-
spec: {
|
|
1216
|
-
rules: [{
|
|
1217
|
-
host: "api.example.com",
|
|
1218
|
-
http: {
|
|
1219
|
-
paths: [{
|
|
1220
|
-
path: "/",
|
|
1221
|
-
backend: { service: { name: "api", port: { number: 8080 } } },
|
|
1222
|
-
}],
|
|
1223
|
-
},
|
|
1224
|
-
}],
|
|
1225
|
-
},
|
|
1226
|
-
});
|
|
1227
|
-
const ctx = makeCtx(`${svc}\n---\n${ingress}`);
|
|
1228
|
-
const diags = wk8305.check(ctx);
|
|
1229
|
-
expect(diags.length).toBe(1);
|
|
1230
|
-
expect(diags[0].checkId).toBe("WK8305");
|
|
1231
|
-
expect(diags[0].severity).toBe("warning");
|
|
1232
|
-
});
|
|
1233
|
-
|
|
1234
|
-
test("passes when port matches Service", () => {
|
|
1235
|
-
const svc = JSON.stringify({
|
|
1236
|
-
apiVersion: "v1",
|
|
1237
|
-
kind: "Service",
|
|
1238
|
-
metadata: { name: "api", namespace: "default" },
|
|
1239
|
-
spec: { ports: [{ port: 80, targetPort: 8080 }] },
|
|
1240
|
-
});
|
|
1241
|
-
const ingress = JSON.stringify({
|
|
1242
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1243
|
-
kind: "Ingress",
|
|
1244
|
-
metadata: { name: "api-ingress", namespace: "default" },
|
|
1245
|
-
spec: {
|
|
1246
|
-
rules: [{
|
|
1247
|
-
host: "api.example.com",
|
|
1248
|
-
http: {
|
|
1249
|
-
paths: [{
|
|
1250
|
-
path: "/",
|
|
1251
|
-
backend: { service: { name: "api", port: { number: 80 } } },
|
|
1252
|
-
}],
|
|
1253
|
-
},
|
|
1254
|
-
}],
|
|
1255
|
-
},
|
|
1256
|
-
});
|
|
1257
|
-
const ctx = makeCtx(`${svc}\n---\n${ingress}`);
|
|
1258
|
-
const diags = wk8305.check(ctx);
|
|
1259
|
-
expect(diags.length).toBe(0);
|
|
1260
|
-
});
|
|
1261
|
-
|
|
1262
|
-
test("skips when Service not in manifest set", () => {
|
|
1263
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1264
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1265
|
-
kind: "Ingress",
|
|
1266
|
-
metadata: { name: "api-ingress", namespace: "default" },
|
|
1267
|
-
spec: {
|
|
1268
|
-
rules: [{
|
|
1269
|
-
host: "api.example.com",
|
|
1270
|
-
http: {
|
|
1271
|
-
paths: [{
|
|
1272
|
-
path: "/",
|
|
1273
|
-
backend: { service: { name: "external-svc", port: { number: 443 } } },
|
|
1274
|
-
}],
|
|
1275
|
-
},
|
|
1276
|
-
}],
|
|
1277
|
-
},
|
|
1278
|
-
}));
|
|
1279
|
-
const diags = wk8305.check(ctx);
|
|
1280
|
-
expect(diags.length).toBe(0);
|
|
1281
|
-
});
|
|
1282
|
-
|
|
1283
|
-
test("passes with multiple Services, correct match", () => {
|
|
1284
|
-
const svc1 = JSON.stringify({
|
|
1285
|
-
apiVersion: "v1",
|
|
1286
|
-
kind: "Service",
|
|
1287
|
-
metadata: { name: "api", namespace: "prod" },
|
|
1288
|
-
spec: { ports: [{ port: 80 }, { port: 443 }] },
|
|
1289
|
-
});
|
|
1290
|
-
const svc2 = JSON.stringify({
|
|
1291
|
-
apiVersion: "v1",
|
|
1292
|
-
kind: "Service",
|
|
1293
|
-
metadata: { name: "web", namespace: "prod" },
|
|
1294
|
-
spec: { ports: [{ port: 3000 }] },
|
|
1295
|
-
});
|
|
1296
|
-
const ingress = JSON.stringify({
|
|
1297
|
-
apiVersion: "networking.k8s.io/v1",
|
|
1298
|
-
kind: "Ingress",
|
|
1299
|
-
metadata: { name: "main-ingress", namespace: "prod" },
|
|
1300
|
-
spec: {
|
|
1301
|
-
rules: [{
|
|
1302
|
-
host: "app.example.com",
|
|
1303
|
-
http: {
|
|
1304
|
-
paths: [
|
|
1305
|
-
{ path: "/api", backend: { service: { name: "api", port: { number: 443 } } } },
|
|
1306
|
-
{ path: "/", backend: { service: { name: "web", port: { number: 3000 } } } },
|
|
1307
|
-
],
|
|
1308
|
-
},
|
|
1309
|
-
}],
|
|
1310
|
-
},
|
|
1311
|
-
});
|
|
1312
|
-
const ctx = makeCtx(`${svc1}\n---\n${svc2}\n---\n${ingress}`);
|
|
1313
|
-
const diags = wk8305.check(ctx);
|
|
1314
|
-
expect(diags.length).toBe(0);
|
|
1315
|
-
});
|
|
1316
|
-
});
|
|
1317
|
-
|
|
1318
|
-
// ── WK8306: Container command starts with flag ───────────────────
|
|
1319
|
-
|
|
1320
|
-
describe("WK8306: Container command starts with flag", () => {
|
|
1321
|
-
test("flags command[0] starting with --", () => {
|
|
1322
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1323
|
-
apiVersion: "apps/v1",
|
|
1324
|
-
kind: "Deployment",
|
|
1325
|
-
metadata: { name: "adot" },
|
|
1326
|
-
spec: {
|
|
1327
|
-
template: {
|
|
1328
|
-
spec: {
|
|
1329
|
-
containers: [
|
|
1330
|
-
{ name: "collector", image: "otel:1.0", command: ["--config=/etc/adot/config.yaml"] },
|
|
1331
|
-
],
|
|
1332
|
-
},
|
|
1333
|
-
},
|
|
1334
|
-
},
|
|
1335
|
-
}));
|
|
1336
|
-
const diags = wk8306.check(ctx);
|
|
1337
|
-
expect(diags.length).toBe(1);
|
|
1338
|
-
expect(diags[0].checkId).toBe("WK8306");
|
|
1339
|
-
expect(diags[0].severity).toBe("error");
|
|
1340
|
-
expect(diags[0].message).toContain("--config");
|
|
1341
|
-
});
|
|
1342
|
-
|
|
1343
|
-
test("flags command[0] starting with -", () => {
|
|
1344
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1345
|
-
apiVersion: "apps/v1",
|
|
1346
|
-
kind: "Deployment",
|
|
1347
|
-
metadata: { name: "app" },
|
|
1348
|
-
spec: {
|
|
1349
|
-
template: {
|
|
1350
|
-
spec: {
|
|
1351
|
-
containers: [
|
|
1352
|
-
{ name: "app", image: "app:1.0", command: ["-c", "echo hello"] },
|
|
1353
|
-
],
|
|
1354
|
-
},
|
|
1355
|
-
},
|
|
1356
|
-
},
|
|
1357
|
-
}));
|
|
1358
|
-
const diags = wk8306.check(ctx);
|
|
1359
|
-
expect(diags.length).toBe(1);
|
|
1360
|
-
expect(diags[0].severity).toBe("error");
|
|
1361
|
-
});
|
|
1362
|
-
|
|
1363
|
-
test("passes when command[0] is a binary path", () => {
|
|
1364
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1365
|
-
apiVersion: "apps/v1",
|
|
1366
|
-
kind: "Deployment",
|
|
1367
|
-
metadata: { name: "app" },
|
|
1368
|
-
spec: {
|
|
1369
|
-
template: {
|
|
1370
|
-
spec: {
|
|
1371
|
-
containers: [
|
|
1372
|
-
{ name: "app", image: "app:1.0", command: ["/usr/bin/app", "--flag"] },
|
|
1373
|
-
],
|
|
1374
|
-
},
|
|
1375
|
-
},
|
|
1376
|
-
},
|
|
1377
|
-
}));
|
|
1378
|
-
const diags = wk8306.check(ctx);
|
|
1379
|
-
expect(diags.length).toBe(0);
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
test("passes when flags are in args (correct usage)", () => {
|
|
1383
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1384
|
-
apiVersion: "apps/v1",
|
|
1385
|
-
kind: "Deployment",
|
|
1386
|
-
metadata: { name: "app" },
|
|
1387
|
-
spec: {
|
|
1388
|
-
template: {
|
|
1389
|
-
spec: {
|
|
1390
|
-
containers: [
|
|
1391
|
-
{ name: "app", image: "app:1.0", args: ["--config=foo"] },
|
|
1392
|
-
],
|
|
1393
|
-
},
|
|
1394
|
-
},
|
|
1395
|
-
},
|
|
1396
|
-
}));
|
|
1397
|
-
const diags = wk8306.check(ctx);
|
|
1398
|
-
expect(diags.length).toBe(0);
|
|
1399
|
-
});
|
|
1400
|
-
|
|
1401
|
-
test("passes when no command field", () => {
|
|
1402
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1403
|
-
apiVersion: "apps/v1",
|
|
1404
|
-
kind: "Deployment",
|
|
1405
|
-
metadata: { name: "app" },
|
|
1406
|
-
spec: {
|
|
1407
|
-
template: {
|
|
1408
|
-
spec: {
|
|
1409
|
-
containers: [
|
|
1410
|
-
{ name: "app", image: "app:1.0" },
|
|
1411
|
-
],
|
|
1412
|
-
},
|
|
1413
|
-
},
|
|
1414
|
-
},
|
|
1415
|
-
}));
|
|
1416
|
-
const diags = wk8306.check(ctx);
|
|
1417
|
-
expect(diags.length).toBe(0);
|
|
1418
|
-
});
|
|
1419
|
-
});
|
|
1420
|
-
|
|
1421
|
-
// ── WK8401: shmSize exceeds memory limit ────────────────────────────────────
|
|
1422
|
-
|
|
1423
|
-
function makeRayCluster(overrides: {
|
|
1424
|
-
shmSizeLimit?: string;
|
|
1425
|
-
memoryLimit?: string;
|
|
1426
|
-
workerShmSizeLimit?: string;
|
|
1427
|
-
workerMemoryLimit?: string;
|
|
1428
|
-
rayVersion?: string;
|
|
1429
|
-
headImage?: string;
|
|
1430
|
-
}) {
|
|
1431
|
-
const headImage = overrides.headImage ?? "rayproject/ray:2.40.0-py310-cpu";
|
|
1432
|
-
return JSON.stringify({
|
|
1433
|
-
apiVersion: "ray.io/v1alpha1",
|
|
1434
|
-
kind: "RayCluster",
|
|
1435
|
-
metadata: { name: "ray" },
|
|
1436
|
-
spec: {
|
|
1437
|
-
...(overrides.rayVersion !== undefined && { rayVersion: overrides.rayVersion }),
|
|
1438
|
-
headGroupSpec: {
|
|
1439
|
-
template: {
|
|
1440
|
-
spec: {
|
|
1441
|
-
volumes: [{ name: "dshm", emptyDir: { medium: "Memory", ...(overrides.shmSizeLimit !== undefined && { sizeLimit: overrides.shmSizeLimit }) } }],
|
|
1442
|
-
containers: [{ name: "ray-head", image: headImage, resources: { limits: { memory: overrides.memoryLimit ?? "8Gi" } } }],
|
|
1443
|
-
},
|
|
1444
|
-
},
|
|
1445
|
-
},
|
|
1446
|
-
workerGroupSpecs: [
|
|
1447
|
-
{
|
|
1448
|
-
groupName: "cpu",
|
|
1449
|
-
template: {
|
|
1450
|
-
spec: {
|
|
1451
|
-
volumes: [{ name: "dshm", emptyDir: { medium: "Memory", ...(overrides.workerShmSizeLimit !== undefined && { sizeLimit: overrides.workerShmSizeLimit }) } }],
|
|
1452
|
-
containers: [{ name: "ray-worker", image: headImage, resources: { limits: { memory: overrides.workerMemoryLimit ?? "4Gi" } } }],
|
|
1453
|
-
},
|
|
1454
|
-
},
|
|
1455
|
-
},
|
|
1456
|
-
],
|
|
1457
|
-
},
|
|
1458
|
-
});
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
describe("WK8401: shmSize exceeds memory limit", () => {
|
|
1462
|
-
test("passes when shmSize equals memory limit", () => {
|
|
1463
|
-
const ctx = makeCtx(makeRayCluster({ shmSizeLimit: "8Gi", memoryLimit: "8Gi" }));
|
|
1464
|
-
const diags = wk8401.check(ctx);
|
|
1465
|
-
expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
|
|
1466
|
-
});
|
|
1467
|
-
|
|
1468
|
-
test("passes when shmSize is less than memory limit", () => {
|
|
1469
|
-
const ctx = makeCtx(makeRayCluster({ shmSizeLimit: "2Gi", memoryLimit: "8Gi" }));
|
|
1470
|
-
const diags = wk8401.check(ctx);
|
|
1471
|
-
expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
|
|
1472
|
-
});
|
|
1473
|
-
|
|
1474
|
-
test("errors when head shmSize exceeds memory limit", () => {
|
|
1475
|
-
const ctx = makeCtx(makeRayCluster({ shmSizeLimit: "16Gi", memoryLimit: "8Gi" }));
|
|
1476
|
-
const diags = wk8401.check(ctx);
|
|
1477
|
-
const errors = diags.filter((d) => d.checkId === "WK8401" && d.severity === "error");
|
|
1478
|
-
expect(errors.length).toBeGreaterThanOrEqual(1);
|
|
1479
|
-
expect(errors[0].message).toContain("head");
|
|
1480
|
-
expect(errors[0].message).toContain("16Gi");
|
|
1481
|
-
});
|
|
1482
|
-
|
|
1483
|
-
test("errors when worker shmSize exceeds memory limit", () => {
|
|
1484
|
-
const ctx = makeCtx(makeRayCluster({ workerShmSizeLimit: "8Gi", workerMemoryLimit: "4Gi" }));
|
|
1485
|
-
const diags = wk8401.check(ctx);
|
|
1486
|
-
const errors = diags.filter((d) => d.checkId === "WK8401" && d.severity === "error");
|
|
1487
|
-
expect(errors.length).toBeGreaterThanOrEqual(1);
|
|
1488
|
-
expect(errors[0].message).toContain("worker");
|
|
1489
|
-
});
|
|
1490
|
-
|
|
1491
|
-
test("skips check when no sizeLimit set on emptyDir", () => {
|
|
1492
|
-
const ctx = makeCtx(makeRayCluster({ shmSizeLimit: undefined }));
|
|
1493
|
-
const diags = wk8401.check(ctx);
|
|
1494
|
-
expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
|
|
1495
|
-
});
|
|
1496
|
-
|
|
1497
|
-
test("ignores non-RayCluster manifests", () => {
|
|
1498
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1499
|
-
apiVersion: "apps/v1",
|
|
1500
|
-
kind: "Deployment",
|
|
1501
|
-
metadata: { name: "app" },
|
|
1502
|
-
spec: { template: { spec: { volumes: [{ name: "dshm", emptyDir: { medium: "Memory", sizeLimit: "16Gi" } }], containers: [{ name: "app", image: "app:1.0", resources: { limits: { memory: "4Gi" } } }] } } },
|
|
1503
|
-
}));
|
|
1504
|
-
const diags = wk8401.check(ctx);
|
|
1505
|
-
expect(diags.filter((d) => d.checkId === "WK8401").length).toBe(0);
|
|
1506
|
-
});
|
|
1507
|
-
});
|
|
1508
|
-
|
|
1509
|
-
// ── WK8402: RayCluster missing spec.rayVersion ───────────────────────────────
|
|
1510
|
-
|
|
1511
|
-
describe("WK8402: RayCluster missing spec.rayVersion", () => {
|
|
1512
|
-
test("passes when rayVersion is set", () => {
|
|
1513
|
-
const ctx = makeCtx(makeRayCluster({ rayVersion: "2.40.0" }));
|
|
1514
|
-
const diags = wk8402.check(ctx);
|
|
1515
|
-
expect(diags.filter((d) => d.checkId === "WK8402").length).toBe(0);
|
|
1516
|
-
});
|
|
1517
|
-
|
|
1518
|
-
test("warns when rayVersion is absent", () => {
|
|
1519
|
-
const ctx = makeCtx(makeRayCluster({}));
|
|
1520
|
-
const diags = wk8402.check(ctx);
|
|
1521
|
-
const warns = diags.filter((d) => d.checkId === "WK8402");
|
|
1522
|
-
expect(warns.length).toBe(1);
|
|
1523
|
-
expect(warns[0].severity).toBe("warning");
|
|
1524
|
-
expect(warns[0].message).toContain("latest");
|
|
1525
|
-
});
|
|
1526
|
-
|
|
1527
|
-
test("ignores non-RayCluster manifests", () => {
|
|
1528
|
-
const ctx = makeCtx(JSON.stringify({ apiVersion: "apps/v1", kind: "Deployment", metadata: { name: "app" }, spec: {} }));
|
|
1529
|
-
const diags = wk8402.check(ctx);
|
|
1530
|
-
expect(diags.filter((d) => d.checkId === "WK8402").length).toBe(0);
|
|
1531
|
-
});
|
|
1532
|
-
});
|
|
1533
|
-
|
|
1534
|
-
// ── WK8403: spec.rayVersion / image tag mismatch ─────────────────────────────
|
|
1535
|
-
|
|
1536
|
-
describe("WK8403: spec.rayVersion does not match image tag", () => {
|
|
1537
|
-
test("passes when versions match", () => {
|
|
1538
|
-
const ctx = makeCtx(makeRayCluster({ rayVersion: "2.40.0", headImage: "rayproject/ray:2.40.0-py310-cpu" }));
|
|
1539
|
-
const diags = wk8403.check(ctx);
|
|
1540
|
-
expect(diags.filter((d) => d.checkId === "WK8403").length).toBe(0);
|
|
1541
|
-
});
|
|
1542
|
-
|
|
1543
|
-
test("warns when rayVersion does not match image tag", () => {
|
|
1544
|
-
const ctx = makeCtx(makeRayCluster({ rayVersion: "2.39.0", headImage: "rayproject/ray:2.40.0-py310-cpu" }));
|
|
1545
|
-
const diags = wk8403.check(ctx);
|
|
1546
|
-
const warns = diags.filter((d) => d.checkId === "WK8403");
|
|
1547
|
-
expect(warns.length).toBe(1);
|
|
1548
|
-
expect(warns[0].severity).toBe("warning");
|
|
1549
|
-
expect(warns[0].message).toContain("2.39.0");
|
|
1550
|
-
expect(warns[0].message).toContain("2.40.0");
|
|
1551
|
-
});
|
|
1552
|
-
|
|
1553
|
-
test("skips when rayVersion is absent (WK8402 covers that)", () => {
|
|
1554
|
-
const ctx = makeCtx(makeRayCluster({ headImage: "rayproject/ray:2.40.0" }));
|
|
1555
|
-
const diags = wk8403.check(ctx);
|
|
1556
|
-
expect(diags.filter((d) => d.checkId === "WK8403").length).toBe(0);
|
|
1557
|
-
});
|
|
1558
|
-
|
|
1559
|
-
test("skips when image tag has no parseable version", () => {
|
|
1560
|
-
const ctx = makeCtx(makeRayCluster({ rayVersion: "2.40.0", headImage: "rayproject/ray:latest" }));
|
|
1561
|
-
const diags = wk8403.check(ctx);
|
|
1562
|
-
expect(diags.filter((d) => d.checkId === "WK8403").length).toBe(0);
|
|
1563
|
-
});
|
|
1564
|
-
});
|
|
1565
|
-
|
|
1566
|
-
// ── WK8404: GPU request without a matching toleration ─────────────────────────
|
|
1567
|
-
|
|
1568
|
-
function servingRuntime(opts: {
|
|
1569
|
-
resources?: Record<string, unknown>;
|
|
1570
|
-
tolerations?: unknown[];
|
|
1571
|
-
kind?: string;
|
|
1572
|
-
}) {
|
|
1573
|
-
return {
|
|
1574
|
-
apiVersion: "serving.kserve.io/v1alpha1",
|
|
1575
|
-
kind: opts.kind ?? "ServingRuntime",
|
|
1576
|
-
metadata: { name: "vllm-runtime", namespace: "models" },
|
|
1577
|
-
spec: {
|
|
1578
|
-
containers: [
|
|
1579
|
-
{
|
|
1580
|
-
name: "kserve-container",
|
|
1581
|
-
image: "vllm/vllm-openai:v0.7.0",
|
|
1582
|
-
...(opts.resources && { resources: opts.resources }),
|
|
1583
|
-
},
|
|
1584
|
-
],
|
|
1585
|
-
...(opts.tolerations && { tolerations: opts.tolerations }),
|
|
1586
|
-
},
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
describe("WK8404: GPU request without a matching toleration", () => {
|
|
1591
|
-
test("flags a GPU request with no toleration", () => {
|
|
1592
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({
|
|
1593
|
-
resources: { requests: { "nvidia.com/gpu": "1" }, limits: { "nvidia.com/gpu": "1" } },
|
|
1594
|
-
})));
|
|
1595
|
-
const diags = wk8404.check(ctx);
|
|
1596
|
-
expect(diags.length).toBe(1);
|
|
1597
|
-
expect(diags[0].checkId).toBe("WK8404");
|
|
1598
|
-
expect(diags[0].severity).toBe("error");
|
|
1599
|
-
expect(diags[0].message).toContain("nvidia.com/gpu");
|
|
1600
|
-
});
|
|
1601
|
-
|
|
1602
|
-
test("passes with an explicit nvidia.com/gpu toleration", () => {
|
|
1603
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({
|
|
1604
|
-
resources: { requests: { "nvidia.com/gpu": "1" }, limits: { "nvidia.com/gpu": "1" } },
|
|
1605
|
-
tolerations: [{ key: "nvidia.com/gpu", operator: "Exists", effect: "NoSchedule" }],
|
|
1606
|
-
})));
|
|
1607
|
-
expect(wk8404.check(ctx).length).toBe(0);
|
|
1608
|
-
});
|
|
1609
|
-
|
|
1610
|
-
test("passes with a wildcard Exists toleration (no key)", () => {
|
|
1611
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({
|
|
1612
|
-
resources: { requests: { "nvidia.com/gpu": "1" } },
|
|
1613
|
-
tolerations: [{ operator: "Exists" }],
|
|
1614
|
-
})));
|
|
1615
|
-
expect(wk8404.check(ctx).length).toBe(0);
|
|
1616
|
-
});
|
|
1617
|
-
|
|
1618
|
-
test("skips containers that don't request a GPU", () => {
|
|
1619
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({
|
|
1620
|
-
resources: { requests: { cpu: "2" }, limits: { cpu: "2" } },
|
|
1621
|
-
})));
|
|
1622
|
-
expect(wk8404.check(ctx).length).toBe(0);
|
|
1623
|
-
});
|
|
1624
|
-
|
|
1625
|
-
test("also flags a plain Deployment requesting a GPU with no toleration", () => {
|
|
1626
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1627
|
-
apiVersion: "apps/v1",
|
|
1628
|
-
kind: "Deployment",
|
|
1629
|
-
metadata: { name: "gpu-app" },
|
|
1630
|
-
spec: {
|
|
1631
|
-
template: {
|
|
1632
|
-
spec: {
|
|
1633
|
-
containers: [
|
|
1634
|
-
{ name: "app", image: "app:1.0", resources: { requests: { "nvidia.com/gpu": "2" }, limits: { "nvidia.com/gpu": "2" } } },
|
|
1635
|
-
],
|
|
1636
|
-
},
|
|
1637
|
-
},
|
|
1638
|
-
},
|
|
1639
|
-
}));
|
|
1640
|
-
const diags = wk8404.check(ctx);
|
|
1641
|
-
expect(diags.length).toBe(1);
|
|
1642
|
-
expect(diags[0].entity).toBe("gpu-app");
|
|
1643
|
-
});
|
|
1644
|
-
});
|
|
1645
|
-
|
|
1646
|
-
// ── WK8405: Serving workload without a PodDisruptionBudget ─────────────────────
|
|
1647
|
-
|
|
1648
|
-
function inferenceService(opts: { name?: string; labels?: Record<string, string> }) {
|
|
1649
|
-
return {
|
|
1650
|
-
apiVersion: "serving.kserve.io/v1beta1",
|
|
1651
|
-
kind: "InferenceService",
|
|
1652
|
-
metadata: {
|
|
1653
|
-
name: opts.name ?? "llama-3-8b",
|
|
1654
|
-
namespace: "serving",
|
|
1655
|
-
labels: { "app.kubernetes.io/component": "inference-service", ...opts.labels },
|
|
1656
|
-
},
|
|
1657
|
-
spec: {
|
|
1658
|
-
predictor: {
|
|
1659
|
-
model: { runtime: "vllm-runtime", storageUri: "gs://my-models/llama-3-8b/v1" },
|
|
1660
|
-
},
|
|
1661
|
-
},
|
|
1662
|
-
};
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
function pdb(matchLabels: Record<string, string>) {
|
|
1666
|
-
return {
|
|
1667
|
-
apiVersion: "policy/v1",
|
|
1668
|
-
kind: "PodDisruptionBudget",
|
|
1669
|
-
metadata: { name: "pdb" },
|
|
1670
|
-
spec: { minAvailable: 1, selector: { matchLabels } },
|
|
1671
|
-
};
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
describe("WK8405: Serving workload without a PDB", () => {
|
|
1675
|
-
test("flags an InferenceService with no covering PDB", () => {
|
|
1676
|
-
const ctx = makeCtx(JSON.stringify(inferenceService({})));
|
|
1677
|
-
const diags = wk8405.check(ctx);
|
|
1678
|
-
expect(diags.length).toBe(1);
|
|
1679
|
-
expect(diags[0].checkId).toBe("WK8405");
|
|
1680
|
-
expect(diags[0].severity).toBe("info");
|
|
1681
|
-
});
|
|
1682
|
-
|
|
1683
|
-
test("passes when a PDB selector covers the InferenceService's labels", () => {
|
|
1684
|
-
const ctx = manifestsCtx(
|
|
1685
|
-
inferenceService({}),
|
|
1686
|
-
pdb({ "app.kubernetes.io/component": "inference-service" }),
|
|
1687
|
-
);
|
|
1688
|
-
expect(wk8405.check(ctx).length).toBe(0);
|
|
1689
|
-
});
|
|
1690
|
-
|
|
1691
|
-
test("flags a Deployment labeled as a serving component with no PDB", () => {
|
|
1692
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1693
|
-
apiVersion: "apps/v1",
|
|
1694
|
-
kind: "Deployment",
|
|
1695
|
-
metadata: { name: "serving-dep", labels: { "app.kubernetes.io/component": "vllm-serving-runtime" } },
|
|
1696
|
-
spec: { replicas: 1, template: { spec: { containers: [{ name: "app", image: "app:1.0" }] } } },
|
|
1697
|
-
}));
|
|
1698
|
-
const diags = wk8405.check(ctx);
|
|
1699
|
-
expect(diags.length).toBe(1);
|
|
1700
|
-
expect(diags[0].entity).toBe("serving-dep");
|
|
1701
|
-
});
|
|
1702
|
-
|
|
1703
|
-
test("ignores a plain Deployment with no serving component label", () => {
|
|
1704
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1705
|
-
apiVersion: "apps/v1",
|
|
1706
|
-
kind: "Deployment",
|
|
1707
|
-
metadata: { name: "other-dep", labels: { "app.kubernetes.io/component": "web" } },
|
|
1708
|
-
spec: { replicas: 1, template: { spec: { containers: [{ name: "app", image: "app:1.0" }] } } },
|
|
1709
|
-
}));
|
|
1710
|
-
expect(wk8405.check(ctx).length).toBe(0);
|
|
1711
|
-
});
|
|
1712
|
-
});
|
|
1713
|
-
|
|
1714
|
-
// ── WK8406: No resource limits on a GPU pod ─────────────────────────────────
|
|
1715
|
-
|
|
1716
|
-
describe("WK8406: GPU container missing resource limits", () => {
|
|
1717
|
-
test("flags a GPU-requesting container with no limits", () => {
|
|
1718
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({
|
|
1719
|
-
resources: { requests: { "nvidia.com/gpu": "1" } },
|
|
1720
|
-
})));
|
|
1721
|
-
const diags = wk8406.check(ctx);
|
|
1722
|
-
expect(diags.length).toBe(1);
|
|
1723
|
-
expect(diags[0].checkId).toBe("WK8406");
|
|
1724
|
-
expect(diags[0].severity).toBe("warning");
|
|
1725
|
-
expect(diags[0].message).toContain("cpu, memory");
|
|
1726
|
-
});
|
|
1727
|
-
|
|
1728
|
-
test("flags a GPU-requesting container missing only memory limit", () => {
|
|
1729
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({
|
|
1730
|
-
resources: { requests: { "nvidia.com/gpu": "1" }, limits: { cpu: "4", "nvidia.com/gpu": "1" } },
|
|
1731
|
-
})));
|
|
1732
|
-
const diags = wk8406.check(ctx);
|
|
1733
|
-
expect(diags.length).toBe(1);
|
|
1734
|
-
expect(diags[0].message).toContain("memory");
|
|
1735
|
-
expect(diags[0].message).not.toContain("cpu,");
|
|
1736
|
-
});
|
|
1737
|
-
|
|
1738
|
-
test("passes with full cpu/memory limits on the GPU container", () => {
|
|
1739
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({
|
|
1740
|
-
resources: { requests: { "nvidia.com/gpu": "1" }, limits: { cpu: "4", memory: "16Gi", "nvidia.com/gpu": "1" } },
|
|
1741
|
-
})));
|
|
1742
|
-
expect(wk8406.check(ctx).length).toBe(0);
|
|
1743
|
-
});
|
|
1744
|
-
|
|
1745
|
-
test("ignores containers with no GPU request even without limits", () => {
|
|
1746
|
-
const ctx = makeCtx(JSON.stringify(servingRuntime({})));
|
|
1747
|
-
expect(wk8406.check(ctx).length).toBe(0);
|
|
1748
|
-
});
|
|
1749
|
-
});
|
|
1750
|
-
|
|
1751
|
-
// ── WK8407: Unpinned model version ──────────────────────────────────────────
|
|
1752
|
-
|
|
1753
|
-
describe("WK8407: Unpinned model version", () => {
|
|
1754
|
-
test("flags a storageUri with no version segment", () => {
|
|
1755
|
-
const manifest = inferenceService({});
|
|
1756
|
-
manifest.spec.predictor.model.storageUri = "gs://my-models-bucket";
|
|
1757
|
-
const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
|
|
1758
|
-
expect(diags.length).toBe(1);
|
|
1759
|
-
expect(diags[0].checkId).toBe("WK8407");
|
|
1760
|
-
expect(diags[0].severity).toBe("warning");
|
|
1761
|
-
});
|
|
1762
|
-
|
|
1763
|
-
test("flags a floating tag (latest) as unpinned", () => {
|
|
1764
|
-
const manifest = inferenceService({});
|
|
1765
|
-
manifest.spec.predictor.model.storageUri = "gs://my-models-bucket/llama-3-8b/latest";
|
|
1766
|
-
const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
|
|
1767
|
-
expect(diags.length).toBe(1);
|
|
1768
|
-
});
|
|
1769
|
-
|
|
1770
|
-
test("passes a pinned storageUri (scheme://id/version)", () => {
|
|
1771
|
-
const manifest = inferenceService({});
|
|
1772
|
-
manifest.spec.predictor.model.storageUri = "gs://my-models/llama-3-8b/2024-07-01";
|
|
1773
|
-
const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
|
|
1774
|
-
expect(diags.length).toBe(0);
|
|
1775
|
-
});
|
|
1776
|
-
|
|
1777
|
-
test("passes a pinned storageUri with a semver version", () => {
|
|
1778
|
-
const manifest = inferenceService({});
|
|
1779
|
-
manifest.spec.predictor.model.storageUri = "hf://meta-llama/Llama-3-8B/v1.0.0";
|
|
1780
|
-
const diags = wk8407.check(makeCtx(JSON.stringify(manifest)));
|
|
1781
|
-
expect(diags.length).toBe(0);
|
|
1782
|
-
});
|
|
1783
|
-
|
|
1784
|
-
test("ignores non-InferenceService manifests", () => {
|
|
1785
|
-
const ctx = makeCtx(JSON.stringify({
|
|
1786
|
-
apiVersion: "apps/v1",
|
|
1787
|
-
kind: "Deployment",
|
|
1788
|
-
metadata: { name: "app" },
|
|
1789
|
-
spec: { template: { spec: { containers: [{ name: "app", image: "app:1.0" }] } } },
|
|
1790
|
-
}));
|
|
1791
|
-
expect(wk8407.check(ctx).length).toBe(0);
|
|
1792
|
-
});
|
|
1793
|
-
});
|
|
1794
|
-
|
|
1795
|
-
// ── ARGO002: Application.spec.project references a declared AppProject ─────────
|
|
1796
|
-
|
|
1797
|
-
function argoApp(name: string, spec: Record<string, unknown>) {
|
|
1798
|
-
return { apiVersion: "argoproj.io/v1alpha1", kind: "Application", metadata: { name }, spec };
|
|
1799
|
-
}
|
|
1800
|
-
function appProject(name: string) {
|
|
1801
|
-
return { apiVersion: "argoproj.io/v1alpha1", kind: "AppProject", metadata: { name }, spec: {} };
|
|
1802
|
-
}
|
|
1803
|
-
const inClusterDest = { server: "https://kubernetes.default.svc", namespace: "demo" };
|
|
1804
|
-
|
|
1805
|
-
describe("ARGO002: Application project references a declared AppProject", () => {
|
|
1806
|
-
test("metadata", () => {
|
|
1807
|
-
expect(argo002.id).toBe("ARGO002");
|
|
1808
|
-
});
|
|
1809
|
-
|
|
1810
|
-
test("flags an Application referencing an undeclared project", () => {
|
|
1811
|
-
const ctx = manifestsCtx(argoApp("api", { project: "team-a", destination: inClusterDest }));
|
|
1812
|
-
const diags = argo002.check(ctx);
|
|
1813
|
-
expect(diags.length).toBe(1);
|
|
1814
|
-
expect(diags[0].checkId).toBe("ARGO002");
|
|
1815
|
-
expect(diags[0].message).toContain("team-a");
|
|
1816
|
-
});
|
|
1817
|
-
|
|
1818
|
-
test("passes when the AppProject is declared in the same build", () => {
|
|
1819
|
-
const ctx = manifestsCtx(
|
|
1820
|
-
appProject("team-a"),
|
|
1821
|
-
argoApp("api", { project: "team-a", destination: inClusterDest }),
|
|
1822
|
-
);
|
|
1823
|
-
expect(argo002.check(ctx).length).toBe(0);
|
|
1824
|
-
});
|
|
1825
|
-
|
|
1826
|
-
test("does NOT flag the built-in default project", () => {
|
|
1827
|
-
const ctx = manifestsCtx(argoApp("api", { project: "default", destination: inClusterDest }));
|
|
1828
|
-
expect(argo002.check(ctx).length).toBe(0);
|
|
1829
|
-
});
|
|
1830
|
-
});
|
|
1831
|
-
|
|
1832
|
-
// ── ARGO003: Application destination references a registered cluster ──────────
|
|
1833
|
-
|
|
1834
|
-
function clusterSecret(name: string, server: string) {
|
|
1835
|
-
return {
|
|
1836
|
-
apiVersion: "v1",
|
|
1837
|
-
kind: "Secret",
|
|
1838
|
-
metadata: { name, labels: { "argocd.argoproj.io/secret-type": "cluster" } },
|
|
1839
|
-
stringData: { name, server },
|
|
1840
|
-
};
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
describe("ARGO003: Application destination references a registered cluster", () => {
|
|
1844
|
-
test("metadata", () => {
|
|
1845
|
-
expect(argo003.id).toBe("ARGO003");
|
|
1846
|
-
});
|
|
1847
|
-
|
|
1848
|
-
test("does NOT flag the in-cluster destination", () => {
|
|
1849
|
-
const ctx = manifestsCtx(argoApp("api", { project: "default", destination: inClusterDest }));
|
|
1850
|
-
expect(argo003.check(ctx).length).toBe(0);
|
|
1851
|
-
});
|
|
1852
|
-
|
|
1853
|
-
test("flags an unregistered cluster server", () => {
|
|
1854
|
-
const ctx = manifestsCtx(
|
|
1855
|
-
argoApp("api", { project: "default", destination: { server: "https://prod.example.com", namespace: "demo" } }),
|
|
1856
|
-
);
|
|
1857
|
-
const diags = argo003.check(ctx);
|
|
1858
|
-
expect(diags.length).toBe(1);
|
|
1859
|
-
expect(diags[0].checkId).toBe("ARGO003");
|
|
1860
|
-
expect(diags[0].message).toContain("prod.example.com");
|
|
1861
|
-
});
|
|
1862
|
-
|
|
1863
|
-
test("passes when the cluster is registered via a cluster Secret", () => {
|
|
1864
|
-
const ctx = manifestsCtx(
|
|
1865
|
-
clusterSecret("prod", "https://prod.example.com"),
|
|
1866
|
-
argoApp("api", { project: "default", destination: { server: "https://prod.example.com", namespace: "demo" } }),
|
|
1867
|
-
);
|
|
1868
|
-
expect(argo003.check(ctx).length).toBe(0);
|
|
1869
|
-
});
|
|
1870
|
-
|
|
1871
|
-
test("flags a destination with neither server nor name", () => {
|
|
1872
|
-
const ctx = manifestsCtx(argoApp("api", { project: "default", destination: { namespace: "demo" } }));
|
|
1873
|
-
expect(argo003.check(ctx).length).toBe(1);
|
|
1874
|
-
});
|
|
1875
|
-
});
|
|
1876
|
-
|
|
1877
|
-
// ── ARGO005: Application source.path resolves to an existing directory ────────
|
|
1878
|
-
|
|
1879
|
-
describe("ARGO005: Application source path exists", () => {
|
|
1880
|
-
test("metadata", () => {
|
|
1881
|
-
expect(argo005.id).toBe("ARGO005");
|
|
1882
|
-
});
|
|
1883
|
-
|
|
1884
|
-
test("does NOT flag a path that exists under the build root", () => {
|
|
1885
|
-
// `lexicons` is a directory at the repo root (the vitest cwd).
|
|
1886
|
-
const ctx = manifestsCtx(
|
|
1887
|
-
argoApp("api", { project: "default", destination: inClusterDest, source: { repoURL: "x", path: "lexicons" } }),
|
|
1888
|
-
);
|
|
1889
|
-
expect(argo005.check(ctx).length).toBe(0);
|
|
1890
|
-
});
|
|
1891
|
-
|
|
1892
|
-
test("warns on a path that does not resolve to a directory", () => {
|
|
1893
|
-
const ctx = manifestsCtx(
|
|
1894
|
-
argoApp("api", { project: "default", destination: inClusterDest, source: { repoURL: "x", path: "no-such-argo-dir-xyz" } }),
|
|
1895
|
-
);
|
|
1896
|
-
const diags = argo005.check(ctx);
|
|
1897
|
-
expect(diags.length).toBe(1);
|
|
1898
|
-
expect(diags[0].checkId).toBe("ARGO005");
|
|
1899
|
-
expect(diags[0].severity).toBe("warning");
|
|
1900
|
-
});
|
|
1901
|
-
|
|
1902
|
-
test("skips Helm chart sources", () => {
|
|
1903
|
-
const ctx = manifestsCtx(
|
|
1904
|
-
argoApp("api", { project: "default", destination: inClusterDest, source: { repoURL: "x", chart: "redis" } }),
|
|
1905
|
-
);
|
|
1906
|
-
expect(argo005.check(ctx).length).toBe(0);
|
|
1907
|
-
});
|
|
1908
|
-
});
|
|
1909
|
-
|
|
1910
|
-
// ── FLUX002: Kustomization sourceRef references a declared source ─────────────
|
|
1911
|
-
|
|
1912
|
-
function fluxKustomization(name: string, spec: Record<string, unknown>) {
|
|
1913
|
-
return {
|
|
1914
|
-
apiVersion: "kustomize.toolkit.fluxcd.io/v1",
|
|
1915
|
-
kind: "Kustomization",
|
|
1916
|
-
metadata: { name, namespace: "flux-system" },
|
|
1917
|
-
spec: { interval: "10m", path: "./k8s", prune: true, wait: true, ...spec },
|
|
1918
|
-
};
|
|
1919
|
-
}
|
|
1920
|
-
function fluxGitRepository(name: string) {
|
|
1921
|
-
return {
|
|
1922
|
-
apiVersion: "source.toolkit.fluxcd.io/v1",
|
|
1923
|
-
kind: "GitRepository",
|
|
1924
|
-
metadata: { name, namespace: "flux-system" },
|
|
1925
|
-
spec: { interval: "5m", url: `https://example.com/${name}`, ref: { branch: "main" } },
|
|
1926
|
-
};
|
|
1927
|
-
}
|
|
1928
|
-
const gitSourceRef = (name: string) => ({ sourceRef: { kind: "GitRepository", name } });
|
|
1929
|
-
|
|
1930
|
-
describe("FLUX002: Kustomization sourceRef references a declared source", () => {
|
|
1931
|
-
test("metadata", () => {
|
|
1932
|
-
expect(flux002.id).toBe("FLUX002");
|
|
1933
|
-
});
|
|
1934
|
-
|
|
1935
|
-
test("flags a Kustomization referencing an undeclared GitRepository", () => {
|
|
1936
|
-
const ctx = manifestsCtx(fluxKustomization("hello", gitSourceRef("home-chant")));
|
|
1937
|
-
const diags = flux002.check(ctx);
|
|
1938
|
-
expect(diags.length).toBe(1);
|
|
1939
|
-
expect(diags[0].checkId).toBe("FLUX002");
|
|
1940
|
-
expect(diags[0].severity).toBe("error");
|
|
1941
|
-
expect(diags[0].message).toContain("home-chant");
|
|
1942
|
-
});
|
|
1943
|
-
|
|
1944
|
-
test("passes when the GitRepository is declared in the same build", () => {
|
|
1945
|
-
const ctx = manifestsCtx(
|
|
1946
|
-
fluxGitRepository("home-chant"),
|
|
1947
|
-
fluxKustomization("hello", gitSourceRef("home-chant")),
|
|
1948
|
-
);
|
|
1949
|
-
expect(flux002.check(ctx).length).toBe(0);
|
|
1950
|
-
});
|
|
1951
|
-
|
|
1952
|
-
test("does NOT flag the bootstrap-created flux-system source", () => {
|
|
1953
|
-
const ctx = manifestsCtx(fluxKustomization("mealie", gitSourceRef("flux-system")));
|
|
1954
|
-
expect(flux002.check(ctx).length).toBe(0);
|
|
1955
|
-
});
|
|
1956
|
-
|
|
1957
|
-
test("matches on source kind — a GitRepository does not satisfy an OCIRepository ref", () => {
|
|
1958
|
-
const ctx = manifestsCtx(
|
|
1959
|
-
fluxGitRepository("fountain"),
|
|
1960
|
-
fluxKustomization("fountain", { sourceRef: { kind: "OCIRepository", name: "fountain" } }),
|
|
1961
|
-
);
|
|
1962
|
-
const diags = flux002.check(ctx);
|
|
1963
|
-
expect(diags.length).toBe(1);
|
|
1964
|
-
expect(diags[0].message).toContain("OCIRepository");
|
|
1965
|
-
});
|
|
1966
|
-
|
|
1967
|
-
test("flags a Kustomization with no sourceRef at all", () => {
|
|
1968
|
-
const ctx = manifestsCtx(fluxKustomization("hello", {}));
|
|
1969
|
-
const diags = flux002.check(ctx);
|
|
1970
|
-
expect(diags.length).toBe(1);
|
|
1971
|
-
expect(diags[0].message).toContain("no spec.sourceRef.name");
|
|
1972
|
-
});
|
|
1973
|
-
|
|
1974
|
-
test("skips kustomize.config.k8s.io Kustomizations (not Flux CRs)", () => {
|
|
1975
|
-
const ctx = manifestsCtx({
|
|
1976
|
-
apiVersion: "kustomize.config.k8s.io/v1beta1",
|
|
1977
|
-
kind: "Kustomization",
|
|
1978
|
-
metadata: { name: "overlay" },
|
|
1979
|
-
spec: {},
|
|
1980
|
-
});
|
|
1981
|
-
expect(flux002.check(ctx).length).toBe(0);
|
|
1982
|
-
});
|
|
1983
|
-
});
|
|
1984
|
-
|
|
1985
|
-
// ── FLUX003: Kustomization dependsOn names declared Kustomizations ────────────
|
|
1986
|
-
|
|
1987
|
-
describe("FLUX003: Kustomization dependsOn names declared Kustomizations", () => {
|
|
1988
|
-
test("metadata", () => {
|
|
1989
|
-
expect(flux003.id).toBe("FLUX003");
|
|
1990
|
-
});
|
|
1991
|
-
|
|
1992
|
-
test("flags a dependsOn entry nothing in the build declares", () => {
|
|
1993
|
-
const ctx = manifestsCtx(
|
|
1994
|
-
fluxKustomization("hello", { ...gitSourceRef("flux-system"), dependsOn: [{ name: "cert-manger" }] }),
|
|
1995
|
-
);
|
|
1996
|
-
const diags = flux003.check(ctx);
|
|
1997
|
-
expect(diags.length).toBe(1);
|
|
1998
|
-
expect(diags[0].checkId).toBe("FLUX003");
|
|
1999
|
-
expect(diags[0].severity).toBe("warning");
|
|
2000
|
-
expect(diags[0].message).toContain("cert-manger");
|
|
2001
|
-
});
|
|
2002
|
-
|
|
2003
|
-
test("passes when every dependency is declared", () => {
|
|
2004
|
-
const ctx = manifestsCtx(
|
|
2005
|
-
fluxKustomization("cert-manager", gitSourceRef("flux-system")),
|
|
2006
|
-
fluxKustomization("traefik", gitSourceRef("flux-system")),
|
|
2007
|
-
fluxKustomization("hello", {
|
|
2008
|
-
...gitSourceRef("flux-system"),
|
|
2009
|
-
dependsOn: [{ name: "cert-manager" }, { name: "traefik" }],
|
|
2010
|
-
}),
|
|
2011
|
-
);
|
|
2012
|
-
expect(flux003.check(ctx).length).toBe(0);
|
|
2013
|
-
});
|
|
2014
|
-
|
|
2015
|
-
test("flags a self-referencing dependsOn entry", () => {
|
|
2016
|
-
const ctx = manifestsCtx(
|
|
2017
|
-
fluxKustomization("hello", { ...gitSourceRef("flux-system"), dependsOn: [{ name: "hello" }] }),
|
|
2018
|
-
);
|
|
2019
|
-
const diags = flux003.check(ctx);
|
|
2020
|
-
expect(diags.length).toBe(1);
|
|
2021
|
-
expect(diags[0].message).toContain("itself");
|
|
2022
|
-
});
|
|
2023
|
-
|
|
2024
|
-
test("reports every broken edge, not just the first", () => {
|
|
2025
|
-
const ctx = manifestsCtx(
|
|
2026
|
-
fluxKustomization("hello", {
|
|
2027
|
-
...gitSourceRef("flux-system"),
|
|
2028
|
-
dependsOn: [{ name: "nope-a" }, { name: "nope-b" }],
|
|
2029
|
-
}),
|
|
2030
|
-
);
|
|
2031
|
-
expect(flux003.check(ctx).length).toBe(2);
|
|
2032
|
-
});
|
|
2033
|
-
|
|
2034
|
-
test("skips a Kustomization without dependsOn", () => {
|
|
2035
|
-
const ctx = manifestsCtx(fluxKustomization("hello", gitSourceRef("flux-system")));
|
|
2036
|
-
expect(flux003.check(ctx).length).toBe(0);
|
|
2037
|
-
});
|
|
2038
|
-
});
|
|
2039
|
-
|
|
2040
|
-
// ── WK8501 / WK8502: custom-resource spec against the CRD schema (chant #1372) ──
|
|
2041
|
-
|
|
2042
|
-
describe("WK8501/WK8502: custom resource spec validated against the shipped CRD schema", () => {
|
|
2043
|
-
const hasLexicon = getCrdSchemaRegistry().size > 0;
|
|
2044
|
-
|
|
2045
|
-
function microVm(spec: Record<string, unknown>) {
|
|
2046
|
-
return {
|
|
2047
|
-
apiVersion: "lambda.aws.amazon.com/v1alpha1",
|
|
2048
|
-
kind: "MicroVM",
|
|
2049
|
-
metadata: { name: "agent-1", namespace: "vms" },
|
|
2050
|
-
spec,
|
|
2051
|
-
};
|
|
2052
|
-
}
|
|
2053
|
-
|
|
2054
|
-
// chant #13 — CAPI's own Cluster (K8s::CAPI::Cluster) and ACK's S3 Bucket
|
|
2055
|
-
// (K8s::S3::Bucket), the CAPI/CAPA and ACK kinds this suite's WK8501/WK8502
|
|
2056
|
-
// coverage exercises. Same shape as `microVm` above: a bare manifest, spec
|
|
2057
|
-
// supplied per test.
|
|
2058
|
-
function capiCluster(spec: Record<string, unknown>) {
|
|
2059
|
-
return {
|
|
2060
|
-
apiVersion: "cluster.x-k8s.io/v1beta2",
|
|
2061
|
-
kind: "Cluster",
|
|
2062
|
-
metadata: { name: "prod-cluster", namespace: "capi-system" },
|
|
2063
|
-
spec,
|
|
2064
|
-
};
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
function ackBucket(spec: Record<string, unknown>) {
|
|
2068
|
-
return {
|
|
2069
|
-
apiVersion: "s3.services.k8s.aws/v1alpha1",
|
|
2070
|
-
kind: "Bucket",
|
|
2071
|
-
metadata: { name: "build-artifacts", namespace: "aws-system" },
|
|
2072
|
-
spec,
|
|
2073
|
-
};
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
test("metadata", () => {
|
|
2077
|
-
expect(wk8501.id).toBe("WK8501");
|
|
2078
|
-
expect(wk8502.id).toBe("WK8502");
|
|
2079
|
-
});
|
|
2080
|
-
|
|
2081
|
-
test.skipIf(!hasLexicon)("the lexicon ships a spec schema for every CRD-derived kind", () => {
|
|
2082
|
-
const registry = getCrdSchemaRegistry();
|
|
2083
|
-
for (const key of ["lambda.aws.amazon.com/v1alpha1/MicroVM", "cert-manager.io/v1/Certificate", "ray.io/v1/RayCluster"]) {
|
|
2084
|
-
expect(registry.get(key)?.type, key).toBe("object");
|
|
2085
|
-
}
|
|
2086
|
-
// Built-in kinds are typed by the .d.ts and carry no schema.
|
|
2087
|
-
expect(registry.has("apps/v1/Deployment")).toBe(false);
|
|
2088
|
-
});
|
|
2089
|
-
|
|
2090
|
-
test.skipIf(!hasLexicon)("WK8501 flags a misspelled MicroVM field and suggests the real one", () => {
|
|
2091
|
-
// The kubemicrovm-ops case from #1372: `classname` type-checks, applies
|
|
2092
|
-
// cleanly, and the controller runs the VM with the default class.
|
|
2093
|
-
const ctx = manifestsCtx(microVm({ classname: "large", imageRef: "img" }));
|
|
2094
|
-
const diags = wk8501.check(ctx);
|
|
2095
|
-
expect(diags.length).toBe(1);
|
|
2096
|
-
expect(diags[0].severity).toBe("error");
|
|
2097
|
-
expect(diags[0].entity).toBe("agent-1");
|
|
2098
|
-
expect(diags[0].message).toContain('unknown field "spec.classname"');
|
|
2099
|
-
expect(diags[0].message).toContain('did you mean "className"');
|
|
2100
|
-
// WK8502 has nothing to say about a field the schema does not know.
|
|
2101
|
-
expect(wk8502.check(ctx).length).toBe(0);
|
|
2102
|
-
});
|
|
2103
|
-
|
|
2104
|
-
test.skipIf(!hasLexicon)("WK8502 flags a wrong-typed scalar and a value outside its enum", () => {
|
|
2105
|
-
const ctx = manifestsCtx(microVm({
|
|
2106
|
-
className: "large",
|
|
2107
|
-
maxIdleDurationSeconds: "300",
|
|
2108
|
-
desiredState: "Runing",
|
|
2109
|
-
autoResumeEnabled: "yes",
|
|
2110
|
-
}));
|
|
2111
|
-
const diags = wk8502.check(ctx);
|
|
2112
|
-
const messages = diags.map((d) => d.message);
|
|
2113
|
-
expect(messages).toEqual([
|
|
2114
|
-
expect.stringContaining('"spec.maxIdleDurationSeconds" expects an integer, got string "300"'),
|
|
2115
|
-
expect.stringContaining('"spec.desiredState" must be one of "Running", "Suspended", "Terminated", got string "Runing"'),
|
|
2116
|
-
expect.stringContaining('"spec.autoResumeEnabled" expects a boolean, got string "yes"'),
|
|
2117
|
-
]);
|
|
2118
|
-
expect(diags.every((d) => d.checkId === "WK8502" && d.severity === "error")).toBe(true);
|
|
2119
|
-
expect(wk8501.check(ctx).length).toBe(0);
|
|
2120
|
-
});
|
|
2121
|
-
|
|
2122
|
-
test.skipIf(!hasLexicon)("a well-formed custom resource passes both checks", () => {
|
|
2123
|
-
const ctx = manifestsCtx(
|
|
2124
|
-
microVm({ className: "large", desiredState: "Running", maxIdleDurationSeconds: 300, tags: { team: "ml", any: 1 } }),
|
|
2125
|
-
{
|
|
2126
|
-
apiVersion: "cert-manager.io/v1",
|
|
2127
|
-
kind: "Certificate",
|
|
2128
|
-
metadata: { name: "web-tls" },
|
|
2129
|
-
spec: {
|
|
2130
|
-
secretName: "web-tls",
|
|
2131
|
-
dnsNames: ["example.com"],
|
|
2132
|
-
issuerRef: { name: "letsencrypt", kind: "ClusterIssuer" },
|
|
2133
|
-
privateKey: { algorithm: "ECDSA", size: 256 },
|
|
2134
|
-
},
|
|
2135
|
-
},
|
|
2136
|
-
);
|
|
2137
|
-
expect(wk8501.check(ctx)).toEqual([]);
|
|
2138
|
-
expect(wk8502.check(ctx)).toEqual([]);
|
|
2139
|
-
});
|
|
2140
|
-
|
|
2141
|
-
test.skipIf(!hasLexicon)("walks nested objects and array elements", () => {
|
|
2142
|
-
const ctx = manifestsCtx({
|
|
2143
|
-
apiVersion: "cert-manager.io/v1",
|
|
2144
|
-
kind: "Certificate",
|
|
2145
|
-
metadata: { name: "web-tls" },
|
|
2146
|
-
spec: {
|
|
2147
|
-
secretName: "web-tls",
|
|
2148
|
-
issuerRef: { nmae: "letsencrypt" },
|
|
2149
|
-
additionalOutputFormats: [{ type: "DER" }, { type: "PEM" }],
|
|
2150
|
-
privateKey: { algorithm: "DSA" },
|
|
2151
|
-
},
|
|
2152
|
-
});
|
|
2153
|
-
expect(wk8501.check(ctx).map((d) => d.message)).toEqual([
|
|
2154
|
-
expect.stringContaining('unknown field "spec.issuerRef.nmae" (did you mean "name"?)'),
|
|
2155
|
-
]);
|
|
2156
|
-
expect(wk8502.check(ctx).map((d) => d.message)).toEqual([
|
|
2157
|
-
expect.stringContaining('"spec.additionalOutputFormats[1].type" must be one of "DER", "CombinedPEM"'),
|
|
2158
|
-
expect.stringContaining('"spec.privateKey.algorithm" must be one of "RSA", "ECDSA", "Ed25519"'),
|
|
2159
|
-
]);
|
|
2160
|
-
});
|
|
2161
|
-
|
|
2162
|
-
// chant #13 — coverage proving the epic's actual point: the CAPI/CAPA and
|
|
2163
|
-
// ACK sources added in #10/#11/#12 carry the same WK8501/WK8502 schema
|
|
2164
|
-
// guarantee as every other CRD source, not just types with no lint behind
|
|
2165
|
-
// them.
|
|
2166
|
-
|
|
2167
|
-
test.skipIf(!hasLexicon)("WK8501 flags a misspelled CAPI Cluster field and suggests the real one", () => {
|
|
2168
|
-
const ctx = manifestsCtx(capiCluster({ paused: true, clusterNetwok: { serviceDomain: "cluster.local" } }));
|
|
2169
|
-
const diags = wk8501.check(ctx);
|
|
2170
|
-
expect(diags.length).toBe(1);
|
|
2171
|
-
expect(diags[0].severity).toBe("error");
|
|
2172
|
-
expect(diags[0].entity).toBe("prod-cluster");
|
|
2173
|
-
expect(diags[0].message).toContain('unknown field "spec.clusterNetwok"');
|
|
2174
|
-
expect(diags[0].message).toContain('did you mean "clusterNetwork"');
|
|
2175
|
-
// WK8502 has nothing to say about a field the schema does not know.
|
|
2176
|
-
expect(wk8502.check(ctx).length).toBe(0);
|
|
2177
|
-
});
|
|
2178
|
-
|
|
2179
|
-
test.skipIf(!hasLexicon)("WK8502 flags a wrong-typed scalar and an out-of-enum value on CAPI Cluster", () => {
|
|
2180
|
-
const ctx = manifestsCtx(capiCluster({
|
|
2181
|
-
paused: "yes",
|
|
2182
|
-
availabilityGates: [{ conditionType: "Ready", polarity: "Postive" }],
|
|
2183
|
-
}));
|
|
2184
|
-
const diags = wk8502.check(ctx);
|
|
2185
|
-
const messages = diags.map((d) => d.message);
|
|
2186
|
-
expect(messages).toEqual([
|
|
2187
|
-
expect.stringContaining('"spec.paused" expects a boolean, got string "yes"'),
|
|
2188
|
-
expect.stringContaining('"spec.availabilityGates[0].polarity" must be one of "Positive", "Negative", got string "Postive"'),
|
|
2189
|
-
]);
|
|
2190
|
-
expect(diags.every((d) => d.checkId === "WK8502" && d.severity === "error")).toBe(true);
|
|
2191
|
-
expect(wk8501.check(ctx).length).toBe(0);
|
|
2192
|
-
});
|
|
2193
|
-
|
|
2194
|
-
test.skipIf(!hasLexicon)("WK8501 flags a misspelled ACK S3 Bucket field and suggests the real one", () => {
|
|
2195
|
-
const ctx = manifestsCtx(ackBucket({ nmae: "build-artifacts", objectLockEnabledForBucket: true }));
|
|
2196
|
-
const diags = wk8501.check(ctx);
|
|
2197
|
-
expect(diags.length).toBe(1);
|
|
2198
|
-
expect(diags[0].severity).toBe("error");
|
|
2199
|
-
expect(diags[0].entity).toBe("build-artifacts");
|
|
2200
|
-
expect(diags[0].message).toContain('unknown field "spec.nmae"');
|
|
2201
|
-
expect(diags[0].message).toContain('did you mean "name"');
|
|
2202
|
-
expect(wk8502.check(ctx).length).toBe(0);
|
|
2203
|
-
});
|
|
2204
|
-
|
|
2205
|
-
test.skipIf(!hasLexicon)("WK8502 flags a wrong-typed scalar on ACK S3 Bucket", () => {
|
|
2206
|
-
const ctx = manifestsCtx(ackBucket({ name: "build-artifacts", objectLockEnabledForBucket: "true" }));
|
|
2207
|
-
const diags = wk8502.check(ctx);
|
|
2208
|
-
expect(diags.length).toBe(1);
|
|
2209
|
-
expect(diags[0].checkId).toBe("WK8502");
|
|
2210
|
-
expect(diags[0].severity).toBe("error");
|
|
2211
|
-
expect(diags[0].message).toContain('"spec.objectLockEnabledForBucket" expects a boolean, got string "true"');
|
|
2212
|
-
expect(wk8501.check(ctx).length).toBe(0);
|
|
2213
|
-
});
|
|
2214
|
-
|
|
2215
|
-
test("built-in kinds and unknown apiVersion/kind pairs are never checked", () => {
|
|
2216
|
-
const ctx = manifestsCtx(
|
|
2217
|
-
{ apiVersion: "apps/v1", kind: "Deployment", metadata: { name: "web" }, spec: { replicas: "2", bogus: true } },
|
|
2218
|
-
{ apiVersion: "example.com/v1", kind: "Widget", metadata: { name: "w" }, spec: { bogus: true } },
|
|
2219
|
-
);
|
|
2220
|
-
expect(wk8501.check(ctx)).toEqual([]);
|
|
2221
|
-
expect(wk8502.check(ctx)).toEqual([]);
|
|
2222
|
-
});
|
|
2223
|
-
|
|
2224
|
-
// chant #2013 — the Argo AppProject from behold's example-argo-estate, as
|
|
2225
|
-
// YAML text rather than JSON on purpose: `sourceRepos` is a list of bare
|
|
2226
|
-
// URLs, and the core parser used to hand this check `{ https: "//github…" }`
|
|
2227
|
-
// for each one. WK8502 then reported an object on a field the source had
|
|
2228
|
-
// declared, and the emitter had written, as a string.
|
|
2229
|
-
test.skipIf(!hasLexicon)("a bare URL in an AppProject's sourceRepos reaches the check as a string", () => {
|
|
2230
|
-
const ctx = makeCtx([
|
|
2231
|
-
"apiVersion: argoproj.io/v1alpha1",
|
|
2232
|
-
"kind: AppProject",
|
|
2233
|
-
"metadata:",
|
|
2234
|
-
" name: estate",
|
|
2235
|
-
"spec:",
|
|
2236
|
-
" sourceRepos:",
|
|
2237
|
-
" - https://github.com/INTENTIUS/behold",
|
|
2238
|
-
" destinations:",
|
|
2239
|
-
" - namespace: '*'",
|
|
2240
|
-
" server: https://kubernetes.default.svc",
|
|
2241
|
-
"",
|
|
2242
|
-
].join("\n"));
|
|
2243
|
-
expect(wk8501.check(ctx)).toEqual([]);
|
|
2244
|
-
expect(wk8502.check(ctx)).toEqual([]);
|
|
2245
|
-
});
|
|
2246
|
-
|
|
2247
|
-
test("open objects and int-or-string accept anything (stub registry)", () => {
|
|
2248
|
-
setCrdSchemaRegistry(new Map([[
|
|
2249
|
-
"example.com/v1/Widget",
|
|
2250
|
-
{
|
|
2251
|
-
type: "object",
|
|
2252
|
-
fields: {
|
|
2253
|
-
labels: { type: "object", open: true },
|
|
2254
|
-
port: { open: true },
|
|
2255
|
-
replicas: { type: "integer" },
|
|
2256
|
-
items: { type: "array", items: { type: "string" } },
|
|
2257
|
-
},
|
|
2258
|
-
},
|
|
2259
|
-
]]));
|
|
2260
|
-
try {
|
|
2261
|
-
const ok = manifestsCtx({
|
|
2262
|
-
apiVersion: "example.com/v1", kind: "Widget", metadata: { name: "w" },
|
|
2263
|
-
spec: { labels: { anything: { nested: true } }, port: "http", replicas: 2, items: ["a"] },
|
|
2264
|
-
});
|
|
2265
|
-
expect(wk8501.check(ok)).toEqual([]);
|
|
2266
|
-
expect(wk8502.check(ok)).toEqual([]);
|
|
2267
|
-
|
|
2268
|
-
const bad = manifestsCtx({
|
|
2269
|
-
apiVersion: "example.com/v1", kind: "Widget", metadata: { name: "w" },
|
|
2270
|
-
spec: { replicas: 2.5, items: "a" },
|
|
2271
|
-
});
|
|
2272
|
-
expect(wk8502.check(bad).map((d) => d.message)).toEqual([
|
|
2273
|
-
expect.stringContaining('"spec.replicas" expects an integer, got number 2.5'),
|
|
2274
|
-
expect.stringContaining('"spec.items" expects an array, got string "a"'),
|
|
2275
|
-
]);
|
|
2276
|
-
} finally {
|
|
2277
|
-
setCrdSchemaRegistry(null);
|
|
2278
|
-
}
|
|
2279
|
-
});
|
|
2280
|
-
|
|
2281
|
-
test("validateSpec reports unknown fields and type mismatches with dotted paths", () => {
|
|
2282
|
-
const schema = { type: "object" as const, fields: { a: { type: "object" as const, fields: { b: { type: "boolean" as const } } } } };
|
|
2283
|
-
expect(validateSpec({ a: { b: "x", c: 1 }, d: 2 }, schema)).toEqual([
|
|
2284
|
-
{ kind: "type-mismatch", path: "spec.a.b", message: expect.stringContaining("expects a boolean") },
|
|
2285
|
-
{ kind: "unknown-field", path: "spec.a.c", message: expect.stringContaining('unknown field "spec.a.c"') },
|
|
2286
|
-
{ kind: "unknown-field", path: "spec.d", message: expect.stringContaining('unknown field "spec.d"') },
|
|
2287
|
-
]);
|
|
2288
|
-
});
|
|
2289
|
-
});
|
|
2290
|
-
|
|
2291
|
-
// ── WK8503: consumed-but-unproduced Secret ──────────────────────────
|
|
2292
|
-
|
|
2293
|
-
describe("WK8503: workload consumes a Secret nothing in the output produces", () => {
|
|
2294
|
-
function appConsuming(name: string) {
|
|
2295
|
-
return {
|
|
2296
|
-
apiVersion: "apps/v1",
|
|
2297
|
-
kind: "Deployment",
|
|
2298
|
-
metadata: { name: "app", namespace: "web" },
|
|
2299
|
-
spec: {
|
|
2300
|
-
template: {
|
|
2301
|
-
spec: {
|
|
2302
|
-
containers: [
|
|
2303
|
-
{ name: "app", image: "app:1.0", envFrom: [{ secretRef: { name } }] },
|
|
2304
|
-
],
|
|
2305
|
-
},
|
|
2306
|
-
},
|
|
2307
|
-
},
|
|
2308
|
-
};
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
|
-
/** Like manifestsCtx, but with SecretProvenance declarations discovered as entities. */
|
|
2312
|
-
function ctxWithDeclarations(decls: SecretDeclarationInput[], ...objs: unknown[]): PostSynthContext {
|
|
2313
|
-
const ctx = manifestsCtx(...objs);
|
|
2314
|
-
decls.forEach((d, i) => ctx.entities.set(`secretDecl${i}`, declareSecret(d as never)));
|
|
2315
|
-
return ctx;
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
test("metadata", () => {
|
|
2319
|
-
expect(wk8503.id).toBe("WK8503");
|
|
2320
|
-
});
|
|
2321
|
-
|
|
2322
|
-
test("fires when nothing produces the consumed Secret", () => {
|
|
2323
|
-
const diags = wk8503.check(manifestsCtx(appConsuming("fountain-secrets")));
|
|
2324
|
-
expect(diags.length).toBe(1);
|
|
2325
|
-
expect(diags[0].checkId).toBe("WK8503");
|
|
2326
|
-
expect(diags[0].severity).toBe("error");
|
|
2327
|
-
expect(diags[0].entity).toBe("app");
|
|
2328
|
-
expect(diags[0].message).toContain('Secret "fountain-secrets"');
|
|
2329
|
-
expect(diags[0].message).toContain("envFrom.secretRef");
|
|
2330
|
-
});
|
|
2331
|
-
|
|
2332
|
-
test("quiet when a Secret manifest in the output produces it", () => {
|
|
2333
|
-
const ctx = manifestsCtx(
|
|
2334
|
-
appConsuming("fountain-secrets"),
|
|
2335
|
-
{ apiVersion: "v1", kind: "Secret", metadata: { name: "fountain-secrets", namespace: "web" }, stringData: {} },
|
|
2336
|
-
);
|
|
2337
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2338
|
-
});
|
|
2339
|
-
|
|
2340
|
-
test("quiet when an ExternalSecret materializes the target name", () => {
|
|
2341
|
-
const ctx = manifestsCtx(
|
|
2342
|
-
appConsuming("fountain-secrets"),
|
|
2343
|
-
{
|
|
2344
|
-
apiVersion: "external-secrets.io/v1",
|
|
2345
|
-
kind: "ExternalSecret",
|
|
2346
|
-
metadata: { name: "fountain-secrets-eso", namespace: "web" },
|
|
2347
|
-
spec: {
|
|
2348
|
-
secretStoreRef: { name: "store", kind: "ClusterSecretStore" },
|
|
2349
|
-
target: { name: "fountain-secrets", creationPolicy: "Owner" },
|
|
2350
|
-
data: [],
|
|
2351
|
-
},
|
|
2352
|
-
},
|
|
2353
|
-
);
|
|
2354
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2355
|
-
});
|
|
2356
|
-
|
|
2357
|
-
test("an ExternalSecret with no explicit target produces its own name", () => {
|
|
2358
|
-
const ctx = manifestsCtx(
|
|
2359
|
-
appConsuming("fountain-secrets"),
|
|
2360
|
-
{
|
|
2361
|
-
apiVersion: "external-secrets.io/v1",
|
|
2362
|
-
kind: "ExternalSecret",
|
|
2363
|
-
metadata: { name: "fountain-secrets", namespace: "web" },
|
|
2364
|
-
spec: { secretStoreRef: { name: "store", kind: "ClusterSecretStore" }, data: [] },
|
|
2365
|
-
},
|
|
2366
|
-
);
|
|
2367
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2368
|
-
});
|
|
2369
|
-
|
|
2370
|
-
test("quiet when an InfisicalSecret's managedSecretReference produces it", () => {
|
|
2371
|
-
const ctx = manifestsCtx(
|
|
2372
|
-
appConsuming("fountain-secrets"),
|
|
2373
|
-
{
|
|
2374
|
-
apiVersion: "secrets.infisical.com/v1alpha1",
|
|
2375
|
-
kind: "InfisicalSecret",
|
|
2376
|
-
metadata: { name: "fountain-sync", namespace: "infisical-operator" },
|
|
2377
|
-
spec: {
|
|
2378
|
-
managedSecretReference: { secretName: "fountain-secrets", secretNamespace: "web" },
|
|
2379
|
-
},
|
|
2380
|
-
},
|
|
2381
|
-
);
|
|
2382
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2383
|
-
});
|
|
2384
|
-
|
|
2385
|
-
test("an InfisicalSecret targeting a different namespace does not cover the consumer", () => {
|
|
2386
|
-
const ctx = manifestsCtx(
|
|
2387
|
-
appConsuming("fountain-secrets"),
|
|
2388
|
-
{
|
|
2389
|
-
apiVersion: "secrets.infisical.com/v1alpha1",
|
|
2390
|
-
kind: "InfisicalSecret",
|
|
2391
|
-
metadata: { name: "fountain-sync", namespace: "web" },
|
|
2392
|
-
spec: {
|
|
2393
|
-
managedSecretReference: { secretName: "fountain-secrets", secretNamespace: "other" },
|
|
2394
|
-
},
|
|
2395
|
-
},
|
|
2396
|
-
);
|
|
2397
|
-
expect(wk8503.check(ctx).length).toBe(1);
|
|
2398
|
-
});
|
|
2399
|
-
|
|
2400
|
-
test("quiet when a cert-manager Certificate materializes the secretName", () => {
|
|
2401
|
-
const consumer = {
|
|
2402
|
-
apiVersion: "apps/v1",
|
|
2403
|
-
kind: "StatefulSet",
|
|
2404
|
-
metadata: { name: "db", namespace: "web" },
|
|
2405
|
-
spec: {
|
|
2406
|
-
template: {
|
|
2407
|
-
spec: {
|
|
2408
|
-
containers: [{ name: "db", image: "db:1" }],
|
|
2409
|
-
volumes: [{ name: "tls", secret: { secretName: "db-tls" } }],
|
|
2410
|
-
},
|
|
2411
|
-
},
|
|
2412
|
-
},
|
|
2413
|
-
};
|
|
2414
|
-
const ctx = manifestsCtx(consumer, {
|
|
2415
|
-
apiVersion: "cert-manager.io/v1",
|
|
2416
|
-
kind: "Certificate",
|
|
2417
|
-
metadata: { name: "db-cert", namespace: "web" },
|
|
2418
|
-
spec: { secretName: "db-tls", issuerRef: { name: "issuer" } },
|
|
2419
|
-
});
|
|
2420
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2421
|
-
});
|
|
2422
|
-
|
|
2423
|
-
test("a `referenced` provenance declaration waives the check", () => {
|
|
2424
|
-
const ctx = ctxWithDeclarations(
|
|
2425
|
-
[{ name: "fountain-secrets", provenance: "referenced", scope: "minted by `just secret`" }],
|
|
2426
|
-
appConsuming("fountain-secrets"),
|
|
2427
|
-
);
|
|
2428
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2429
|
-
});
|
|
2430
|
-
|
|
2431
|
-
test("a `generated-once` provenance declaration waives the check", () => {
|
|
2432
|
-
const ctx = ctxWithDeclarations(
|
|
2433
|
-
[{ name: "fountain-secrets", provenance: "generated-once", keys: ["token"] }],
|
|
2434
|
-
appConsuming("fountain-secrets"),
|
|
2435
|
-
);
|
|
2436
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2437
|
-
});
|
|
2438
|
-
|
|
2439
|
-
test("a declaration covering a different name does not waive the check", () => {
|
|
2440
|
-
const ctx = ctxWithDeclarations(
|
|
2441
|
-
[{ name: "some-other-secret", provenance: "referenced" }],
|
|
2442
|
-
appConsuming("fountain-secrets"),
|
|
2443
|
-
);
|
|
2444
|
-
const diags = wk8503.check(ctx);
|
|
2445
|
-
expect(diags.length).toBe(1);
|
|
2446
|
-
expect(diags[0].message).toContain('"fountain-secrets"');
|
|
2447
|
-
});
|
|
2448
|
-
|
|
2449
|
-
test("optional references are skipped", () => {
|
|
2450
|
-
const ctx = manifestsCtx({
|
|
2451
|
-
apiVersion: "apps/v1",
|
|
2452
|
-
kind: "Deployment",
|
|
2453
|
-
metadata: { name: "app", namespace: "web" },
|
|
2454
|
-
spec: {
|
|
2455
|
-
template: {
|
|
2456
|
-
spec: {
|
|
2457
|
-
containers: [
|
|
2458
|
-
{
|
|
2459
|
-
name: "app",
|
|
2460
|
-
image: "app:1.0",
|
|
2461
|
-
envFrom: [{ secretRef: { name: "maybe-env", optional: true } }],
|
|
2462
|
-
env: [{ name: "TOKEN", valueFrom: { secretKeyRef: { name: "maybe-key", key: "t", optional: true } } }],
|
|
2463
|
-
},
|
|
2464
|
-
],
|
|
2465
|
-
volumes: [{ name: "v", secret: { secretName: "maybe-vol", optional: true } }],
|
|
2466
|
-
},
|
|
2467
|
-
},
|
|
2468
|
-
},
|
|
2469
|
-
});
|
|
2470
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2471
|
-
});
|
|
2472
|
-
|
|
2473
|
-
test("covers secretKeyRef, projected sources, imagePullSecrets, and initContainers", () => {
|
|
2474
|
-
const ctx = manifestsCtx({
|
|
2475
|
-
apiVersion: "batch/v1",
|
|
2476
|
-
kind: "CronJob",
|
|
2477
|
-
metadata: { name: "sync", namespace: "web" },
|
|
2478
|
-
spec: {
|
|
2479
|
-
jobTemplate: {
|
|
2480
|
-
spec: {
|
|
2481
|
-
template: {
|
|
2482
|
-
spec: {
|
|
2483
|
-
imagePullSecrets: [{ name: "registry-creds" }],
|
|
2484
|
-
initContainers: [
|
|
2485
|
-
{ name: "init", image: "i:1", env: [{ name: "T", valueFrom: { secretKeyRef: { name: "api-token", key: "t" } } }] },
|
|
2486
|
-
],
|
|
2487
|
-
containers: [{ name: "sync", image: "s:1" }],
|
|
2488
|
-
volumes: [
|
|
2489
|
-
{ name: "p", projected: { sources: [{ secret: { name: "projected-secret" } }] } },
|
|
2490
|
-
],
|
|
2491
|
-
},
|
|
2492
|
-
},
|
|
2493
|
-
},
|
|
2494
|
-
},
|
|
2495
|
-
},
|
|
2496
|
-
});
|
|
2497
|
-
const secrets = wk8503.check(ctx).map((d) => d.message.match(/consumes Secret "([^"]+)"/)?.[1]).sort();
|
|
2498
|
-
expect(secrets).toEqual(["api-token", "projected-secret", "registry-creds"]);
|
|
2499
|
-
});
|
|
2500
|
-
|
|
2501
|
-
test("a Secret in an explicit different namespace does not cover the consumer", () => {
|
|
2502
|
-
const ctx = manifestsCtx(
|
|
2503
|
-
appConsuming("fountain-secrets"),
|
|
2504
|
-
{ apiVersion: "v1", kind: "Secret", metadata: { name: "fountain-secrets", namespace: "other" }, stringData: {} },
|
|
2505
|
-
);
|
|
2506
|
-
expect(wk8503.check(ctx).length).toBe(1);
|
|
2507
|
-
});
|
|
2508
|
-
|
|
2509
|
-
test("a Secret with no namespace covers a namespaced consumer", () => {
|
|
2510
|
-
const ctx = manifestsCtx(
|
|
2511
|
-
appConsuming("fountain-secrets"),
|
|
2512
|
-
{ apiVersion: "v1", kind: "Secret", metadata: { name: "fountain-secrets" }, stringData: {} },
|
|
2513
|
-
);
|
|
2514
|
-
expect(wk8503.check(ctx)).toEqual([]);
|
|
2515
|
-
});
|
|
2516
|
-
|
|
2517
|
-
test("reports a missing Secret once per workload even when referenced twice", () => {
|
|
2518
|
-
const ctx = manifestsCtx({
|
|
2519
|
-
apiVersion: "apps/v1",
|
|
2520
|
-
kind: "Deployment",
|
|
2521
|
-
metadata: { name: "app", namespace: "web" },
|
|
2522
|
-
spec: {
|
|
2523
|
-
template: {
|
|
2524
|
-
spec: {
|
|
2525
|
-
containers: [
|
|
2526
|
-
{
|
|
2527
|
-
name: "app",
|
|
2528
|
-
image: "app:1.0",
|
|
2529
|
-
envFrom: [{ secretRef: { name: "fountain-secrets" } }],
|
|
2530
|
-
env: [{ name: "T", valueFrom: { secretKeyRef: { name: "fountain-secrets", key: "t" } } }],
|
|
2531
|
-
},
|
|
2532
|
-
],
|
|
2533
|
-
},
|
|
2534
|
-
},
|
|
2535
|
-
},
|
|
2536
|
-
});
|
|
2537
|
-
expect(wk8503.check(ctx).length).toBe(1);
|
|
2538
|
-
});
|
|
2539
|
-
});
|
|
2540
|
-
|
|
2541
|
-
// ── WK8504: committed-encrypted declaration does not resolve ─────────
|
|
2542
|
-
//
|
|
2543
|
-
// The fixture is a real sops-shaped document (cleartext structure, ENC[...]
|
|
2544
|
-
// values, an age recipient block, a mac). Nothing here decrypts anything.
|
|
2545
|
-
|
|
2546
|
-
describe("WK8504: committed-encrypted secret declaration does not resolve", () => {
|
|
2547
|
-
const CIPHERTEXT = readFileSync(
|
|
2548
|
-
join(dirname(fileURLToPath(import.meta.url)), "..", "..", "testdata", "sops", "db-credentials.sops.yaml"),
|
|
2549
|
-
"utf-8",
|
|
2550
|
-
);
|
|
2551
|
-
|
|
2552
|
-
/**
|
|
2553
|
-
* A context whose k8s output carries `manifests` in the primary document and
|
|
2554
|
-
* the ciphertext as a SIDECAR — the only place the check can find it.
|
|
2555
|
-
*/
|
|
2556
|
-
function sopsCtx(
|
|
2557
|
-
opts: { ciphertext?: string; file?: string; declaredName?: string; manifests?: unknown[]; omitSidecar?: boolean } = {},
|
|
2558
|
-
): PostSynthContext {
|
|
2559
|
-
const primary = (opts.manifests ?? []).map((o) => JSON.stringify(o)).join("\n---\n");
|
|
2560
|
-
const file = opts.file ?? "secrets/db-credentials.sops.yaml";
|
|
2561
|
-
const output: SerializerResult = {
|
|
2562
|
-
primary,
|
|
2563
|
-
files: opts.omitSidecar
|
|
2564
|
-
? {}
|
|
2565
|
-
: { "db-credentials.sops.yaml": opts.ciphertext ?? CIPHERTEXT },
|
|
2566
|
-
};
|
|
2567
|
-
const outputs = new Map<string, string | SerializerResult>([["k8s", output]]);
|
|
2568
|
-
const entities = new Map<string, Declarable>([
|
|
2569
|
-
[
|
|
2570
|
-
"dbCredentials",
|
|
2571
|
-
declareSecret({
|
|
2572
|
-
name: opts.declaredName ?? "db-credentials",
|
|
2573
|
-
provenance: "committed-encrypted",
|
|
2574
|
-
file,
|
|
2575
|
-
keys: ["POSTGRES_USER", "POSTGRES_PASSWORD"],
|
|
2576
|
-
}),
|
|
2577
|
-
],
|
|
2578
|
-
]);
|
|
2579
|
-
return {
|
|
2580
|
-
outputs,
|
|
2581
|
-
entities,
|
|
2582
|
-
buildResult: { outputs, entities, warnings: [], errors: [], sourceFileCount: 1 },
|
|
2583
|
-
};
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
|
-
test("metadata", () => {
|
|
2587
|
-
expect(wk8504.id).toBe("WK8504");
|
|
2588
|
-
});
|
|
2589
|
-
|
|
2590
|
-
test("quiet when the declared file resolved to encrypted ciphertext", () => {
|
|
2591
|
-
expect(wk8504.check(sopsCtx())).toEqual([]);
|
|
2592
|
-
});
|
|
2593
|
-
|
|
2594
|
-
test("quiet when the project declares no committed-encrypted secret", () => {
|
|
2595
|
-
expect(wk8504.check(manifestsCtx({ apiVersion: "v1", kind: "ConfigMap", metadata: { name: "c" } }))).toEqual([]);
|
|
2596
|
-
});
|
|
2597
|
-
|
|
2598
|
-
test("fires when the build emitted no file for the declaration", () => {
|
|
2599
|
-
const diags = wk8504.check(sopsCtx({ omitSidecar: true }));
|
|
2600
|
-
expect(diags.length).toBe(1);
|
|
2601
|
-
expect(diags[0].checkId).toBe("WK8504");
|
|
2602
|
-
expect(diags[0].severity).toBe("error");
|
|
2603
|
-
expect(diags[0].entity).toBe("db-credentials");
|
|
2604
|
-
expect(diags[0].message).toContain("secrets/db-credentials.sops.yaml");
|
|
2605
|
-
expect(diags[0].message).toContain("did not resolve");
|
|
2606
|
-
});
|
|
2607
|
-
|
|
2608
|
-
test("fires when metadata.name disagrees with the declaration", () => {
|
|
2609
|
-
const diags = wk8504.check(sopsCtx({ declaredName: "other-credentials" }));
|
|
2610
|
-
// The name mismatch; the sidecar filename still matches, so it is found.
|
|
2611
|
-
expect(diags.some((d) => /metadata\.name "db-credentials"/.test(d.message))).toBe(true);
|
|
2612
|
-
});
|
|
2613
|
-
|
|
2614
|
-
test("fires when the document carries no sops block", () => {
|
|
2615
|
-
const decrypted = CIPHERTEXT.slice(0, CIPHERTEXT.indexOf("sops:"));
|
|
2616
|
-
const diags = wk8504.check(sopsCtx({ ciphertext: decrypted }));
|
|
2617
|
-
expect(diags.some((d) => /no top-level `sops` block/.test(d.message))).toBe(true);
|
|
2618
|
-
});
|
|
2619
|
-
|
|
2620
|
-
test("fires when a data value is not ENC[...], naming the key and not the value", () => {
|
|
2621
|
-
const leaked = CIPHERTEXT.replace(/POSTGRES_PASSWORD: ENC\[[^\]]*\]/, "POSTGRES_PASSWORD: hunter2");
|
|
2622
|
-
const diags = wk8504.check(sopsCtx({ ciphertext: leaked }));
|
|
2623
|
-
expect(diags.length).toBe(1);
|
|
2624
|
-
expect(diags[0].message).toContain('stringData."POSTGRES_PASSWORD" is not encrypted');
|
|
2625
|
-
expect(diags[0].message).not.toContain("hunter2");
|
|
2626
|
-
});
|
|
2627
|
-
|
|
2628
|
-
test("reports every problem on a declaration at once", () => {
|
|
2629
|
-
const broken = CIPHERTEXT.replace("kind: Secret", "kind: ConfigMap").replace(
|
|
2630
|
-
/POSTGRES_USER: ENC\[[^\]]*\]/,
|
|
2631
|
-
"POSTGRES_USER: postgres",
|
|
2632
|
-
);
|
|
2633
|
-
expect(wk8504.check(sopsCtx({ ciphertext: broken })).length).toBeGreaterThanOrEqual(2);
|
|
2634
|
-
});
|
|
2635
|
-
|
|
2636
|
-
test("post-synth checks that read only the primary output stay blind to the sidecar", () => {
|
|
2637
|
-
// The ciphertext must never reach the primary output — that is what makes
|
|
2638
|
-
// applying an undecrypted Secret structurally impossible — so the rules
|
|
2639
|
-
// that look for hardcoded material see nothing here.
|
|
2640
|
-
const ctx = sopsCtx({ manifests: [{ apiVersion: "apps/v1", kind: "Deployment", metadata: { name: "app" } }] });
|
|
2641
|
-
expect(wk8005.check(ctx)).toEqual([]);
|
|
2642
|
-
expect(wk8041.check(ctx)).toEqual([]);
|
|
2643
|
-
expect(wk8042.check(ctx)).toEqual([]);
|
|
2644
|
-
});
|
|
2645
|
-
|
|
2646
|
-
describe("WK8503 is satisfied through the producer set, not the waiver set", () => {
|
|
2647
|
-
function consumerIn(namespace: string) {
|
|
2648
|
-
return {
|
|
2649
|
-
apiVersion: "apps/v1",
|
|
2650
|
-
kind: "Deployment",
|
|
2651
|
-
metadata: { name: "api", namespace },
|
|
2652
|
-
spec: {
|
|
2653
|
-
template: {
|
|
2654
|
-
spec: {
|
|
2655
|
-
containers: [
|
|
2656
|
-
{ name: "api", image: "api:1.0", envFrom: [{ secretRef: { name: "db-credentials" } }] },
|
|
2657
|
-
],
|
|
2658
|
-
},
|
|
2659
|
-
},
|
|
2660
|
-
},
|
|
2661
|
-
};
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
test("a resolved declaration produces the Secret in its own namespace", () => {
|
|
2665
|
-
// The fixture is `namespace: apps`, read from the ciphertext itself.
|
|
2666
|
-
expect(wk8503.check(sopsCtx({ manifests: [consumerIn("apps")] }))).toEqual([]);
|
|
2667
|
-
});
|
|
2668
|
-
|
|
2669
|
-
test("namespace matching applies — another namespace is not covered", () => {
|
|
2670
|
-
const diags = wk8503.check(sopsCtx({ manifests: [consumerIn("platform")] }));
|
|
2671
|
-
expect(diags.length).toBe(1);
|
|
2672
|
-
expect(diags[0].message).toContain('Secret "db-credentials"');
|
|
2673
|
-
});
|
|
2674
|
-
|
|
2675
|
-
test("a declaration whose file did not resolve waives nothing", () => {
|
|
2676
|
-
const ctx = sopsCtx({ omitSidecar: true, manifests: [consumerIn("apps")] });
|
|
2677
|
-
expect(wk8504.check(ctx).length).toBe(1);
|
|
2678
|
-
expect(wk8503.check(ctx).length).toBe(1);
|
|
2679
|
-
});
|
|
2680
|
-
|
|
2681
|
-
test("a declaration whose ciphertext is not encrypted waives nothing", () => {
|
|
2682
|
-
const leaked = CIPHERTEXT.replace(/POSTGRES_USER: ENC\[[^\]]*\]/, "POSTGRES_USER: postgres");
|
|
2683
|
-
const ctx = sopsCtx({ ciphertext: leaked, manifests: [consumerIn("apps")] });
|
|
2684
|
-
expect(wk8504.check(ctx).length).toBe(1);
|
|
2685
|
-
expect(wk8503.check(ctx).length).toBe(1);
|
|
2686
|
-
});
|
|
2687
|
-
});
|
|
2688
|
-
});
|
|
2689
|
-
|
|
2690
|
-
// ── WK8505: committed-encrypted secret with no Flux decryption wiring ─────
|
|
2691
|
-
//
|
|
2692
|
-
// Reuses the FLUX002 fixture helpers (fluxKustomization, gitSourceRef) and
|
|
2693
|
-
// the same real sops-shaped ciphertext fixture WK8504 validates against.
|
|
2694
|
-
|
|
2695
|
-
describe("WK8505: committed-encrypted secret with no Flux decryption wiring", () => {
|
|
2696
|
-
const CIPHERTEXT = readFileSync(
|
|
2697
|
-
join(dirname(fileURLToPath(import.meta.url)), "..", "..", "testdata", "sops", "db-credentials.sops.yaml"),
|
|
2698
|
-
"utf-8",
|
|
2699
|
-
);
|
|
2700
|
-
|
|
2701
|
-
/**
|
|
2702
|
-
* A context carrying one committed-encrypted declaration (resolved to its
|
|
2703
|
-
* sidecar unless `omitSidecar`) plus whatever Flux/other manifests are
|
|
2704
|
-
* passed in the primary output.
|
|
2705
|
-
*/
|
|
2706
|
-
function sopsCtx(opts: { manifests?: unknown[]; omitSidecar?: boolean } = {}): PostSynthContext {
|
|
2707
|
-
const primary = (opts.manifests ?? []).map((o) => JSON.stringify(o)).join("\n---\n");
|
|
2708
|
-
const output: SerializerResult = {
|
|
2709
|
-
primary,
|
|
2710
|
-
files: opts.omitSidecar ? {} : { "db-credentials.sops.yaml": CIPHERTEXT },
|
|
2711
|
-
};
|
|
2712
|
-
const outputs = new Map<string, string | SerializerResult>([["k8s", output]]);
|
|
2713
|
-
const entities = new Map<string, Declarable>([
|
|
2714
|
-
[
|
|
2715
|
-
"dbCredentials",
|
|
2716
|
-
declareSecret({
|
|
2717
|
-
name: "db-credentials",
|
|
2718
|
-
provenance: "committed-encrypted",
|
|
2719
|
-
file: "secrets/db-credentials.sops.yaml",
|
|
2720
|
-
keys: ["POSTGRES_USER", "POSTGRES_PASSWORD"],
|
|
2721
|
-
}),
|
|
2722
|
-
],
|
|
2723
|
-
]);
|
|
2724
|
-
return {
|
|
2725
|
-
outputs,
|
|
2726
|
-
entities,
|
|
2727
|
-
buildResult: { outputs, entities, warnings: [], errors: [], sourceFileCount: 1 },
|
|
2728
|
-
};
|
|
2729
|
-
}
|
|
2730
|
-
|
|
2731
|
-
test("metadata", () => {
|
|
2732
|
-
expect(wk8505.id).toBe("WK8505");
|
|
2733
|
-
});
|
|
2734
|
-
|
|
2735
|
-
test("quiet when the build has no Flux Kustomization at all", () => {
|
|
2736
|
-
expect(wk8505.check(sopsCtx())).toEqual([]);
|
|
2737
|
-
});
|
|
2738
|
-
|
|
2739
|
-
test("quiet when the build declares no committed-encrypted secret", () => {
|
|
2740
|
-
const ctx = manifestsCtx(fluxKustomization("app", gitSourceRef("flux-system")));
|
|
2741
|
-
expect(wk8505.check(ctx)).toEqual([]);
|
|
2742
|
-
});
|
|
2743
|
-
|
|
2744
|
-
test("fires when a Kustomization exists but none sets spec.decryption", () => {
|
|
2745
|
-
const ctx = sopsCtx({ manifests: [fluxKustomization("app", gitSourceRef("flux-system"))] });
|
|
2746
|
-
const diags = wk8505.check(ctx);
|
|
2747
|
-
expect(diags.length).toBe(1);
|
|
2748
|
-
expect(diags[0].checkId).toBe("WK8505");
|
|
2749
|
-
expect(diags[0].severity).toBe("warning");
|
|
2750
|
-
expect(diags[0].entity).toBe("db-credentials");
|
|
2751
|
-
expect(diags[0].message).toContain("spec.decryption");
|
|
2752
|
-
});
|
|
2753
|
-
|
|
2754
|
-
test("quiet when a Kustomization sets spec.decryption", () => {
|
|
2755
|
-
const ctx = sopsCtx({
|
|
2756
|
-
manifests: [
|
|
2757
|
-
fluxKustomization("app", {
|
|
2758
|
-
...gitSourceRef("flux-system"),
|
|
2759
|
-
decryption: { provider: "sops", secretRef: { name: "sops-age" } },
|
|
2760
|
-
}),
|
|
2761
|
-
],
|
|
2762
|
-
});
|
|
2763
|
-
expect(wk8505.check(ctx)).toEqual([]);
|
|
2764
|
-
});
|
|
2765
|
-
|
|
2766
|
-
test("a decrypting Kustomization elsewhere in the build satisfies every declaration", () => {
|
|
2767
|
-
const ctx = sopsCtx({
|
|
2768
|
-
manifests: [
|
|
2769
|
-
fluxKustomization("infra", gitSourceRef("flux-system")),
|
|
2770
|
-
fluxKustomization("secrets", {
|
|
2771
|
-
...gitSourceRef("flux-system"),
|
|
2772
|
-
decryption: { provider: "sops", secretRef: { name: "sops-age" } },
|
|
2773
|
-
}),
|
|
2774
|
-
],
|
|
2775
|
-
});
|
|
2776
|
-
expect(wk8505.check(ctx)).toEqual([]);
|
|
2777
|
-
});
|
|
2778
|
-
|
|
2779
|
-
test("an unresolved declaration does not also fire WK8505 — WK8504 already reports it", () => {
|
|
2780
|
-
const ctx = sopsCtx({ omitSidecar: true, manifests: [fluxKustomization("app", gitSourceRef("flux-system"))] });
|
|
2781
|
-
expect(wk8504.check(ctx).length).toBe(1);
|
|
2782
|
-
expect(wk8505.check(ctx)).toEqual([]);
|
|
2783
|
-
});
|
|
2784
|
-
|
|
2785
|
-
test("skips kustomize.config.k8s.io Kustomizations (not Flux CRs)", () => {
|
|
2786
|
-
const ctx = sopsCtx({
|
|
2787
|
-
manifests: [
|
|
2788
|
-
{
|
|
2789
|
-
apiVersion: "kustomize.config.k8s.io/v1beta1",
|
|
2790
|
-
kind: "Kustomization",
|
|
2791
|
-
metadata: { name: "overlay" },
|
|
2792
|
-
spec: {},
|
|
2793
|
-
},
|
|
2794
|
-
],
|
|
2795
|
-
});
|
|
2796
|
-
expect(wk8505.check(ctx)).toEqual([]);
|
|
2797
|
-
});
|
|
2798
|
-
});
|