@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,1873 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `describeResources` over the typed API client (chant #1074).
|
|
3
|
-
*
|
|
4
|
-
* Every case drives the real client against a literal kubeconfig with the
|
|
5
|
-
* transport faked, so no ambient kubeconfig is read and no cluster is
|
|
6
|
-
* contacted. The tri-state contract (chant #1089) and the cluster binding
|
|
7
|
-
* (chant #1100/#1155) are asserted through the new path, since both had to
|
|
8
|
-
* survive the move off `kubectl` unchanged.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { describe, test, expect, vi, beforeEach } from "vitest";
|
|
12
|
-
|
|
13
|
-
const loadChantConfigMock = vi.fn();
|
|
14
|
-
vi.mock("@intentius/chant/config", () => ({
|
|
15
|
-
loadChantConfig: (...args: unknown[]) => loadChantConfigMock(...args),
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
const { describeResources, statusFromObject, unhappyConditions, revisionAttributes, helmRepositoryTypeAttribute } = await import("./describe-resources");
|
|
19
|
-
const { fakeCluster, objectKey, ownedObject } = await import("./api/fake-cluster");
|
|
20
|
-
const { defaultK8sConnector } = await import("./api/connect");
|
|
21
|
-
const { fakeKubeconfig, statusBody } = await import("@intentius/chant-k8s-client/testing");
|
|
22
|
-
|
|
23
|
-
type Entity = { name: string; entityType: string; props: Record<string, unknown> };
|
|
24
|
-
|
|
25
|
-
function makeEntities(records: Entity[]) {
|
|
26
|
-
return new Map(records.map((r) => [r.name, { entityType: r.entityType, props: r.props }]));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const web = {
|
|
30
|
-
apiVersion: "apps/v1",
|
|
31
|
-
kind: "Deployment",
|
|
32
|
-
metadata: {
|
|
33
|
-
name: "web",
|
|
34
|
-
namespace: "prod",
|
|
35
|
-
uid: "uid-1",
|
|
36
|
-
creationTimestamp: "2026-05-01T00:00:00Z",
|
|
37
|
-
resourceVersion: "7",
|
|
38
|
-
labels: { app: "web" },
|
|
39
|
-
},
|
|
40
|
-
status: { readyReplicas: 3, replicas: 3 },
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const webSvc = {
|
|
44
|
-
apiVersion: "v1",
|
|
45
|
-
kind: "Service",
|
|
46
|
-
metadata: { name: "web-svc", namespace: "prod", uid: "uid-2", creationTimestamp: "2026-05-01T00:00:00Z" },
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
describe("k8s describeResources", () => {
|
|
50
|
-
beforeEach(() => {
|
|
51
|
-
loadChantConfigMock.mockReset();
|
|
52
|
-
loadChantConfigMock.mockResolvedValue({ config: {} });
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test("reads each declared entity through the API and maps it to ResourceMetadata", async () => {
|
|
56
|
-
const cluster = fakeCluster({
|
|
57
|
-
objects: {
|
|
58
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: web,
|
|
59
|
-
[objectKey("v1", "Service", "web-svc", "prod")]: webSvc,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const result = await describeResources(
|
|
64
|
-
{
|
|
65
|
-
environment: "prod",
|
|
66
|
-
buildOutput: "",
|
|
67
|
-
entityNames: ["web", "webSvc"],
|
|
68
|
-
entities: makeEntities([
|
|
69
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
70
|
-
{ name: "webSvc", entityType: "K8s::Core::Service", props: { metadata: { name: "web-svc", namespace: "prod" } } },
|
|
71
|
-
]),
|
|
72
|
-
},
|
|
73
|
-
cluster.connector,
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
expect(result.resources.web).toMatchObject({
|
|
77
|
-
type: "K8s::Apps::Deployment",
|
|
78
|
-
physicalId: "uid-1",
|
|
79
|
-
status: "READY",
|
|
80
|
-
lastUpdated: "2026-05-01T00:00:00Z",
|
|
81
|
-
attributes: expect.objectContaining({ namespace: "prod", labels: { app: "web" }, resourceVersion: "7" }),
|
|
82
|
-
});
|
|
83
|
-
expect(result.resources.webSvc).toMatchObject({ type: "K8s::Core::Service", physicalId: "uid-2", status: "PRESENT" });
|
|
84
|
-
|
|
85
|
-
// The paths came from the cluster's discovery, not from a table.
|
|
86
|
-
expect(cluster.layer.paths()).toContain("/apis/apps/v1/namespaces/prod/deployments/web");
|
|
87
|
-
expect(cluster.layer.paths()).toContain("/api/v1/namespaces/prod/services/web-svc");
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("a NotFound leaves the entity out of both maps — an absence, the only shape that becomes a create", async () => {
|
|
91
|
-
const cluster = fakeCluster();
|
|
92
|
-
const result = await describeResources(
|
|
93
|
-
{
|
|
94
|
-
environment: "prod",
|
|
95
|
-
buildOutput: "",
|
|
96
|
-
entityNames: ["missing"],
|
|
97
|
-
entities: makeEntities([
|
|
98
|
-
{ name: "missing", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "missing", namespace: "prod" } } },
|
|
99
|
-
]),
|
|
100
|
-
},
|
|
101
|
-
cluster.connector,
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
expect(result.resources).toEqual({});
|
|
105
|
-
expect(result.unobserved ?? {}).toEqual({});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// The behold#192 shape (#1620): a Flux-deployed object declares no
|
|
109
|
-
// metadata.namespace (the controller stamps targetNamespace at apply), so the
|
|
110
|
-
// live read scopes to the client's default namespace, finds nothing, and
|
|
111
|
-
// correctly reports absence. Every layer is spec-correct and the picture
|
|
112
|
-
// still says the opposite of the truth — unless the report carries the
|
|
113
|
-
// address it actually asked, which is what `queried` is.
|
|
114
|
-
test("an absent verdict carries the resolved query address, namespace defaulted and visible (#1620)", async () => {
|
|
115
|
-
const cluster = fakeCluster({
|
|
116
|
-
// The object lives where Flux put it — not where the read will look.
|
|
117
|
-
objects: { [objectKey("apps/v1", "Deployment", "web", "flux-target")]: web },
|
|
118
|
-
});
|
|
119
|
-
const result = await describeResources(
|
|
120
|
-
{
|
|
121
|
-
environment: "prod",
|
|
122
|
-
buildOutput: "",
|
|
123
|
-
entityNames: ["web"],
|
|
124
|
-
entities: makeEntities([
|
|
125
|
-
// No metadata.namespace declared — Flux stamps it at apply time.
|
|
126
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web" } } },
|
|
127
|
-
]),
|
|
128
|
-
},
|
|
129
|
-
cluster.connector,
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
// Still a clean absence: in neither map, the tri-state unshifted.
|
|
133
|
-
expect(result.resources).toEqual({});
|
|
134
|
-
expect(result.unobserved ?? {}).toEqual({});
|
|
135
|
-
// But the report can now explain itself: the read went to `default`.
|
|
136
|
-
expect(result.queried?.web).toBe("/apis/apps/v1/namespaces/default/deployments/web");
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
test("a present entity carries its query address too — the map is total over issued reads (#1620)", async () => {
|
|
140
|
-
const cluster = fakeCluster({
|
|
141
|
-
objects: { [objectKey("apps/v1", "Deployment", "web", "prod")]: web },
|
|
142
|
-
});
|
|
143
|
-
const result = await describeResources(
|
|
144
|
-
{
|
|
145
|
-
environment: "prod",
|
|
146
|
-
buildOutput: "",
|
|
147
|
-
entityNames: ["web"],
|
|
148
|
-
entities: makeEntities([
|
|
149
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
150
|
-
]),
|
|
151
|
-
},
|
|
152
|
-
cluster.connector,
|
|
153
|
-
);
|
|
154
|
-
expect(result.resources.web).toBeDefined();
|
|
155
|
-
expect(result.queried?.web).toBe("/apis/apps/v1/namespaces/prod/deployments/web");
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test("a read-failed unobserved entry carries the address the failing read was issued against (#1620)", async () => {
|
|
159
|
-
const cluster = fakeCluster({
|
|
160
|
-
respond: (req) =>
|
|
161
|
-
req.path.endsWith("/deployments/web")
|
|
162
|
-
? { status: 500, body: statusBody(500, "InternalError", "etcdserver: request timed out") }
|
|
163
|
-
: undefined,
|
|
164
|
-
});
|
|
165
|
-
const result = await describeResources(
|
|
166
|
-
{
|
|
167
|
-
environment: "prod",
|
|
168
|
-
buildOutput: "",
|
|
169
|
-
entityNames: ["web"],
|
|
170
|
-
entities: makeEntities([
|
|
171
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
172
|
-
]),
|
|
173
|
-
},
|
|
174
|
-
cluster.connector,
|
|
175
|
-
);
|
|
176
|
-
expect(result.unobserved?.web).toMatchObject({
|
|
177
|
-
reason: "read-failed",
|
|
178
|
-
queried: "/apis/apps/v1/namespaces/prod/deployments/web",
|
|
179
|
-
});
|
|
180
|
-
expect(result.queried?.web).toBe("/apis/apps/v1/namespaces/prod/deployments/web");
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// The headline of chant #1074: the twenty-entry map is gone, so a CRD is an
|
|
184
|
-
// ordinary read rather than a permanent hole.
|
|
185
|
-
test("a CRD is observed like anything else — no KUBECTL_RESOURCE entry required", async () => {
|
|
186
|
-
const rayCluster = {
|
|
187
|
-
apiVersion: "ray.io/v1",
|
|
188
|
-
kind: "RayCluster",
|
|
189
|
-
metadata: { name: "ml", namespace: "ray", uid: "uid-ray", creationTimestamp: "2026-05-01T00:00:00Z" },
|
|
190
|
-
status: { phase: "ready" },
|
|
191
|
-
};
|
|
192
|
-
const cluster = fakeCluster({ objects: { [objectKey("ray.io/v1", "RayCluster", "ml", "ray")]: rayCluster } });
|
|
193
|
-
|
|
194
|
-
const result = await describeResources(
|
|
195
|
-
{
|
|
196
|
-
environment: "prod",
|
|
197
|
-
buildOutput: "",
|
|
198
|
-
entityNames: ["ml"],
|
|
199
|
-
entities: makeEntities([
|
|
200
|
-
{ name: "ml", entityType: "K8s::Ray::RayCluster", props: { metadata: { name: "ml", namespace: "ray" } } },
|
|
201
|
-
]),
|
|
202
|
-
},
|
|
203
|
-
cluster.connector,
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
expect(result.unobserved ?? {}).toEqual({});
|
|
207
|
-
expect(result.resources.ml).toMatchObject({ type: "K8s::Ray::RayCluster", physicalId: "uid-ray", status: "ready" });
|
|
208
|
-
expect(cluster.layer.paths()).toContain("/apis/ray.io/v1/namespaces/ray/rayclusters/ml");
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
test.each([
|
|
212
|
-
["K8s::Argo::Application", "argoproj.io/v1alpha1", "Application", "applications"],
|
|
213
|
-
["K8s::CertManager::Certificate", "cert-manager.io/v1", "Certificate", "certificates"],
|
|
214
|
-
["K8s::Rbac::ClusterRole", "rbac.authorization.k8s.io/v1", "ClusterRole", "clusterroles"],
|
|
215
|
-
["K8s::Batch::CronJob", "batch/v1", "CronJob", "cronjobs"],
|
|
216
|
-
["K8s::Networking::Ingress", "networking.k8s.io/v1", "Ingress", "ingresses"],
|
|
217
|
-
])("%s addresses %s %s at /%s", async (entityType, apiVersion, kind, plural) => {
|
|
218
|
-
const clusterScoped = kind === "ClusterRole";
|
|
219
|
-
const object = {
|
|
220
|
-
apiVersion,
|
|
221
|
-
kind,
|
|
222
|
-
metadata: { name: "x", ...(clusterScoped ? {} : { namespace: "prod" }), uid: `uid-${kind}` },
|
|
223
|
-
};
|
|
224
|
-
const cluster = fakeCluster({
|
|
225
|
-
objects: { [objectKey(apiVersion, kind, "x", clusterScoped ? undefined : "prod")]: object },
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
const result = await describeResources(
|
|
229
|
-
{
|
|
230
|
-
environment: "prod",
|
|
231
|
-
buildOutput: "",
|
|
232
|
-
entityNames: ["x"],
|
|
233
|
-
entities: makeEntities([
|
|
234
|
-
{ name: "x", entityType, props: { metadata: { name: "x", ...(clusterScoped ? {} : { namespace: "prod" }) } } },
|
|
235
|
-
]),
|
|
236
|
-
},
|
|
237
|
-
cluster.connector,
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
expect(result.resources.x?.physicalId).toBe(`uid-${kind}`);
|
|
241
|
-
expect(cluster.layer.paths().some((p) => p.endsWith(`/${plural}/x`))).toBe(true);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test("an entity type chant has no address for at all is unobserved, never absent", async () => {
|
|
245
|
-
const cluster = fakeCluster();
|
|
246
|
-
const result = await describeResources(
|
|
247
|
-
{
|
|
248
|
-
environment: "prod",
|
|
249
|
-
buildOutput: "",
|
|
250
|
-
entityNames: ["exotic"],
|
|
251
|
-
entities: makeEntities([
|
|
252
|
-
{ name: "exotic", entityType: "K8s::NotAGroupChantKnows::Thing", props: { metadata: { name: "x" } } },
|
|
253
|
-
]),
|
|
254
|
-
},
|
|
255
|
-
cluster.connector,
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
expect(result.resources).toEqual({});
|
|
259
|
-
expect(result.unobserved?.exotic).toMatchObject({
|
|
260
|
-
type: "K8s::NotAGroupChantKnows::Thing",
|
|
261
|
-
reason: "unsupported-kind",
|
|
262
|
-
});
|
|
263
|
-
// Nothing was asked of the cluster for it.
|
|
264
|
-
expect(cluster.layer.paths().some((p) => p.includes("Thing"))).toBe(false);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
// chant #1089 — a failure that is not a NotFound proves nothing about
|
|
268
|
-
// existence, and must not reach the change set as an absence.
|
|
269
|
-
test.each([
|
|
270
|
-
[401, "Unauthorized", "no-credentials"],
|
|
271
|
-
[403, "Forbidden", "no-credentials"],
|
|
272
|
-
[500, "InternalError", "read-failed"],
|
|
273
|
-
])("HTTP %i is reported unobserved (%s → %s)", async (code, reason, expected) => {
|
|
274
|
-
const cluster = fakeCluster({
|
|
275
|
-
respond: (req) =>
|
|
276
|
-
req.path.endsWith("/deployments/web") ? { status: code, body: statusBody(code, reason, "nope") } : undefined,
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
const result = await describeResources(
|
|
280
|
-
{
|
|
281
|
-
environment: "prod",
|
|
282
|
-
buildOutput: "",
|
|
283
|
-
entityNames: ["web"],
|
|
284
|
-
entities: makeEntities([
|
|
285
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
286
|
-
]),
|
|
287
|
-
},
|
|
288
|
-
cluster.connector,
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
expect(result.resources).toEqual({});
|
|
292
|
-
expect(result.unobserved?.web?.reason).toBe(expected);
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
test("an unreachable API server is no-binding, not an empty cluster", async () => {
|
|
296
|
-
const cluster = fakeCluster({
|
|
297
|
-
respond: () => {
|
|
298
|
-
throw new Error("connect ECONNREFUSED 127.0.0.1:6443");
|
|
299
|
-
},
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
const result = await describeResources(
|
|
303
|
-
{
|
|
304
|
-
environment: "prod",
|
|
305
|
-
buildOutput: "",
|
|
306
|
-
entityNames: ["web"],
|
|
307
|
-
entities: makeEntities([
|
|
308
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
309
|
-
]),
|
|
310
|
-
},
|
|
311
|
-
cluster.connector,
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
expect(result.resources).toEqual({});
|
|
315
|
-
expect(result.unobserved?.web?.reason).toBe("no-binding");
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
test("a kind the cluster does not serve is a real absence (nothing of that kind can exist)", async () => {
|
|
319
|
-
// A cluster that serves only core v1 — so apps/v1 discovery 404s.
|
|
320
|
-
const cluster = fakeCluster({ serves: ["K8s::Core::Service"] });
|
|
321
|
-
const result = await describeResources(
|
|
322
|
-
{
|
|
323
|
-
environment: "prod",
|
|
324
|
-
buildOutput: "",
|
|
325
|
-
entityNames: ["web"],
|
|
326
|
-
entities: makeEntities([
|
|
327
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
328
|
-
]),
|
|
329
|
-
},
|
|
330
|
-
cluster.connector,
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
expect(result.resources).toEqual({});
|
|
334
|
-
expect(result.unobserved ?? {}).toEqual({});
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
test("--owned withholds an unmarked live object as `filtered`, never as absent (#1089)", async () => {
|
|
338
|
-
const cluster = fakeCluster({ objects: { [objectKey("apps/v1", "Deployment", "web", "prod")]: web } });
|
|
339
|
-
const result = await describeResources(
|
|
340
|
-
{
|
|
341
|
-
environment: "prod",
|
|
342
|
-
buildOutput: "",
|
|
343
|
-
entityNames: ["web"],
|
|
344
|
-
entities: makeEntities([
|
|
345
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
346
|
-
]),
|
|
347
|
-
owned: true,
|
|
348
|
-
},
|
|
349
|
-
cluster.connector,
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
expect(result.resources).toEqual({});
|
|
353
|
-
expect(result.unobserved?.web?.reason).toBe("filtered");
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
test("status derivation is unchanged: phase, ready/total, or PRESENT", async () => {
|
|
357
|
-
const progressing = { ...web, status: { readyReplicas: 1, replicas: 3 } };
|
|
358
|
-
const pod = {
|
|
359
|
-
apiVersion: "v1",
|
|
360
|
-
kind: "Pod",
|
|
361
|
-
metadata: { name: "p", namespace: "prod", uid: "uid-p" },
|
|
362
|
-
status: { phase: "Running" },
|
|
363
|
-
};
|
|
364
|
-
const cluster = fakeCluster({
|
|
365
|
-
objects: {
|
|
366
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: progressing,
|
|
367
|
-
[objectKey("v1", "Pod", "p", "prod")]: pod,
|
|
368
|
-
[objectKey("v1", "Service", "web-svc", "prod")]: webSvc,
|
|
369
|
-
},
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
const result = await describeResources(
|
|
373
|
-
{
|
|
374
|
-
environment: "prod",
|
|
375
|
-
buildOutput: "",
|
|
376
|
-
entityNames: ["web", "p", "webSvc"],
|
|
377
|
-
entities: makeEntities([
|
|
378
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
379
|
-
{ name: "p", entityType: "K8s::Core::Pod", props: { metadata: { name: "p", namespace: "prod" } } },
|
|
380
|
-
{ name: "webSvc", entityType: "K8s::Core::Service", props: { metadata: { name: "web-svc", namespace: "prod" } } },
|
|
381
|
-
]),
|
|
382
|
-
},
|
|
383
|
-
cluster.connector,
|
|
384
|
-
);
|
|
385
|
-
|
|
386
|
-
expect(result.resources.web.status).toBe("PROGRESSING(1/3)");
|
|
387
|
-
expect(result.resources.p.status).toBe("Running");
|
|
388
|
-
expect(result.resources.webSvc.status).toBe("PRESENT");
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
test("a cluster-scoped resource is addressed without a namespace segment", async () => {
|
|
392
|
-
const ns = { apiVersion: "v1", kind: "Namespace", metadata: { name: "mynamespace", uid: "uid-ns" }, status: { phase: "Active" } };
|
|
393
|
-
const cluster = fakeCluster({ objects: { [objectKey("v1", "Namespace", "mynamespace")]: ns } });
|
|
394
|
-
|
|
395
|
-
const result = await describeResources(
|
|
396
|
-
{
|
|
397
|
-
environment: "prod",
|
|
398
|
-
buildOutput: "",
|
|
399
|
-
entityNames: ["ns"],
|
|
400
|
-
entities: makeEntities([{ name: "ns", entityType: "K8s::Core::Namespace", props: { metadata: { name: "mynamespace" } } }]),
|
|
401
|
-
},
|
|
402
|
-
cluster.connector,
|
|
403
|
-
);
|
|
404
|
-
|
|
405
|
-
expect(result.resources.ns.status).toBe("Active");
|
|
406
|
-
expect(cluster.layer.paths()).toContain("/api/v1/namespaces/mynamespace");
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
test("entity without metadata.name is unobserved — nothing was queried", async () => {
|
|
410
|
-
const cluster = fakeCluster();
|
|
411
|
-
const result = await describeResources(
|
|
412
|
-
{
|
|
413
|
-
environment: "prod",
|
|
414
|
-
buildOutput: "",
|
|
415
|
-
entityNames: ["broken"],
|
|
416
|
-
entities: makeEntities([{ name: "broken", entityType: "K8s::Apps::Deployment", props: {} }]),
|
|
417
|
-
},
|
|
418
|
-
cluster.connector,
|
|
419
|
-
);
|
|
420
|
-
|
|
421
|
-
expect(result.resources).toEqual({});
|
|
422
|
-
expect(result.unobserved?.broken?.reason).toBe("read-failed");
|
|
423
|
-
expect(cluster.layer.paths().some((p) => p.includes("/deployments/"))).toBe(false);
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
test("reads run concurrently — 40 entities are not 40 serial round trips", async () => {
|
|
427
|
-
const objects: Record<string, (typeof web)> = {};
|
|
428
|
-
const entities: Entity[] = [];
|
|
429
|
-
for (let i = 0; i < 40; i++) {
|
|
430
|
-
objects[objectKey("apps/v1", "Deployment", `web-${i}`, "prod")] = {
|
|
431
|
-
...web,
|
|
432
|
-
metadata: { ...web.metadata, name: `web-${i}`, uid: `uid-${i}` },
|
|
433
|
-
};
|
|
434
|
-
entities.push({
|
|
435
|
-
name: `web-${i}`,
|
|
436
|
-
entityType: "K8s::Apps::Deployment",
|
|
437
|
-
props: { metadata: { name: `web-${i}`, namespace: "prod" } },
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
let inFlight = 0;
|
|
442
|
-
let peak = 0;
|
|
443
|
-
const cluster = fakeCluster({
|
|
444
|
-
objects,
|
|
445
|
-
respond: () => {
|
|
446
|
-
inFlight++;
|
|
447
|
-
peak = Math.max(peak, inFlight);
|
|
448
|
-
queueMicrotask(() => inFlight--);
|
|
449
|
-
return undefined;
|
|
450
|
-
},
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
const result = await describeResources(
|
|
454
|
-
{ environment: "prod", buildOutput: "", entityNames: entities.map((e) => e.name), entities: makeEntities(entities) },
|
|
455
|
-
cluster.connector,
|
|
456
|
-
);
|
|
457
|
-
|
|
458
|
-
expect(Object.keys(result.resources)).toHaveLength(40);
|
|
459
|
-
expect(peak).toBeGreaterThan(1);
|
|
460
|
-
// One discovery request for apps/v1 serves all forty reads.
|
|
461
|
-
expect(cluster.layer.paths().filter((p) => p === "/apis/apps/v1")).toHaveLength(1);
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
// chant #1100/#1155 — the binding carries over to the typed client
|
|
465
|
-
// unchanged. These drive the REAL connector, so `resolveClusterTarget` runs
|
|
466
|
-
// for real; only the kubeconfig and the transport are supplied.
|
|
467
|
-
describe("cluster binding (chant #1100, through the typed client)", () => {
|
|
468
|
-
const twoContexts = fakeKubeconfig({
|
|
469
|
-
contexts: [
|
|
470
|
-
{ name: "prod-eks", cluster: "prod", user: "prod-user" },
|
|
471
|
-
{ name: "staging-eks", cluster: "staging", user: "staging-user" },
|
|
472
|
-
],
|
|
473
|
-
currentContext: "prod-eks",
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
function entities() {
|
|
477
|
-
return makeEntities([
|
|
478
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
479
|
-
]);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
test("bound and ambient context matches: observes explicitly against the bound context", async () => {
|
|
483
|
-
loadChantConfigMock.mockResolvedValue({ config: { k8s: { profiles: { prod: { context: "prod-eks" } } } } });
|
|
484
|
-
const cluster = fakeCluster({
|
|
485
|
-
kubeconfig: twoContexts,
|
|
486
|
-
objects: { [objectKey("apps/v1", "Deployment", "web", "prod")]: web },
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
const result = await describeResources(
|
|
490
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: entities() },
|
|
491
|
-
// The real connector, with only the kubeconfig and transport supplied.
|
|
492
|
-
(o) => defaultK8sConnector({ ...o, client: { kubeconfig: twoContexts, requestLayer: cluster.layer } }),
|
|
493
|
-
);
|
|
494
|
-
|
|
495
|
-
expect(result.resources.web).toMatchObject({ type: "K8s::Apps::Deployment", physicalId: "uid-1", status: "READY" });
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
test("bound while a different context is ambient: the binding wins and the estate observes (#1488)", async () => {
|
|
499
|
-
loadChantConfigMock.mockResolvedValue({ config: { k8s: { profiles: { prod: { context: "prod-eks" } } } } });
|
|
500
|
-
// Ambient points at staging — the state any other project's k3d cluster
|
|
501
|
-
// leaves behind. Before #1488 this refused and the whole estate read
|
|
502
|
-
// grey; the declared binding must simply be used instead.
|
|
503
|
-
const ambientIsStaging = fakeKubeconfig({
|
|
504
|
-
contexts: [
|
|
505
|
-
{ name: "prod-eks", cluster: "prod", user: "prod-user" },
|
|
506
|
-
{ name: "staging-eks", cluster: "staging", user: "staging-user" },
|
|
507
|
-
],
|
|
508
|
-
currentContext: "staging-eks",
|
|
509
|
-
});
|
|
510
|
-
const cluster = fakeCluster({
|
|
511
|
-
kubeconfig: ambientIsStaging,
|
|
512
|
-
objects: { [objectKey("apps/v1", "Deployment", "web", "prod")]: web },
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
const result = await describeResources(
|
|
516
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: entities() },
|
|
517
|
-
(o) => defaultK8sConnector({ ...o, client: { kubeconfig: ambientIsStaging, requestLayer: cluster.layer } }),
|
|
518
|
-
);
|
|
519
|
-
|
|
520
|
-
expect(result.resources.web).toMatchObject({ type: "K8s::Apps::Deployment", physicalId: "uid-1", status: "READY" });
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
test("unbound: the kubeconfig's own context is used, and the fallback is visible", async () => {
|
|
524
|
-
loadChantConfigMock.mockResolvedValue({ config: {} });
|
|
525
|
-
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
526
|
-
const cluster = fakeCluster({
|
|
527
|
-
kubeconfig: twoContexts,
|
|
528
|
-
objects: { [objectKey("apps/v1", "Deployment", "web", "prod")]: web },
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
const result = await describeResources(
|
|
532
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: entities() },
|
|
533
|
-
(o) => defaultK8sConnector({ ...o, client: { kubeconfig: twoContexts, requestLayer: cluster.layer } }),
|
|
534
|
-
);
|
|
535
|
-
|
|
536
|
-
expect(result.resources.web).toMatchObject({ physicalId: "uid-1", status: "READY" });
|
|
537
|
-
const bindingWarning = warnSpy.mock.calls.find((c) => String(c[0]).includes("no cluster binding"));
|
|
538
|
-
expect(bindingWarning?.[0]).toContain('environment "prod"');
|
|
539
|
-
expect(bindingWarning?.[0]).toContain("k8s.profiles.prod.context");
|
|
540
|
-
warnSpy.mockRestore();
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
test("a failed read names the bound context it read (#1488)", async () => {
|
|
544
|
-
loadChantConfigMock.mockResolvedValue({ config: { k8s: { profiles: { prod: { context: "prod-eks" } } } } });
|
|
545
|
-
const cluster = fakeCluster({
|
|
546
|
-
kubeconfig: twoContexts,
|
|
547
|
-
respond: (req) =>
|
|
548
|
-
req.path.endsWith("/deployments/web")
|
|
549
|
-
? { status: 500, body: statusBody(500, "InternalError", "etcdserver: leader changed") }
|
|
550
|
-
: undefined,
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
const result = await describeResources(
|
|
554
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: entities() },
|
|
555
|
-
(o) => defaultK8sConnector({ ...o, client: { kubeconfig: twoContexts, requestLayer: cluster.layer } }),
|
|
556
|
-
);
|
|
557
|
-
|
|
558
|
-
expect(result.unobserved?.web?.reason).toBe("read-failed");
|
|
559
|
-
expect(result.unobserved?.web?.detail).toContain('context "prod-eks" (bound by k8s.profiles.prod.context)');
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
test("an ambient read failure names the context that was read and the missing binding (#1488)", async () => {
|
|
563
|
-
loadChantConfigMock.mockResolvedValue({ config: {} });
|
|
564
|
-
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
565
|
-
const cluster = fakeCluster({
|
|
566
|
-
kubeconfig: twoContexts,
|
|
567
|
-
respond: (req) =>
|
|
568
|
-
req.path.endsWith("/deployments/web") ? { status: 500, body: statusBody(500, "InternalError", "nope") } : undefined,
|
|
569
|
-
});
|
|
570
|
-
|
|
571
|
-
const result = await describeResources(
|
|
572
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: entities() },
|
|
573
|
-
(o) => defaultK8sConnector({ ...o, client: { kubeconfig: twoContexts, requestLayer: cluster.layer } }),
|
|
574
|
-
);
|
|
575
|
-
warnSpy.mockRestore();
|
|
576
|
-
|
|
577
|
-
expect(result.unobserved?.web?.reason).toBe("read-failed");
|
|
578
|
-
expect(result.unobserved?.web?.detail).toContain('context "prod-eks" (ambient; no k8s.profiles.prod binding)');
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
test("a bound context the kubeconfig does not have refuses with the context name", async () => {
|
|
582
|
-
loadChantConfigMock.mockResolvedValue({ config: { k8s: { profiles: { prod: { context: "gone-eks" } } } } });
|
|
583
|
-
const oneContext = fakeKubeconfig({ contexts: [{ name: "prod-eks" }], currentContext: "prod-eks" });
|
|
584
|
-
const cluster = fakeCluster({ kubeconfig: oneContext });
|
|
585
|
-
|
|
586
|
-
const result = await describeResources(
|
|
587
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: entities() },
|
|
588
|
-
(o) => defaultK8sConnector({ ...o, client: { kubeconfig: oneContext, requestLayer: cluster.layer } }),
|
|
589
|
-
).catch(() => undefined);
|
|
590
|
-
|
|
591
|
-
// resolveClusterTarget refuses on the mismatch first; either way no read happened.
|
|
592
|
-
expect(result?.resources ?? {}).toEqual({});
|
|
593
|
-
expect(cluster.layer.requests).toHaveLength(0);
|
|
594
|
-
});
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
// The optional dependency is missing: chant reports holes with an actionable
|
|
598
|
-
// reason rather than an empty cluster (which would classify as N creates).
|
|
599
|
-
test("a missing client package is a hole with an install hint, never an absence", async () => {
|
|
600
|
-
const result = await describeResources(
|
|
601
|
-
{
|
|
602
|
-
environment: "prod",
|
|
603
|
-
buildOutput: "",
|
|
604
|
-
entityNames: ["web"],
|
|
605
|
-
entities: makeEntities([
|
|
606
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
607
|
-
]),
|
|
608
|
-
},
|
|
609
|
-
async () => {
|
|
610
|
-
throw Object.assign(new Error("Cannot find package '@intentius/chant-k8s-client'"), {
|
|
611
|
-
code: "ERR_MODULE_NOT_FOUND",
|
|
612
|
-
});
|
|
613
|
-
},
|
|
614
|
-
);
|
|
615
|
-
|
|
616
|
-
expect(result.resources).toEqual({});
|
|
617
|
-
expect(result.unobserved?.web?.reason).toBe("read-failed");
|
|
618
|
-
expect(result.unobserved?.web?.detail).toContain("npm i @intentius/chant-k8s-client");
|
|
619
|
-
expect(result.unobserved?.web?.type).toBe("K8s::Apps::Deployment");
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
// ── Runtime children: owner-reference chain classification (chant #1077) ──
|
|
623
|
-
|
|
624
|
-
describe("runtime children of the estate's own API groups (#1517)", () => {
|
|
625
|
-
function declaredCronJob() {
|
|
626
|
-
return makeEntities([
|
|
627
|
-
{ name: "backup", entityType: "K8s::Batch::CronJob", props: { metadata: { name: "backup", namespace: "prod" } } },
|
|
628
|
-
]);
|
|
629
|
-
}
|
|
630
|
-
const cronJob = {
|
|
631
|
-
apiVersion: "batch/v1",
|
|
632
|
-
kind: "CronJob",
|
|
633
|
-
metadata: { name: "backup", namespace: "prod", uid: "cj-uid" },
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
test("a controller-made child in a declared non-core group surfaces with its own kind and a declared chain", async () => {
|
|
637
|
-
const job = {
|
|
638
|
-
apiVersion: "batch/v1",
|
|
639
|
-
kind: "Job",
|
|
640
|
-
metadata: {
|
|
641
|
-
name: "backup-29157",
|
|
642
|
-
namespace: "prod",
|
|
643
|
-
uid: "job-uid",
|
|
644
|
-
ownerReferences: [{ apiVersion: "batch/v1", kind: "CronJob", name: "backup", uid: "cj-uid", controller: true }],
|
|
645
|
-
},
|
|
646
|
-
status: { conditions: [{ type: "Complete", status: "True" }] },
|
|
647
|
-
};
|
|
648
|
-
const cluster = fakeCluster({
|
|
649
|
-
objects: {
|
|
650
|
-
[objectKey("batch/v1", "CronJob", "backup", "prod")]: cronJob,
|
|
651
|
-
[objectKey("batch/v1", "Job", "backup-29157", "prod")]: job,
|
|
652
|
-
},
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
const result = await describeResources(
|
|
656
|
-
{ environment: "prod", buildOutput: "", entityNames: ["backup"], entities: declaredCronJob() },
|
|
657
|
-
cluster.connector,
|
|
658
|
-
);
|
|
659
|
-
|
|
660
|
-
const child = result.resources["Job/prod/backup-29157"];
|
|
661
|
-
expect(child).toMatchObject({
|
|
662
|
-
type: "K8s::Batch::Job",
|
|
663
|
-
physicalId: "job-uid",
|
|
664
|
-
ownerChain: { root: "declared", entity: "backup" },
|
|
665
|
-
});
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
test("a loose object in a swept group with no owner chain is NOT reported — the scan is not an inventory", async () => {
|
|
669
|
-
const looseJob = {
|
|
670
|
-
apiVersion: "batch/v1",
|
|
671
|
-
kind: "Job",
|
|
672
|
-
metadata: { name: "hand-made", namespace: "prod", uid: "loose-uid" },
|
|
673
|
-
};
|
|
674
|
-
const cluster = fakeCluster({
|
|
675
|
-
objects: {
|
|
676
|
-
[objectKey("batch/v1", "CronJob", "backup", "prod")]: cronJob,
|
|
677
|
-
[objectKey("batch/v1", "Job", "hand-made", "prod")]: looseJob,
|
|
678
|
-
},
|
|
679
|
-
});
|
|
680
|
-
|
|
681
|
-
const result = await describeResources(
|
|
682
|
-
{ environment: "prod", buildOutput: "", entityNames: ["backup"], entities: declaredCronJob() },
|
|
683
|
-
cluster.connector,
|
|
684
|
-
);
|
|
685
|
-
|
|
686
|
-
expect(result.resources["Job/prod/hand-made"]).toBeUndefined();
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
// The issue's own estate: a declared MicroVMReplicaSet whose operator
|
|
690
|
-
// made MicroVMs — a CRD kind no table anticipated. Discovery names it.
|
|
691
|
-
test("a controller-made child of a CRD kind surfaces as a runtime child of the declared CR", async () => {
|
|
692
|
-
const replicaSet = {
|
|
693
|
-
apiVersion: "lambda.aws.amazon.com/v1alpha1",
|
|
694
|
-
kind: "MicroVMReplicaSet",
|
|
695
|
-
metadata: { name: "kmv-dev-a-vm", namespace: "microvm-demo", uid: "mvrs-uid" },
|
|
696
|
-
};
|
|
697
|
-
const vm = {
|
|
698
|
-
apiVersion: "lambda.aws.amazon.com/v1alpha1",
|
|
699
|
-
kind: "MicroVM",
|
|
700
|
-
metadata: {
|
|
701
|
-
name: "kmv-dev-a-vm-42sgf",
|
|
702
|
-
namespace: "microvm-demo",
|
|
703
|
-
uid: "vm-uid",
|
|
704
|
-
ownerReferences: [
|
|
705
|
-
{ apiVersion: "lambda.aws.amazon.com/v1alpha1", kind: "MicroVMReplicaSet", name: "kmv-dev-a-vm", uid: "mvrs-uid", controller: true },
|
|
706
|
-
],
|
|
707
|
-
},
|
|
708
|
-
status: { phase: "Running" },
|
|
709
|
-
};
|
|
710
|
-
const cluster = fakeCluster({
|
|
711
|
-
objects: {
|
|
712
|
-
[objectKey("lambda.aws.amazon.com/v1alpha1", "MicroVMReplicaSet", "kmv-dev-a-vm", "microvm-demo")]: replicaSet,
|
|
713
|
-
[objectKey("lambda.aws.amazon.com/v1alpha1", "MicroVM", "kmv-dev-a-vm-42sgf", "microvm-demo")]: vm,
|
|
714
|
-
},
|
|
715
|
-
});
|
|
716
|
-
|
|
717
|
-
const result = await describeResources(
|
|
718
|
-
{
|
|
719
|
-
environment: "dev",
|
|
720
|
-
buildOutput: "",
|
|
721
|
-
entityNames: ["workloadReplicaSet"],
|
|
722
|
-
entities: makeEntities([
|
|
723
|
-
{
|
|
724
|
-
name: "workloadReplicaSet",
|
|
725
|
-
entityType: "K8s::KubeMicroVM::MicroVMReplicaSet",
|
|
726
|
-
props: { metadata: { name: "kmv-dev-a-vm", namespace: "microvm-demo" } },
|
|
727
|
-
},
|
|
728
|
-
]),
|
|
729
|
-
},
|
|
730
|
-
cluster.connector,
|
|
731
|
-
);
|
|
732
|
-
|
|
733
|
-
expect(result.resources["MicroVM/microvm-demo/kmv-dev-a-vm-42sgf"]).toMatchObject({
|
|
734
|
-
type: "K8s::KubeMicroVM::MicroVM",
|
|
735
|
-
physicalId: "vm-uid",
|
|
736
|
-
ownerChain: { root: "declared", entity: "workloadReplicaSet" },
|
|
737
|
-
});
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
test("a child in a group the estate never declares surfaces too — discovery names the kinds, not the declaration", async () => {
|
|
741
|
-
// A declared CR whose operator makes ordinary Deployments: ray.io is
|
|
742
|
-
// declared, apps/v1 is not, and the estate-groups sweep never listed it.
|
|
743
|
-
const rayCluster = { apiVersion: "ray.io/v1", kind: "RayCluster", metadata: { name: "ml", namespace: "ray", uid: "ray-uid" } };
|
|
744
|
-
const head = {
|
|
745
|
-
apiVersion: "apps/v1",
|
|
746
|
-
kind: "Deployment",
|
|
747
|
-
metadata: {
|
|
748
|
-
name: "ml-head",
|
|
749
|
-
namespace: "ray",
|
|
750
|
-
uid: "head-uid",
|
|
751
|
-
ownerReferences: [{ apiVersion: "ray.io/v1", kind: "RayCluster", name: "ml", uid: "ray-uid", controller: true }],
|
|
752
|
-
},
|
|
753
|
-
status: { readyReplicas: 1, replicas: 1 },
|
|
754
|
-
};
|
|
755
|
-
const cluster = fakeCluster({
|
|
756
|
-
objects: {
|
|
757
|
-
[objectKey("ray.io/v1", "RayCluster", "ml", "ray")]: rayCluster,
|
|
758
|
-
[objectKey("apps/v1", "Deployment", "ml-head", "ray")]: head,
|
|
759
|
-
},
|
|
760
|
-
});
|
|
761
|
-
|
|
762
|
-
const result = await describeResources(
|
|
763
|
-
{
|
|
764
|
-
environment: "prod",
|
|
765
|
-
buildOutput: "",
|
|
766
|
-
entityNames: ["ml"],
|
|
767
|
-
entities: makeEntities([
|
|
768
|
-
{ name: "ml", entityType: "K8s::Ray::RayCluster", props: { metadata: { name: "ml", namespace: "ray" } } },
|
|
769
|
-
]),
|
|
770
|
-
},
|
|
771
|
-
cluster.connector,
|
|
772
|
-
);
|
|
773
|
-
|
|
774
|
-
expect(result.resources["Deployment/ray/ml-head"]).toMatchObject({
|
|
775
|
-
type: "K8s::Apps::Deployment",
|
|
776
|
-
physicalId: "head-uid",
|
|
777
|
-
ownerChain: { root: "declared", entity: "ml" },
|
|
778
|
-
});
|
|
779
|
-
});
|
|
780
|
-
|
|
781
|
-
test("a discovered kind the sweep cannot list is an unobserved hole, never silently absent", async () => {
|
|
782
|
-
const cluster = fakeCluster({
|
|
783
|
-
objects: { [objectKey("batch/v1", "CronJob", "backup", "prod")]: cronJob },
|
|
784
|
-
respond: (req) =>
|
|
785
|
-
req.path === "/apis/batch/v1/namespaces/prod/jobs"
|
|
786
|
-
? { status: 403, body: statusBody(403, "Forbidden", "jobs is forbidden") }
|
|
787
|
-
: undefined,
|
|
788
|
-
});
|
|
789
|
-
|
|
790
|
-
const result = await describeResources(
|
|
791
|
-
{ environment: "prod", buildOutput: "", entityNames: ["backup"], entities: declaredCronJob() },
|
|
792
|
-
cluster.connector,
|
|
793
|
-
);
|
|
794
|
-
|
|
795
|
-
// Declared resolution is never failed by the sweep.
|
|
796
|
-
expect(result.resources.backup).toMatchObject({ type: "K8s::Batch::CronJob", physicalId: "cj-uid" });
|
|
797
|
-
// The failed list is a hole the observation admits, with the failure's
|
|
798
|
-
// own classification — a 403 is a credentials problem, and silence here
|
|
799
|
-
// would have read as "no runtime children in prod".
|
|
800
|
-
expect(result.unobserved?.["runtime-sweep:batch/v1/Job"]).toMatchObject({
|
|
801
|
-
type: "K8s::Batch::Job",
|
|
802
|
-
reason: "no-credentials",
|
|
803
|
-
});
|
|
804
|
-
expect(result.unobserved?.["runtime-sweep:batch/v1/Job"]?.detail).toContain("namespace prod");
|
|
805
|
-
});
|
|
806
|
-
|
|
807
|
-
test("a cluster-scoped child chains to a declared cluster-scoped entity — the one case cluster-scoped kinds are swept", async () => {
|
|
808
|
-
const ns = { apiVersion: "v1", kind: "Namespace", metadata: { name: "team-a", uid: "ns-uid" }, status: { phase: "Active" } };
|
|
809
|
-
const role = {
|
|
810
|
-
apiVersion: "rbac.authorization.k8s.io/v1",
|
|
811
|
-
kind: "ClusterRole",
|
|
812
|
-
metadata: {
|
|
813
|
-
name: "team-a-admin",
|
|
814
|
-
uid: "role-uid",
|
|
815
|
-
ownerReferences: [{ apiVersion: "v1", kind: "Namespace", name: "team-a", uid: "ns-uid", controller: true }],
|
|
816
|
-
},
|
|
817
|
-
};
|
|
818
|
-
const cluster = fakeCluster({
|
|
819
|
-
objects: {
|
|
820
|
-
[objectKey("v1", "Namespace", "team-a")]: ns,
|
|
821
|
-
[objectKey("rbac.authorization.k8s.io/v1", "ClusterRole", "team-a-admin")]: role,
|
|
822
|
-
},
|
|
823
|
-
});
|
|
824
|
-
|
|
825
|
-
const result = await describeResources(
|
|
826
|
-
{
|
|
827
|
-
environment: "prod",
|
|
828
|
-
buildOutput: "",
|
|
829
|
-
entityNames: ["team"],
|
|
830
|
-
entities: makeEntities([
|
|
831
|
-
{ name: "team", entityType: "K8s::Core::Namespace", props: { metadata: { name: "team-a" } } },
|
|
832
|
-
]),
|
|
833
|
-
},
|
|
834
|
-
cluster.connector,
|
|
835
|
-
);
|
|
836
|
-
|
|
837
|
-
expect(result.resources["cluster:ClusterRole/team-a-admin"]).toMatchObject({
|
|
838
|
-
type: "K8s::Rbac::ClusterRole",
|
|
839
|
-
physicalId: "role-uid",
|
|
840
|
-
ownerChain: { root: "declared", entity: "team" },
|
|
841
|
-
});
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
test("a Flux-managed Deployment is attributed to its declared Kustomization by the controller's labels (#1549)", async () => {
|
|
845
|
-
// Flux stamps managed objects with name+namespace labels instead of
|
|
846
|
-
// ownerReferences, so the chain walk reaches nothing — the label
|
|
847
|
-
// channel resolves against the DECLARED CR, exactly. The workload also
|
|
848
|
-
// lives in a namespace the estate never declares an entity in: the
|
|
849
|
-
// Kustomization's own spec.targetNamespace is what puts it in scope.
|
|
850
|
-
const kustomization = {
|
|
851
|
-
apiVersion: "kustomize.toolkit.fluxcd.io/v1",
|
|
852
|
-
kind: "Kustomization",
|
|
853
|
-
metadata: { name: "apps", namespace: "flux-system", uid: "ks-uid" },
|
|
854
|
-
status: { conditions: [{ type: "Ready", status: "True" }] },
|
|
855
|
-
};
|
|
856
|
-
const managed = {
|
|
857
|
-
apiVersion: "apps/v1",
|
|
858
|
-
kind: "Deployment",
|
|
859
|
-
metadata: {
|
|
860
|
-
name: "web",
|
|
861
|
-
namespace: "prod",
|
|
862
|
-
uid: "dep-uid",
|
|
863
|
-
labels: { "kustomize.toolkit.fluxcd.io/name": "apps", "kustomize.toolkit.fluxcd.io/namespace": "flux-system" },
|
|
864
|
-
},
|
|
865
|
-
status: { readyReplicas: 1, replicas: 1 },
|
|
866
|
-
};
|
|
867
|
-
const cluster = fakeCluster({
|
|
868
|
-
objects: {
|
|
869
|
-
[objectKey("kustomize.toolkit.fluxcd.io/v1", "Kustomization", "apps", "flux-system")]: kustomization,
|
|
870
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: managed,
|
|
871
|
-
},
|
|
872
|
-
});
|
|
873
|
-
|
|
874
|
-
const result = await describeResources(
|
|
875
|
-
{
|
|
876
|
-
environment: "prod",
|
|
877
|
-
buildOutput: "",
|
|
878
|
-
entityNames: ["apps"],
|
|
879
|
-
entities: makeEntities([
|
|
880
|
-
{
|
|
881
|
-
name: "apps",
|
|
882
|
-
entityType: "K8s::Flux::Kustomization",
|
|
883
|
-
props: { metadata: { name: "apps", namespace: "flux-system" }, spec: { targetNamespace: "prod", sourceRef: { kind: "GitRepository", name: "infra" } } },
|
|
884
|
-
},
|
|
885
|
-
]),
|
|
886
|
-
},
|
|
887
|
-
cluster.connector,
|
|
888
|
-
);
|
|
889
|
-
|
|
890
|
-
expect(result.resources["Deployment/prod/web"]).toMatchObject({
|
|
891
|
-
type: "K8s::Apps::Deployment",
|
|
892
|
-
ownerChain: { root: "declared", entity: "apps" },
|
|
893
|
-
});
|
|
894
|
-
});
|
|
895
|
-
|
|
896
|
-
test("Argo's bare instance label claims only a UNIQUE declared Application (#1549)", async () => {
|
|
897
|
-
const app = (name: string) => ({
|
|
898
|
-
apiVersion: "argoproj.io/v1alpha1",
|
|
899
|
-
kind: "Application",
|
|
900
|
-
metadata: { name, namespace: "argocd", uid: `${name}-uid` },
|
|
901
|
-
status: { health: { status: "Healthy" }, sync: { status: "Synced" } },
|
|
902
|
-
});
|
|
903
|
-
const managed = {
|
|
904
|
-
apiVersion: "apps/v1",
|
|
905
|
-
kind: "Deployment",
|
|
906
|
-
metadata: { name: "web", namespace: "prod", uid: "dep-uid", labels: { "app.kubernetes.io/instance": "web" } },
|
|
907
|
-
};
|
|
908
|
-
const cluster = fakeCluster({
|
|
909
|
-
objects: {
|
|
910
|
-
[objectKey("argoproj.io/v1alpha1", "Application", "web", "argocd")]: app("web"),
|
|
911
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: managed,
|
|
912
|
-
},
|
|
913
|
-
});
|
|
914
|
-
|
|
915
|
-
const result = await describeResources(
|
|
916
|
-
{
|
|
917
|
-
environment: "prod",
|
|
918
|
-
buildOutput: "",
|
|
919
|
-
entityNames: ["webApp"],
|
|
920
|
-
entities: makeEntities([
|
|
921
|
-
{
|
|
922
|
-
name: "webApp",
|
|
923
|
-
entityType: "K8s::Argo::Application",
|
|
924
|
-
props: { metadata: { name: "web", namespace: "argocd" }, spec: { destination: { namespace: "prod" } } },
|
|
925
|
-
},
|
|
926
|
-
]),
|
|
927
|
-
},
|
|
928
|
-
cluster.connector,
|
|
929
|
-
);
|
|
930
|
-
|
|
931
|
-
expect(result.resources["Deployment/prod/web"]).toMatchObject({
|
|
932
|
-
type: "K8s::Apps::Deployment",
|
|
933
|
-
ownerChain: { root: "declared", entity: "webApp" },
|
|
934
|
-
});
|
|
935
|
-
});
|
|
936
|
-
|
|
937
|
-
// #1643 — the common convention names a workload and its Service alike, so
|
|
938
|
-
// a kind-less `namespace/name` key made them one row and only whichever
|
|
939
|
-
// kind swept first survived. Found by behold's argo estate: Application
|
|
940
|
-
// boxes held Endpoints instead of the Deployment.
|
|
941
|
-
test("same-named objects of different kinds are all reported — the key carries the kind (#1643)", async () => {
|
|
942
|
-
const app = {
|
|
943
|
-
apiVersion: "argoproj.io/v1alpha1",
|
|
944
|
-
kind: "Application",
|
|
945
|
-
metadata: { name: "app-a", namespace: "argocd", uid: "app-uid" },
|
|
946
|
-
status: { health: { status: "Healthy" }, sync: { status: "Synced" } },
|
|
947
|
-
};
|
|
948
|
-
const label = { "app.kubernetes.io/instance": "app-a" };
|
|
949
|
-
const deployment = {
|
|
950
|
-
apiVersion: "apps/v1",
|
|
951
|
-
kind: "Deployment",
|
|
952
|
-
metadata: { name: "app-a", namespace: "app-a", uid: "dep-uid", labels: label },
|
|
953
|
-
};
|
|
954
|
-
const service = {
|
|
955
|
-
apiVersion: "v1",
|
|
956
|
-
kind: "Service",
|
|
957
|
-
metadata: { name: "app-a", namespace: "app-a", uid: "svc-uid", labels: label },
|
|
958
|
-
};
|
|
959
|
-
const cluster = fakeCluster({
|
|
960
|
-
objects: {
|
|
961
|
-
[objectKey("argoproj.io/v1alpha1", "Application", "app-a", "argocd")]: app,
|
|
962
|
-
[objectKey("apps/v1", "Deployment", "app-a", "app-a")]: deployment,
|
|
963
|
-
[objectKey("v1", "Service", "app-a", "app-a")]: service,
|
|
964
|
-
},
|
|
965
|
-
});
|
|
966
|
-
|
|
967
|
-
const result = await describeResources(
|
|
968
|
-
{
|
|
969
|
-
environment: "prod",
|
|
970
|
-
buildOutput: "",
|
|
971
|
-
entityNames: ["appA"],
|
|
972
|
-
entities: makeEntities([
|
|
973
|
-
{
|
|
974
|
-
name: "appA",
|
|
975
|
-
entityType: "K8s::Argo::Application",
|
|
976
|
-
props: { metadata: { name: "app-a", namespace: "argocd" }, spec: { destination: { namespace: "app-a" } } },
|
|
977
|
-
},
|
|
978
|
-
]),
|
|
979
|
-
},
|
|
980
|
-
cluster.connector,
|
|
981
|
-
);
|
|
982
|
-
|
|
983
|
-
expect(result.resources["Deployment/app-a/app-a"]).toMatchObject({ type: "K8s::Apps::Deployment", physicalId: "dep-uid" });
|
|
984
|
-
expect(result.resources["Service/app-a/app-a"]).toMatchObject({ type: "K8s::Core::Service", physicalId: "svc-uid" });
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
test("a generic instance label matching NO declared Application claims nothing — not an inventory (#1549)", async () => {
|
|
988
|
-
// `app.kubernetes.io/instance` is also what plain helm sets; on an
|
|
989
|
-
// estate declaring a Flux CR (so the widened sweep runs), a foreign
|
|
990
|
-
// helm-installed Deployment must not be attributed.
|
|
991
|
-
const kustomization = {
|
|
992
|
-
apiVersion: "kustomize.toolkit.fluxcd.io/v1",
|
|
993
|
-
kind: "Kustomization",
|
|
994
|
-
metadata: { name: "apps", namespace: "flux-system", uid: "ks-uid" },
|
|
995
|
-
};
|
|
996
|
-
const foreign = {
|
|
997
|
-
apiVersion: "apps/v1",
|
|
998
|
-
kind: "Deployment",
|
|
999
|
-
metadata: { name: "cert-manager", namespace: "flux-system", uid: "cm-uid", labels: { "app.kubernetes.io/instance": "cert-manager" } },
|
|
1000
|
-
};
|
|
1001
|
-
const cluster = fakeCluster({
|
|
1002
|
-
objects: {
|
|
1003
|
-
[objectKey("kustomize.toolkit.fluxcd.io/v1", "Kustomization", "apps", "flux-system")]: kustomization,
|
|
1004
|
-
[objectKey("apps/v1", "Deployment", "cert-manager", "flux-system")]: foreign,
|
|
1005
|
-
},
|
|
1006
|
-
});
|
|
1007
|
-
|
|
1008
|
-
const result = await describeResources(
|
|
1009
|
-
{
|
|
1010
|
-
environment: "prod",
|
|
1011
|
-
buildOutput: "",
|
|
1012
|
-
entityNames: ["apps"],
|
|
1013
|
-
entities: makeEntities([
|
|
1014
|
-
{ name: "apps", entityType: "K8s::Flux::Kustomization", props: { metadata: { name: "apps", namespace: "flux-system" } } },
|
|
1015
|
-
]),
|
|
1016
|
-
},
|
|
1017
|
-
cluster.connector,
|
|
1018
|
-
);
|
|
1019
|
-
|
|
1020
|
-
expect(result.resources["Deployment/flux-system/cert-manager"]).toBeUndefined();
|
|
1021
|
-
});
|
|
1022
|
-
|
|
1023
|
-
test("the sweep's bound is the estate's namespaces, not a kind list — and no cluster-scoped list without a cluster-scoped entity", async () => {
|
|
1024
|
-
const svc = { apiVersion: "v1", kind: "Service", metadata: { name: "web", namespace: "prod", uid: "svc-uid" } };
|
|
1025
|
-
const cluster = fakeCluster({
|
|
1026
|
-
objects: { [objectKey("v1", "Service", "web", "prod")]: svc },
|
|
1027
|
-
});
|
|
1028
|
-
|
|
1029
|
-
await describeResources(
|
|
1030
|
-
{
|
|
1031
|
-
environment: "prod",
|
|
1032
|
-
buildOutput: "",
|
|
1033
|
-
entityNames: ["web"],
|
|
1034
|
-
entities: makeEntities([
|
|
1035
|
-
{ name: "web", entityType: "K8s::Core::Service", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
1036
|
-
]),
|
|
1037
|
-
},
|
|
1038
|
-
cluster.connector,
|
|
1039
|
-
);
|
|
1040
|
-
|
|
1041
|
-
const paths = cluster.layer.paths();
|
|
1042
|
-
const isDiscovery = (p: string) =>
|
|
1043
|
-
p === "/api" || p === "/apis" || /^\/api\/[^/]+$/.test(p) || /^\/apis\/[^/]+\/[^/]+$/.test(p);
|
|
1044
|
-
const reads = paths.filter((p) => !isDiscovery(p));
|
|
1045
|
-
// Discovery names the kinds; every actual read or list stays inside the
|
|
1046
|
-
// one namespace the estate touches. Nothing is listed cluster-wide.
|
|
1047
|
-
expect(reads.length).toBeGreaterThan(0);
|
|
1048
|
-
expect(reads.every((p) => p.includes("/namespaces/prod/"))).toBe(true);
|
|
1049
|
-
// Nothing declared is cluster-scoped, so no owner chain could reach a
|
|
1050
|
-
// cluster-scoped object — their kinds are not listed at all.
|
|
1051
|
-
expect(paths.some((p) => p.endsWith("/clusterroles"))).toBe(false);
|
|
1052
|
-
// Events churn by the thousands and can never chain (`involvedObject`,
|
|
1053
|
-
// not `ownerReferences`) — discovery serves them, the sweep skips them.
|
|
1054
|
-
expect(paths.some((p) => p.endsWith("/events"))).toBe(false);
|
|
1055
|
-
});
|
|
1056
|
-
});
|
|
1057
|
-
|
|
1058
|
-
describe("runtime children (#1077)", () => {
|
|
1059
|
-
function declaredDeployment() {
|
|
1060
|
-
return makeEntities([
|
|
1061
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
1062
|
-
]);
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
test("a Pod owned (via an undeclared ReplicaSet) by a declared Deployment reports ownerChain: declared", async () => {
|
|
1066
|
-
const replicaSet = {
|
|
1067
|
-
apiVersion: "apps/v1",
|
|
1068
|
-
kind: "ReplicaSet",
|
|
1069
|
-
metadata: {
|
|
1070
|
-
name: "web-7d9f8c9c8",
|
|
1071
|
-
namespace: "prod",
|
|
1072
|
-
uid: "rs-uid",
|
|
1073
|
-
ownerReferences: [{ apiVersion: "apps/v1", kind: "Deployment", name: "web", uid: "uid-1", controller: true }],
|
|
1074
|
-
},
|
|
1075
|
-
};
|
|
1076
|
-
const runtimePod = {
|
|
1077
|
-
apiVersion: "v1",
|
|
1078
|
-
kind: "Pod",
|
|
1079
|
-
metadata: {
|
|
1080
|
-
name: "web-7d9f8c9c8-abcde",
|
|
1081
|
-
namespace: "prod",
|
|
1082
|
-
uid: "pod-uid",
|
|
1083
|
-
ownerReferences: [{ apiVersion: "apps/v1", kind: "ReplicaSet", name: "web-7d9f8c9c8", uid: "rs-uid", controller: true }],
|
|
1084
|
-
},
|
|
1085
|
-
status: { phase: "Running" },
|
|
1086
|
-
};
|
|
1087
|
-
const cluster = fakeCluster({
|
|
1088
|
-
objects: {
|
|
1089
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: web,
|
|
1090
|
-
[objectKey("apps/v1", "ReplicaSet", "web-7d9f8c9c8", "prod")]: replicaSet,
|
|
1091
|
-
[objectKey("v1", "Pod", "web-7d9f8c9c8-abcde", "prod")]: runtimePod,
|
|
1092
|
-
},
|
|
1093
|
-
});
|
|
1094
|
-
|
|
1095
|
-
const result = await describeResources(
|
|
1096
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: declaredDeployment() },
|
|
1097
|
-
cluster.connector,
|
|
1098
|
-
);
|
|
1099
|
-
|
|
1100
|
-
const child = result.resources["Pod/prod/web-7d9f8c9c8-abcde"];
|
|
1101
|
-
expect(child).toMatchObject({
|
|
1102
|
-
type: "K8s::Core::Pod",
|
|
1103
|
-
physicalId: "pod-uid",
|
|
1104
|
-
status: "Running",
|
|
1105
|
-
ownerChain: { root: "declared", entity: "web" },
|
|
1106
|
-
});
|
|
1107
|
-
// Reads the ReplicaSet to walk past it — one extra request beyond the
|
|
1108
|
-
// Deployment read and the Pod list.
|
|
1109
|
-
expect(cluster.layer.paths()).toContain("/apis/apps/v1/namespaces/prod/replicasets/web-7d9f8c9c8");
|
|
1110
|
-
});
|
|
1111
|
-
|
|
1112
|
-
test("a genuinely unowned Pod in the same namespace reports ownerChain: unowned (still an orphan downstream)", async () => {
|
|
1113
|
-
const standalonePod = {
|
|
1114
|
-
apiVersion: "v1",
|
|
1115
|
-
kind: "Pod",
|
|
1116
|
-
metadata: { name: "standalone", namespace: "prod", uid: "standalone-uid" },
|
|
1117
|
-
status: { phase: "Running" },
|
|
1118
|
-
};
|
|
1119
|
-
const cluster = fakeCluster({
|
|
1120
|
-
objects: {
|
|
1121
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: web,
|
|
1122
|
-
[objectKey("v1", "Pod", "standalone", "prod")]: standalonePod,
|
|
1123
|
-
},
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1126
|
-
const result = await describeResources(
|
|
1127
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: declaredDeployment() },
|
|
1128
|
-
cluster.connector,
|
|
1129
|
-
);
|
|
1130
|
-
|
|
1131
|
-
expect(result.resources["Pod/prod/standalone"]).toMatchObject({
|
|
1132
|
-
type: "K8s::Core::Pod",
|
|
1133
|
-
ownerChain: { root: "unowned" },
|
|
1134
|
-
});
|
|
1135
|
-
});
|
|
1136
|
-
|
|
1137
|
-
test("a Pod owned by something never declared reports ownerChain: foreign", async () => {
|
|
1138
|
-
const otherRs = {
|
|
1139
|
-
apiVersion: "apps/v1",
|
|
1140
|
-
kind: "ReplicaSet",
|
|
1141
|
-
metadata: { name: "other-rs", namespace: "prod", uid: "other-rs-uid" }, // no further owner
|
|
1142
|
-
};
|
|
1143
|
-
const otherPod = {
|
|
1144
|
-
apiVersion: "v1",
|
|
1145
|
-
kind: "Pod",
|
|
1146
|
-
metadata: {
|
|
1147
|
-
name: "other-pod",
|
|
1148
|
-
namespace: "prod",
|
|
1149
|
-
uid: "other-pod-uid",
|
|
1150
|
-
ownerReferences: [{ apiVersion: "apps/v1", kind: "ReplicaSet", name: "other-rs", uid: "other-rs-uid", controller: true }],
|
|
1151
|
-
},
|
|
1152
|
-
};
|
|
1153
|
-
const cluster = fakeCluster({
|
|
1154
|
-
objects: {
|
|
1155
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: web,
|
|
1156
|
-
[objectKey("apps/v1", "ReplicaSet", "other-rs", "prod")]: otherRs,
|
|
1157
|
-
[objectKey("v1", "Pod", "other-pod", "prod")]: otherPod,
|
|
1158
|
-
},
|
|
1159
|
-
});
|
|
1160
|
-
|
|
1161
|
-
const result = await describeResources(
|
|
1162
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: declaredDeployment() },
|
|
1163
|
-
cluster.connector,
|
|
1164
|
-
);
|
|
1165
|
-
|
|
1166
|
-
expect(result.resources["Pod/prod/other-pod"]).toMatchObject({ ownerChain: { root: "foreign" } });
|
|
1167
|
-
});
|
|
1168
|
-
|
|
1169
|
-
test("--owned withholds an unrelated Pod, but keeps a runtime child of a declared (owned) entity", async () => {
|
|
1170
|
-
// The declared Deployment must itself carry chant's marker for `--owned`
|
|
1171
|
-
// to surface it at all — otherwise it is filtered before a Pod scan ever
|
|
1172
|
-
// has a declared uid to compare against.
|
|
1173
|
-
const ownedWeb = ownedObject("apps/v1", "Deployment", "web", "prod", { status: { readyReplicas: 3, replicas: 3 } });
|
|
1174
|
-
const standalonePod = {
|
|
1175
|
-
apiVersion: "v1",
|
|
1176
|
-
kind: "Pod",
|
|
1177
|
-
metadata: { name: "standalone", namespace: "prod", uid: "standalone-uid" },
|
|
1178
|
-
};
|
|
1179
|
-
const runtimePod = {
|
|
1180
|
-
apiVersion: "v1",
|
|
1181
|
-
kind: "Pod",
|
|
1182
|
-
metadata: {
|
|
1183
|
-
name: "web-abc",
|
|
1184
|
-
namespace: "prod",
|
|
1185
|
-
uid: "pod-uid",
|
|
1186
|
-
ownerReferences: [{ apiVersion: "apps/v1", kind: "Deployment", name: "web", uid: "uid-web", controller: true }],
|
|
1187
|
-
},
|
|
1188
|
-
};
|
|
1189
|
-
const cluster = fakeCluster({
|
|
1190
|
-
objects: {
|
|
1191
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: ownedWeb,
|
|
1192
|
-
[objectKey("v1", "Pod", "standalone", "prod")]: standalonePod,
|
|
1193
|
-
[objectKey("v1", "Pod", "web-abc", "prod")]: runtimePod,
|
|
1194
|
-
},
|
|
1195
|
-
});
|
|
1196
|
-
|
|
1197
|
-
const result = await describeResources(
|
|
1198
|
-
{
|
|
1199
|
-
environment: "prod",
|
|
1200
|
-
buildOutput: "",
|
|
1201
|
-
entityNames: ["web"],
|
|
1202
|
-
entities: declaredDeployment(),
|
|
1203
|
-
owned: true,
|
|
1204
|
-
},
|
|
1205
|
-
cluster.connector,
|
|
1206
|
-
);
|
|
1207
|
-
|
|
1208
|
-
expect(result.resources.web).toBeDefined(); // the marker let it through
|
|
1209
|
-
expect(result.resources["Pod/prod/standalone"]).toBeUndefined();
|
|
1210
|
-
expect(result.resources["Pod/prod/web-abc"]).toMatchObject({ ownerChain: { root: "declared", entity: "web" } });
|
|
1211
|
-
});
|
|
1212
|
-
|
|
1213
|
-
test("a Pod that is itself declared is never duplicated as a runtime child", async () => {
|
|
1214
|
-
const declaredPod = {
|
|
1215
|
-
apiVersion: "v1",
|
|
1216
|
-
kind: "Pod",
|
|
1217
|
-
metadata: { name: "standalone-pod", namespace: "prod", uid: "uid-declared-pod" },
|
|
1218
|
-
status: { phase: "Running" },
|
|
1219
|
-
};
|
|
1220
|
-
const cluster = fakeCluster({
|
|
1221
|
-
objects: {
|
|
1222
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: web,
|
|
1223
|
-
[objectKey("v1", "Pod", "standalone-pod", "prod")]: declaredPod,
|
|
1224
|
-
},
|
|
1225
|
-
});
|
|
1226
|
-
|
|
1227
|
-
const result = await describeResources(
|
|
1228
|
-
{
|
|
1229
|
-
environment: "prod",
|
|
1230
|
-
buildOutput: "",
|
|
1231
|
-
entityNames: ["web", "standalonePod"],
|
|
1232
|
-
entities: makeEntities([
|
|
1233
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
1234
|
-
{ name: "standalonePod", entityType: "K8s::Core::Pod", props: { metadata: { name: "standalone-pod", namespace: "prod" } } },
|
|
1235
|
-
]),
|
|
1236
|
-
},
|
|
1237
|
-
cluster.connector,
|
|
1238
|
-
);
|
|
1239
|
-
|
|
1240
|
-
expect(result.resources.standalonePod).toBeDefined();
|
|
1241
|
-
expect(result.resources["Pod/prod/standalone-pod"]).toBeUndefined();
|
|
1242
|
-
expect(Object.keys(result.resources)).toHaveLength(2); // web + standalonePod, no synthetic duplicate
|
|
1243
|
-
});
|
|
1244
|
-
|
|
1245
|
-
test("a Pod-list failure never fails declared resolution — and surfaces as an unobserved hole (#1517)", async () => {
|
|
1246
|
-
const cluster = fakeCluster({
|
|
1247
|
-
objects: { [objectKey("apps/v1", "Deployment", "web", "prod")]: web },
|
|
1248
|
-
respond: (req) => (req.path.endsWith("/pods") ? { status: 403, body: statusBody(403, "Forbidden", "no pods list") } : undefined),
|
|
1249
|
-
});
|
|
1250
|
-
|
|
1251
|
-
const result = await describeResources(
|
|
1252
|
-
{ environment: "prod", buildOutput: "", entityNames: ["web"], entities: declaredDeployment() },
|
|
1253
|
-
cluster.connector,
|
|
1254
|
-
);
|
|
1255
|
-
|
|
1256
|
-
expect(result.resources.web).toMatchObject({ type: "K8s::Apps::Deployment", physicalId: "uid-1" });
|
|
1257
|
-
expect(Object.keys(result.resources)).toEqual(["web"]);
|
|
1258
|
-
// Silence would read as "no runtime Pods in prod", which the failed
|
|
1259
|
-
// list never proved — the sweep admits the hole instead.
|
|
1260
|
-
expect(result.unobserved?.["runtime-sweep:v1/Pod"]).toMatchObject({
|
|
1261
|
-
type: "K8s::Core::Pod",
|
|
1262
|
-
reason: "no-credentials",
|
|
1263
|
-
});
|
|
1264
|
-
});
|
|
1265
|
-
|
|
1266
|
-
test("a lexicon-supported entity type with no namespaced entities resolved does no Pod scan at all", async () => {
|
|
1267
|
-
const ns = { apiVersion: "v1", kind: "Namespace", metadata: { name: "mynamespace", uid: "uid-ns" }, status: { phase: "Active" } };
|
|
1268
|
-
const cluster = fakeCluster({ objects: { [objectKey("v1", "Namespace", "mynamespace")]: ns } });
|
|
1269
|
-
|
|
1270
|
-
const result = await describeResources(
|
|
1271
|
-
{
|
|
1272
|
-
environment: "prod",
|
|
1273
|
-
buildOutput: "",
|
|
1274
|
-
entityNames: ["ns"],
|
|
1275
|
-
entities: makeEntities([{ name: "ns", entityType: "K8s::Core::Namespace", props: { metadata: { name: "mynamespace" } } }]),
|
|
1276
|
-
},
|
|
1277
|
-
cluster.connector,
|
|
1278
|
-
);
|
|
1279
|
-
|
|
1280
|
-
expect(Object.keys(result.resources)).toEqual(["ns"]);
|
|
1281
|
-
expect(cluster.layer.paths().some((p) => p.endsWith("/pods"))).toBe(false);
|
|
1282
|
-
});
|
|
1283
|
-
});
|
|
1284
|
-
});
|
|
1285
|
-
|
|
1286
|
-
// #1397 — a Pod's phase is `Running` from the moment the kubelet admits it, so
|
|
1287
|
-
// the phase alone reported a crashlooping Pod as `Running`, which every
|
|
1288
|
-
// consumer classifying that word read as healthy.
|
|
1289
|
-
describe("statusFromObject — the most specific failing signal (#1397)", () => {
|
|
1290
|
-
test("a crashlooping Pod reports the reason, not the phase", () => {
|
|
1291
|
-
expect(
|
|
1292
|
-
statusFromObject({
|
|
1293
|
-
status: {
|
|
1294
|
-
phase: "Running",
|
|
1295
|
-
containerStatuses: [{ state: { waiting: { reason: "CrashLoopBackOff", message: "back-off 5m0s" } } }],
|
|
1296
|
-
},
|
|
1297
|
-
} as never),
|
|
1298
|
-
).toBe("CrashLoopBackOff");
|
|
1299
|
-
});
|
|
1300
|
-
|
|
1301
|
-
test("an image-pull failure reports the reason", () => {
|
|
1302
|
-
expect(
|
|
1303
|
-
statusFromObject({
|
|
1304
|
-
status: { phase: "Pending", containerStatuses: [{ state: { waiting: { reason: "ImagePullBackOff" } } }] },
|
|
1305
|
-
} as never),
|
|
1306
|
-
).toBe("ImagePullBackOff");
|
|
1307
|
-
});
|
|
1308
|
-
|
|
1309
|
-
test("an unschedulable Pod reports Unschedulable, not Pending", () => {
|
|
1310
|
-
expect(
|
|
1311
|
-
statusFromObject({
|
|
1312
|
-
status: {
|
|
1313
|
-
phase: "Pending",
|
|
1314
|
-
conditions: [{ type: "PodScheduled", status: "False", reason: "Unschedulable" }],
|
|
1315
|
-
},
|
|
1316
|
-
} as never),
|
|
1317
|
-
).toBe("Unschedulable");
|
|
1318
|
-
});
|
|
1319
|
-
|
|
1320
|
-
test("ordinary startup is not promoted over the phase", () => {
|
|
1321
|
-
// ContainerCreating and PodInitializing are not failure; surfacing them
|
|
1322
|
-
// would be noise, and the phase already classifies as progressing.
|
|
1323
|
-
for (const reason of ["ContainerCreating", "PodInitializing"]) {
|
|
1324
|
-
expect(
|
|
1325
|
-
statusFromObject({
|
|
1326
|
-
status: { phase: "Pending", containerStatuses: [{ state: { waiting: { reason } } }] },
|
|
1327
|
-
} as never),
|
|
1328
|
-
).toBe("Pending");
|
|
1329
|
-
}
|
|
1330
|
-
});
|
|
1331
|
-
|
|
1332
|
-
test("a terminated container does not outrank the phase — a Job container exits cleanly", () => {
|
|
1333
|
-
expect(
|
|
1334
|
-
statusFromObject({
|
|
1335
|
-
status: { phase: "Succeeded", containerStatuses: [{ state: { terminated: { reason: "Completed", exitCode: 0 } } }] },
|
|
1336
|
-
} as never),
|
|
1337
|
-
).toBe("Succeeded");
|
|
1338
|
-
});
|
|
1339
|
-
|
|
1340
|
-
test("a healthy Pod and a ready Deployment are unchanged", () => {
|
|
1341
|
-
expect(statusFromObject({ status: { phase: "Running", containerStatuses: [{ state: { running: {} } }] } } as never)).toBe("Running");
|
|
1342
|
-
expect(statusFromObject({ status: { readyReplicas: 3, replicas: 3 } } as never)).toBe("READY");
|
|
1343
|
-
expect(statusFromObject({ status: { readyReplicas: 1, replicas: 3 } } as never)).toBe("PROGRESSING(1/3)");
|
|
1344
|
-
expect(statusFromObject({} as never)).toBe("PRESENT");
|
|
1345
|
-
});
|
|
1346
|
-
|
|
1347
|
-
test("a conditions-first CR reads its Ready condition, not PRESENT (#1549)", () => {
|
|
1348
|
-
// A wedged Flux Kustomization/HelmRelease has no phase and no replica
|
|
1349
|
-
// counts, so it fell straight to PRESENT — a wedged reconciler read
|
|
1350
|
-
// exactly like a healthy one.
|
|
1351
|
-
expect(
|
|
1352
|
-
statusFromObject({ status: { conditions: [{ type: "Ready", status: "False", reason: "BuildFailed" }] } } as never),
|
|
1353
|
-
).toBe("BuildFailed");
|
|
1354
|
-
expect(
|
|
1355
|
-
statusFromObject({ status: { conditions: [{ type: "Ready", status: "False" }] } } as never),
|
|
1356
|
-
).toBe("NOT-READY");
|
|
1357
|
-
expect(
|
|
1358
|
-
statusFromObject({ status: { conditions: [{ type: "Ready", status: "True", reason: "ReconciliationSucceeded" }] } } as never),
|
|
1359
|
-
).toBe("READY");
|
|
1360
|
-
});
|
|
1361
|
-
|
|
1362
|
-
test("the Ready rung never changes a Pod or workload word — phase and replicas rank above it (#1549)", () => {
|
|
1363
|
-
expect(
|
|
1364
|
-
statusFromObject({ status: { phase: "Running", conditions: [{ type: "Ready", status: "False" }] } } as never),
|
|
1365
|
-
).toBe("Running");
|
|
1366
|
-
expect(
|
|
1367
|
-
statusFromObject({ status: { readyReplicas: 1, replicas: 3, conditions: [{ type: "Ready", status: "False" }] } } as never),
|
|
1368
|
-
).toBe("PROGRESSING(1/3)");
|
|
1369
|
-
});
|
|
1370
|
-
|
|
1371
|
-
test("an Argo Application reads health/sync (#1549)", () => {
|
|
1372
|
-
expect(statusFromObject({ status: { health: { status: "Degraded" }, sync: { status: "Synced" } } } as never)).toBe("Degraded");
|
|
1373
|
-
expect(statusFromObject({ status: { health: { status: "Healthy" }, sync: { status: "OutOfSync" } } } as never)).toBe("OutOfSync");
|
|
1374
|
-
expect(statusFromObject({ status: { health: { status: "Healthy" }, sync: { status: "Synced" } } } as never)).toBe("READY");
|
|
1375
|
-
});
|
|
1376
|
-
});
|
|
1377
|
-
|
|
1378
|
-
// #1401 — #1397 made the status WORD honest; this carries the part that says
|
|
1379
|
-
// what to do about it. `Unschedulable` is the reason; "0/3 nodes are available"
|
|
1380
|
-
// is the answer.
|
|
1381
|
-
describe("unhappyConditions (#1401)", () => {
|
|
1382
|
-
test("reports an unschedulable Pod's message, not just its reason", () => {
|
|
1383
|
-
expect(
|
|
1384
|
-
unhappyConditions({
|
|
1385
|
-
status: {
|
|
1386
|
-
conditions: [
|
|
1387
|
-
{
|
|
1388
|
-
type: "PodScheduled",
|
|
1389
|
-
status: "False",
|
|
1390
|
-
reason: "Unschedulable",
|
|
1391
|
-
message: "0/3 nodes are available: 1 node(s) had untolerated taint.",
|
|
1392
|
-
},
|
|
1393
|
-
],
|
|
1394
|
-
},
|
|
1395
|
-
} as never),
|
|
1396
|
-
).toEqual(["PodScheduled=Unschedulable: 0/3 nodes are available: 1 node(s) had untolerated taint."]);
|
|
1397
|
-
});
|
|
1398
|
-
|
|
1399
|
-
test("is absent when every condition is happy — presence means the object has something to say", () => {
|
|
1400
|
-
expect(
|
|
1401
|
-
unhappyConditions({
|
|
1402
|
-
status: { conditions: [{ type: "Ready", status: "True" }, { type: "PodScheduled", status: "True" }] },
|
|
1403
|
-
} as never),
|
|
1404
|
-
).toBeUndefined();
|
|
1405
|
-
});
|
|
1406
|
-
|
|
1407
|
-
test("knows the happy polarity is per condition type", () => {
|
|
1408
|
-
// Ready/Available/PodScheduled are good when True; the *Pressure and
|
|
1409
|
-
// NetworkUnavailable node conditions are good when False. Treating them all
|
|
1410
|
-
// the same would report every healthy node as unhappy, or hide a node
|
|
1411
|
-
// genuinely under disk pressure.
|
|
1412
|
-
const healthyNode = {
|
|
1413
|
-
status: {
|
|
1414
|
-
conditions: [
|
|
1415
|
-
{ type: "Ready", status: "True" },
|
|
1416
|
-
{ type: "MemoryPressure", status: "False" },
|
|
1417
|
-
{ type: "DiskPressure", status: "False" },
|
|
1418
|
-
],
|
|
1419
|
-
},
|
|
1420
|
-
};
|
|
1421
|
-
expect(unhappyConditions(healthyNode as never)).toBeUndefined();
|
|
1422
|
-
|
|
1423
|
-
const pressured = {
|
|
1424
|
-
status: {
|
|
1425
|
-
conditions: [
|
|
1426
|
-
{ type: "Ready", status: "True" },
|
|
1427
|
-
{ type: "DiskPressure", status: "True", reason: "KubeletHasDiskPressure" },
|
|
1428
|
-
],
|
|
1429
|
-
},
|
|
1430
|
-
};
|
|
1431
|
-
expect(unhappyConditions(pressured as never)).toEqual(["DiskPressure=KubeletHasDiskPressure"]);
|
|
1432
|
-
});
|
|
1433
|
-
|
|
1434
|
-
test("reports every unhappy condition, since a stuck Deployment has two", () => {
|
|
1435
|
-
expect(
|
|
1436
|
-
unhappyConditions({
|
|
1437
|
-
status: {
|
|
1438
|
-
conditions: [
|
|
1439
|
-
{ type: "Available", status: "False", reason: "MinimumReplicasUnavailable" },
|
|
1440
|
-
{ type: "Progressing", status: "False", reason: "ProgressDeadlineExceeded", message: "ReplicaSet has timed out." },
|
|
1441
|
-
],
|
|
1442
|
-
},
|
|
1443
|
-
} as never),
|
|
1444
|
-
).toHaveLength(2);
|
|
1445
|
-
});
|
|
1446
|
-
|
|
1447
|
-
test("is absent for an object with no conditions at all", () => {
|
|
1448
|
-
expect(unhappyConditions({ status: {} } as never)).toBeUndefined();
|
|
1449
|
-
expect(unhappyConditions({} as never)).toBeUndefined();
|
|
1450
|
-
});
|
|
1451
|
-
|
|
1452
|
-
// #1644 — Argo's ApplicationCondition is {type, message, lastTransitionTime},
|
|
1453
|
-
// no status field, written only for problems. The polarity test has nothing
|
|
1454
|
-
// to read on it; the message IS the report, and it was the one diagnostic
|
|
1455
|
-
// line a broken Application writes.
|
|
1456
|
-
test("a status-less condition with a message passes through — Argo's ComparisonError (#1644)", () => {
|
|
1457
|
-
expect(
|
|
1458
|
-
unhappyConditions({
|
|
1459
|
-
status: {
|
|
1460
|
-
conditions: [
|
|
1461
|
-
{
|
|
1462
|
-
type: "ComparisonError",
|
|
1463
|
-
message: "Failed to load target state: app path does not exist",
|
|
1464
|
-
lastTransitionTime: "2026-08-10T00:00:00Z",
|
|
1465
|
-
},
|
|
1466
|
-
],
|
|
1467
|
-
},
|
|
1468
|
-
} as never),
|
|
1469
|
-
).toEqual(["ComparisonError: Failed to load target state: app path does not exist"]);
|
|
1470
|
-
});
|
|
1471
|
-
|
|
1472
|
-
test("a status-less condition with no message stays silent", () => {
|
|
1473
|
-
expect(
|
|
1474
|
-
unhappyConditions({
|
|
1475
|
-
status: { conditions: [{ type: "SomeMarker", lastTransitionTime: "2026-08-10T00:00:00Z" }] },
|
|
1476
|
-
} as never),
|
|
1477
|
-
).toBeUndefined();
|
|
1478
|
-
});
|
|
1479
|
-
});
|
|
1480
|
-
|
|
1481
|
-
describe("revisionAttributes — the GitOps convergence fields (#1632)", () => {
|
|
1482
|
-
test("carries a Kustomization's applied and attempted revisions", () => {
|
|
1483
|
-
expect(
|
|
1484
|
-
revisionAttributes({
|
|
1485
|
-
status: {
|
|
1486
|
-
lastAppliedRevision: "main@sha1:1a2b3c4d",
|
|
1487
|
-
lastAttemptedRevision: "main@sha1:5e6f7a8b",
|
|
1488
|
-
conditions: [{ type: "Ready", status: "True" }],
|
|
1489
|
-
},
|
|
1490
|
-
} as never),
|
|
1491
|
-
).toMatchObject({ lastAppliedRevision: "main@sha1:1a2b3c4d", lastAttemptedRevision: "main@sha1:5e6f7a8b" });
|
|
1492
|
-
});
|
|
1493
|
-
|
|
1494
|
-
test("flattens a source kind's status.artifact.revision", () => {
|
|
1495
|
-
expect(revisionAttributes({ status: { artifact: { revision: "main@sha1:1a2b3c4d" } } } as never)).toMatchObject({
|
|
1496
|
-
artifactRevision: "main@sha1:1a2b3c4d",
|
|
1497
|
-
});
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
test("says nothing for an object that carries none of them", () => {
|
|
1501
|
-
// Every field undefined, so `pruneUndefined` drops all three and the
|
|
1502
|
-
// attributes of a Deployment or a Service are byte-for-byte what they were.
|
|
1503
|
-
expect(revisionAttributes({ status: { readyReplicas: 1, replicas: 1 } } as never)).toEqual({
|
|
1504
|
-
lastAppliedRevision: undefined,
|
|
1505
|
-
lastAttemptedRevision: undefined,
|
|
1506
|
-
artifactRevision: undefined,
|
|
1507
|
-
});
|
|
1508
|
-
expect(revisionAttributes({} as never)).toEqual({
|
|
1509
|
-
lastAppliedRevision: undefined,
|
|
1510
|
-
lastAttemptedRevision: undefined,
|
|
1511
|
-
artifactRevision: undefined,
|
|
1512
|
-
});
|
|
1513
|
-
});
|
|
1514
|
-
|
|
1515
|
-
test("ignores non-string and empty revisions", () => {
|
|
1516
|
-
expect(
|
|
1517
|
-
revisionAttributes({ status: { lastAppliedRevision: "", lastAttemptedRevision: 7, artifact: { revision: null } } } as never),
|
|
1518
|
-
).toEqual({ lastAppliedRevision: undefined, lastAttemptedRevision: undefined, artifactRevision: undefined });
|
|
1519
|
-
});
|
|
1520
|
-
});
|
|
1521
|
-
|
|
1522
|
-
describe("observed attributes carry the Flux revisions (#1632)", () => {
|
|
1523
|
-
const applied = "main@sha1:1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b";
|
|
1524
|
-
const attempted = "main@sha1:5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d";
|
|
1525
|
-
|
|
1526
|
-
test("a Kustomization mid-rollout reports applied != attempted even with Ready=True", async () => {
|
|
1527
|
-
const kustomization = {
|
|
1528
|
-
apiVersion: "kustomize.toolkit.fluxcd.io/v1",
|
|
1529
|
-
kind: "Kustomization",
|
|
1530
|
-
metadata: { name: "apps", namespace: "flux-system", uid: "ks-uid", resourceVersion: "42" },
|
|
1531
|
-
status: {
|
|
1532
|
-
lastAppliedRevision: applied,
|
|
1533
|
-
lastAttemptedRevision: attempted,
|
|
1534
|
-
conditions: [{ type: "Ready", status: "True", reason: "ReconciliationSucceeded" }],
|
|
1535
|
-
},
|
|
1536
|
-
};
|
|
1537
|
-
const source = {
|
|
1538
|
-
apiVersion: "source.toolkit.fluxcd.io/v1",
|
|
1539
|
-
kind: "GitRepository",
|
|
1540
|
-
metadata: { name: "infra", namespace: "flux-system", uid: "gr-uid" },
|
|
1541
|
-
status: {
|
|
1542
|
-
artifact: { revision: attempted, path: "gitrepository/flux-system/infra/x.tar.gz" },
|
|
1543
|
-
conditions: [{ type: "Ready", status: "True" }],
|
|
1544
|
-
},
|
|
1545
|
-
};
|
|
1546
|
-
const cluster = fakeCluster({
|
|
1547
|
-
objects: {
|
|
1548
|
-
[objectKey("kustomize.toolkit.fluxcd.io/v1", "Kustomization", "apps", "flux-system")]: kustomization,
|
|
1549
|
-
[objectKey("source.toolkit.fluxcd.io/v1", "GitRepository", "infra", "flux-system")]: source,
|
|
1550
|
-
},
|
|
1551
|
-
});
|
|
1552
|
-
|
|
1553
|
-
const result = await describeResources(
|
|
1554
|
-
{
|
|
1555
|
-
environment: "prod",
|
|
1556
|
-
buildOutput: "",
|
|
1557
|
-
entityNames: ["apps", "infra"],
|
|
1558
|
-
entities: makeEntities([
|
|
1559
|
-
{
|
|
1560
|
-
name: "apps",
|
|
1561
|
-
entityType: "K8s::Flux::Kustomization",
|
|
1562
|
-
props: { metadata: { name: "apps", namespace: "flux-system" } },
|
|
1563
|
-
},
|
|
1564
|
-
{
|
|
1565
|
-
name: "infra",
|
|
1566
|
-
entityType: "K8s::Flux::GitRepository",
|
|
1567
|
-
props: { metadata: { name: "infra", namespace: "flux-system" } },
|
|
1568
|
-
},
|
|
1569
|
-
]),
|
|
1570
|
-
},
|
|
1571
|
-
cluster.connector,
|
|
1572
|
-
);
|
|
1573
|
-
|
|
1574
|
-
// The per-node half: attempted is ahead of applied, so this object is
|
|
1575
|
-
// mid-flight however cheerful its Ready condition is.
|
|
1576
|
-
expect(result.resources.apps?.attributes).toMatchObject({
|
|
1577
|
-
lastAppliedRevision: applied,
|
|
1578
|
-
lastAttemptedRevision: attempted,
|
|
1579
|
-
});
|
|
1580
|
-
// The cross-node half: the source's artifact revision, which a consumer
|
|
1581
|
-
// joins against the Kustomization's applied revision.
|
|
1582
|
-
expect(result.resources.infra?.attributes).toMatchObject({ artifactRevision: attempted });
|
|
1583
|
-
expect(result.resources.apps?.status).toBe("READY");
|
|
1584
|
-
});
|
|
1585
|
-
|
|
1586
|
-
test("a HelmRelease's revisions ride the same path, and other kinds are untouched", async () => {
|
|
1587
|
-
const helmRelease = {
|
|
1588
|
-
apiVersion: "helm.toolkit.fluxcd.io/v2",
|
|
1589
|
-
kind: "HelmRelease",
|
|
1590
|
-
metadata: { name: "podinfo", namespace: "prod", uid: "hr-uid" },
|
|
1591
|
-
status: { lastAppliedRevision: "6.5.4", lastAttemptedRevision: "6.5.4", conditions: [{ type: "Ready", status: "True" }] },
|
|
1592
|
-
};
|
|
1593
|
-
const cluster = fakeCluster({
|
|
1594
|
-
objects: {
|
|
1595
|
-
[objectKey("helm.toolkit.fluxcd.io/v2", "HelmRelease", "podinfo", "prod")]: helmRelease,
|
|
1596
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: web,
|
|
1597
|
-
},
|
|
1598
|
-
});
|
|
1599
|
-
|
|
1600
|
-
const result = await describeResources(
|
|
1601
|
-
{
|
|
1602
|
-
environment: "prod",
|
|
1603
|
-
buildOutput: "",
|
|
1604
|
-
entityNames: ["podinfo", "web"],
|
|
1605
|
-
entities: makeEntities([
|
|
1606
|
-
{
|
|
1607
|
-
name: "podinfo",
|
|
1608
|
-
entityType: "K8s::Flux::HelmRelease",
|
|
1609
|
-
props: { metadata: { name: "podinfo", namespace: "prod" } },
|
|
1610
|
-
},
|
|
1611
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
1612
|
-
]),
|
|
1613
|
-
},
|
|
1614
|
-
cluster.connector,
|
|
1615
|
-
);
|
|
1616
|
-
|
|
1617
|
-
expect(result.resources.podinfo?.attributes).toMatchObject({
|
|
1618
|
-
lastAppliedRevision: "6.5.4",
|
|
1619
|
-
lastAttemptedRevision: "6.5.4",
|
|
1620
|
-
});
|
|
1621
|
-
// The string wire form for every other kind is what it was — no empty
|
|
1622
|
-
// revision keys appear on a Deployment (#1401's shape, unchanged).
|
|
1623
|
-
expect(result.resources.web?.attributes).toEqual({
|
|
1624
|
-
namespace: "prod",
|
|
1625
|
-
labels: { app: "web" },
|
|
1626
|
-
resourceVersion: "7",
|
|
1627
|
-
});
|
|
1628
|
-
});
|
|
1629
|
-
});
|
|
1630
|
-
|
|
1631
|
-
describe("helmRepositoryTypeAttribute — the one spec field on the wire (behold#298)", () => {
|
|
1632
|
-
const gvk = { apiVersion: "source.toolkit.fluxcd.io/v1", kind: "HelmRepository" };
|
|
1633
|
-
|
|
1634
|
-
test("carries a HelmRepository's spec.type when set", () => {
|
|
1635
|
-
expect(helmRepositoryTypeAttribute(gvk, { spec: { type: "oci" } } as never)).toBe("oci");
|
|
1636
|
-
expect(helmRepositoryTypeAttribute(gvk, { spec: { type: "default" } } as never)).toBe("default");
|
|
1637
|
-
});
|
|
1638
|
-
|
|
1639
|
-
test("says nothing when the field is absent — the CRD does not default it", () => {
|
|
1640
|
-
expect(helmRepositoryTypeAttribute(gvk, { spec: { url: "https://charts.example.com" } } as never)).toBeUndefined();
|
|
1641
|
-
expect(helmRepositoryTypeAttribute(gvk, {} as never)).toBeUndefined();
|
|
1642
|
-
});
|
|
1643
|
-
|
|
1644
|
-
test("ignores non-string and empty values", () => {
|
|
1645
|
-
expect(helmRepositoryTypeAttribute(gvk, { spec: { type: "" } } as never)).toBeUndefined();
|
|
1646
|
-
expect(helmRepositoryTypeAttribute(gvk, { spec: { type: 7 } } as never)).toBeUndefined();
|
|
1647
|
-
});
|
|
1648
|
-
|
|
1649
|
-
test("declines every other kind — spec.type is not a distinctive path", () => {
|
|
1650
|
-
// A core Service HAS a spec.type; forwarding it would change a wire shape
|
|
1651
|
-
// this field was never about.
|
|
1652
|
-
expect(
|
|
1653
|
-
helmRepositoryTypeAttribute({ apiVersion: "v1", kind: "Service" }, { spec: { type: "LoadBalancer" } } as never),
|
|
1654
|
-
).toBeUndefined();
|
|
1655
|
-
// Same kind name in a foreign group claims nothing either.
|
|
1656
|
-
expect(
|
|
1657
|
-
helmRepositoryTypeAttribute({ apiVersion: "example.io/v1", kind: "HelmRepository" }, { spec: { type: "oci" } } as never),
|
|
1658
|
-
).toBeUndefined();
|
|
1659
|
-
});
|
|
1660
|
-
});
|
|
1661
|
-
|
|
1662
|
-
describe("observed attributes carry a HelmRepository's spec.type (behold#298)", () => {
|
|
1663
|
-
test("an OCI HelmRepository reads type: 'oci'; a default one grows no type key", async () => {
|
|
1664
|
-
// The behold#298 shape: `spec.type: oci` means source-controller never
|
|
1665
|
-
// reconciles the object — no conditions, no artifact, by design — so a
|
|
1666
|
-
// consumer classifying off conditions needs this field to tell a healthy
|
|
1667
|
-
// OCI repository from a wedged default one.
|
|
1668
|
-
const oci = {
|
|
1669
|
-
apiVersion: "source.toolkit.fluxcd.io/v1",
|
|
1670
|
-
kind: "HelmRepository",
|
|
1671
|
-
metadata: { name: "charts-oci", namespace: "flux-system", uid: "hrepo-oci-uid" },
|
|
1672
|
-
spec: { type: "oci", url: "oci://ghcr.io/example/charts" },
|
|
1673
|
-
// No status at all — exactly what the API returns for an OCI one.
|
|
1674
|
-
};
|
|
1675
|
-
const plain = {
|
|
1676
|
-
apiVersion: "source.toolkit.fluxcd.io/v1",
|
|
1677
|
-
kind: "HelmRepository",
|
|
1678
|
-
metadata: { name: "charts-http", namespace: "flux-system", uid: "hrepo-http-uid" },
|
|
1679
|
-
// The CRD does not default spec.type: a default repository simply
|
|
1680
|
-
// carries no `type` field, and the wire says nothing for it.
|
|
1681
|
-
spec: { url: "https://charts.example.com" },
|
|
1682
|
-
status: { conditions: [{ type: "Ready", status: "True" }], artifact: { revision: "sha256:abc123" } },
|
|
1683
|
-
};
|
|
1684
|
-
const cluster = fakeCluster({
|
|
1685
|
-
objects: {
|
|
1686
|
-
[objectKey("source.toolkit.fluxcd.io/v1", "HelmRepository", "charts-oci", "flux-system")]: oci,
|
|
1687
|
-
[objectKey("source.toolkit.fluxcd.io/v1", "HelmRepository", "charts-http", "flux-system")]: plain,
|
|
1688
|
-
},
|
|
1689
|
-
});
|
|
1690
|
-
|
|
1691
|
-
const result = await describeResources(
|
|
1692
|
-
{
|
|
1693
|
-
environment: "prod",
|
|
1694
|
-
buildOutput: "",
|
|
1695
|
-
entityNames: ["chartsOci", "chartsHttp"],
|
|
1696
|
-
entities: makeEntities([
|
|
1697
|
-
{
|
|
1698
|
-
name: "chartsOci",
|
|
1699
|
-
entityType: "K8s::Flux::HelmRepository",
|
|
1700
|
-
props: { metadata: { name: "charts-oci", namespace: "flux-system" }, spec: { type: "oci", url: "oci://ghcr.io/example/charts" } },
|
|
1701
|
-
},
|
|
1702
|
-
{
|
|
1703
|
-
name: "chartsHttp",
|
|
1704
|
-
entityType: "K8s::Flux::HelmRepository",
|
|
1705
|
-
props: { metadata: { name: "charts-http", namespace: "flux-system" }, spec: { url: "https://charts.example.com" } },
|
|
1706
|
-
},
|
|
1707
|
-
]),
|
|
1708
|
-
},
|
|
1709
|
-
cluster.connector,
|
|
1710
|
-
);
|
|
1711
|
-
|
|
1712
|
-
expect(result.resources.chartsOci?.attributes).toMatchObject({ type: "oci" });
|
|
1713
|
-
// No conditions is the healthy shape for OCI — nothing unhappy to carry.
|
|
1714
|
-
expect(result.resources.chartsOci?.attributes).not.toHaveProperty("conditions");
|
|
1715
|
-
// The default repository's attributes are byte-for-byte what they were:
|
|
1716
|
-
// no `type` key appears, and its revision still rides #1632's path.
|
|
1717
|
-
expect(result.resources.chartsHttp?.attributes).not.toHaveProperty("type");
|
|
1718
|
-
expect(result.resources.chartsHttp?.attributes).toMatchObject({ artifactRevision: "sha256:abc123" });
|
|
1719
|
-
});
|
|
1720
|
-
|
|
1721
|
-
test("no other kind grows a type attribute — a Service's spec.type stays off the wire", async () => {
|
|
1722
|
-
const lb = {
|
|
1723
|
-
apiVersion: "v1",
|
|
1724
|
-
kind: "Service",
|
|
1725
|
-
metadata: { name: "web-lb", namespace: "prod", uid: "lb-uid" },
|
|
1726
|
-
spec: { type: "LoadBalancer", ports: [{ port: 80 }] },
|
|
1727
|
-
};
|
|
1728
|
-
const cluster = fakeCluster({ objects: { [objectKey("v1", "Service", "web-lb", "prod")]: lb } });
|
|
1729
|
-
|
|
1730
|
-
const result = await describeResources(
|
|
1731
|
-
{
|
|
1732
|
-
environment: "prod",
|
|
1733
|
-
buildOutput: "",
|
|
1734
|
-
entityNames: ["webLb"],
|
|
1735
|
-
entities: makeEntities([
|
|
1736
|
-
{
|
|
1737
|
-
name: "webLb",
|
|
1738
|
-
entityType: "K8s::Core::Service",
|
|
1739
|
-
props: { metadata: { name: "web-lb", namespace: "prod" }, spec: { type: "LoadBalancer" } },
|
|
1740
|
-
},
|
|
1741
|
-
]),
|
|
1742
|
-
},
|
|
1743
|
-
cluster.connector,
|
|
1744
|
-
);
|
|
1745
|
-
|
|
1746
|
-
expect(result.resources.webLb).toBeDefined();
|
|
1747
|
-
expect(result.resources.webLb?.attributes).not.toHaveProperty("type");
|
|
1748
|
-
});
|
|
1749
|
-
});
|
|
1750
|
-
|
|
1751
|
-
// The behold#221 shape (#1629): the estate's control-plane project declares
|
|
1752
|
-
// the Kustomization carrying `spec.targetNamespace`, and the app project
|
|
1753
|
-
// declares bare objects the controller stamps at apply time. Reading the app
|
|
1754
|
-
// project alone, `metadata.namespace` is absent everywhere and the read
|
|
1755
|
-
// defaults to `default` — a running estate reported entirely absent. The
|
|
1756
|
-
// caller that knows the binding can now say where to look.
|
|
1757
|
-
describe("a per-read namespace override for entities that declare none (#1629)", () => {
|
|
1758
|
-
const inAppB = {
|
|
1759
|
-
apiVersion: "apps/v1",
|
|
1760
|
-
kind: "Deployment",
|
|
1761
|
-
metadata: { name: "web", namespace: "app-b", uid: "uid-b", resourceVersion: "11" },
|
|
1762
|
-
status: { readyReplicas: 1, replicas: 1 },
|
|
1763
|
-
};
|
|
1764
|
-
|
|
1765
|
-
test("replaces the `default` fallback for a namespaced entity that declares no namespace", async () => {
|
|
1766
|
-
const cluster = fakeCluster({ objects: { [objectKey("apps/v1", "Deployment", "web", "app-b")]: inAppB } });
|
|
1767
|
-
const result = await describeResources(
|
|
1768
|
-
{
|
|
1769
|
-
environment: "prod",
|
|
1770
|
-
buildOutput: "",
|
|
1771
|
-
entityNames: ["web"],
|
|
1772
|
-
entities: makeEntities([
|
|
1773
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web" } } },
|
|
1774
|
-
]),
|
|
1775
|
-
namespace: "app-b",
|
|
1776
|
-
},
|
|
1777
|
-
cluster.connector,
|
|
1778
|
-
);
|
|
1779
|
-
|
|
1780
|
-
expect(result.resources.web).toMatchObject({ type: "K8s::Apps::Deployment", physicalId: "uid-b" });
|
|
1781
|
-
// The `queried` diagnosis line (#1620) reflects the overridden address —
|
|
1782
|
-
// whatever the read did, the report says where it looked.
|
|
1783
|
-
expect(result.queried?.web).toBe("/apis/apps/v1/namespaces/app-b/deployments/web");
|
|
1784
|
-
});
|
|
1785
|
-
|
|
1786
|
-
test("an explicitly declared namespace still wins — the override is a default, not a rewrite", async () => {
|
|
1787
|
-
const cluster = fakeCluster({
|
|
1788
|
-
objects: {
|
|
1789
|
-
[objectKey("apps/v1", "Deployment", "web", "prod")]: web,
|
|
1790
|
-
[objectKey("apps/v1", "Deployment", "web", "app-b")]: inAppB,
|
|
1791
|
-
},
|
|
1792
|
-
});
|
|
1793
|
-
const result = await describeResources(
|
|
1794
|
-
{
|
|
1795
|
-
environment: "prod",
|
|
1796
|
-
buildOutput: "",
|
|
1797
|
-
entityNames: ["web"],
|
|
1798
|
-
entities: makeEntities([
|
|
1799
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web", namespace: "prod" } } },
|
|
1800
|
-
]),
|
|
1801
|
-
namespace: "app-b",
|
|
1802
|
-
},
|
|
1803
|
-
cluster.connector,
|
|
1804
|
-
);
|
|
1805
|
-
|
|
1806
|
-
// Both objects exist; the declared namespace decides which one was read.
|
|
1807
|
-
expect(result.resources.web).toMatchObject({ physicalId: "uid-1" });
|
|
1808
|
-
expect(result.queried?.web).toBe("/apis/apps/v1/namespaces/prod/deployments/web");
|
|
1809
|
-
});
|
|
1810
|
-
|
|
1811
|
-
test("without the override the read still defaults to `default` — nothing changed for a caller that passes none", async () => {
|
|
1812
|
-
const cluster = fakeCluster({ objects: { [objectKey("apps/v1", "Deployment", "web", "app-b")]: inAppB } });
|
|
1813
|
-
const result = await describeResources(
|
|
1814
|
-
{
|
|
1815
|
-
environment: "prod",
|
|
1816
|
-
buildOutput: "",
|
|
1817
|
-
entityNames: ["web"],
|
|
1818
|
-
entities: makeEntities([
|
|
1819
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web" } } },
|
|
1820
|
-
]),
|
|
1821
|
-
},
|
|
1822
|
-
cluster.connector,
|
|
1823
|
-
);
|
|
1824
|
-
|
|
1825
|
-
expect(result.resources).toEqual({});
|
|
1826
|
-
expect(result.queried?.web).toBe("/apis/apps/v1/namespaces/default/deployments/web");
|
|
1827
|
-
});
|
|
1828
|
-
|
|
1829
|
-
test("a cluster-scoped kind is untouched — it has no namespace to default", async () => {
|
|
1830
|
-
const ns = { apiVersion: "v1", kind: "Namespace", metadata: { name: "app-b", uid: "ns-uid" } };
|
|
1831
|
-
const cluster = fakeCluster({ objects: { [objectKey("v1", "Namespace", "app-b")]: ns } });
|
|
1832
|
-
const result = await describeResources(
|
|
1833
|
-
{
|
|
1834
|
-
environment: "prod",
|
|
1835
|
-
buildOutput: "",
|
|
1836
|
-
entityNames: ["appB"],
|
|
1837
|
-
entities: makeEntities([
|
|
1838
|
-
{ name: "appB", entityType: "K8s::Core::Namespace", props: { metadata: { name: "app-b" } } },
|
|
1839
|
-
]),
|
|
1840
|
-
namespace: "app-b",
|
|
1841
|
-
},
|
|
1842
|
-
cluster.connector,
|
|
1843
|
-
);
|
|
1844
|
-
|
|
1845
|
-
expect(result.resources.appB).toMatchObject({ physicalId: "ns-uid" });
|
|
1846
|
-
expect(result.queried?.appB).toBe("/api/v1/namespaces/app-b");
|
|
1847
|
-
});
|
|
1848
|
-
|
|
1849
|
-
test("the override reaches every declared entity, not just the first", async () => {
|
|
1850
|
-
const svc = { apiVersion: "v1", kind: "Service", metadata: { name: "web-svc", namespace: "app-b", uid: "svc-b" } };
|
|
1851
|
-
const cluster = fakeCluster({
|
|
1852
|
-
objects: {
|
|
1853
|
-
[objectKey("apps/v1", "Deployment", "web", "app-b")]: inAppB,
|
|
1854
|
-
[objectKey("v1", "Service", "web-svc", "app-b")]: svc,
|
|
1855
|
-
},
|
|
1856
|
-
});
|
|
1857
|
-
const result = await describeResources(
|
|
1858
|
-
{
|
|
1859
|
-
environment: "prod",
|
|
1860
|
-
buildOutput: "",
|
|
1861
|
-
entityNames: ["web", "webSvc"],
|
|
1862
|
-
entities: makeEntities([
|
|
1863
|
-
{ name: "web", entityType: "K8s::Apps::Deployment", props: { metadata: { name: "web" } } },
|
|
1864
|
-
{ name: "webSvc", entityType: "K8s::Core::Service", props: { metadata: { name: "web-svc" } } },
|
|
1865
|
-
]),
|
|
1866
|
-
namespace: "app-b",
|
|
1867
|
-
},
|
|
1868
|
-
cluster.connector,
|
|
1869
|
-
);
|
|
1870
|
-
|
|
1871
|
-
expect(Object.keys(result.resources).sort()).toEqual(["web", "webSvc"]);
|
|
1872
|
-
});
|
|
1873
|
-
});
|