@intentius/chant-lexicon-k8s 0.124.31 → 0.124.32
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.js +18 -0
- package/dist/actions/batch.js +6 -0
- package/dist/actions/core.js +48 -0
- package/dist/actions/index.js +13 -0
- package/dist/actions/networking.js +11 -0
- package/dist/actions/rbac.js +8 -0
- package/dist/api/classify.js +123 -0
- package/dist/api/connect.js +62 -0
- package/dist/api/fake-cluster.js +175 -0
- package/dist/api/operation-surface.d.ts.map +1 -1
- package/dist/api/operation-surface.js +109 -0
- package/dist/api/owner-chain.js +100 -0
- package/dist/api/sweep-types.js +35 -0
- package/dist/behaviour-kinds.js +82 -0
- package/dist/codegen/docs-cli.js +2 -0
- package/dist/codegen/docs.js +146 -0
- package/dist/codegen/generate-cli.js +30 -0
- package/dist/codegen/generate-lexicon.js +74 -0
- package/dist/codegen/generate-list-map-keys.js +88 -0
- package/dist/codegen/generate-operations.js +53 -0
- package/dist/codegen/generate-typescript.js +124 -0
- package/dist/codegen/generate.js +173 -0
- package/dist/codegen/naming.js +174 -0
- package/dist/codegen/package.js +36 -0
- package/dist/codegen/patches.js +88 -0
- package/dist/codegen/typecheck.js +4 -0
- package/dist/codegen/versions.js +41 -0
- package/dist/components/argo-app.js +51 -0
- package/dist/components/builders.js +22 -0
- package/dist/components/capability-plugin.js +31 -0
- package/dist/components/flux-reconcile.js +61 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +18 -0
- package/dist/components/kubectl-apply.d.ts +83 -1
- package/dist/components/kubectl-apply.d.ts.map +1 -1
- package/dist/components/kubectl-apply.js +274 -0
- package/dist/components/kustomize-apply.js +25 -0
- package/dist/composites/adot-collector.js +184 -0
- package/dist/composites/agic-ingress.js +85 -0
- package/dist/composites/aks-external-dns-agent.js +146 -0
- package/dist/composites/alb-ingress.js +86 -0
- package/dist/composites/argo-app.js +199 -0
- package/dist/composites/autoscaled-service.js +174 -0
- package/dist/composites/azure-disk-storage-class.js +47 -0
- package/dist/composites/azure-file-storage-class.js +48 -0
- package/dist/composites/azure-monitor-collector.js +176 -0
- package/dist/composites/batch-job.js +139 -0
- package/dist/composites/catalog.js +4110 -0
- package/dist/composites/cockroachdb-cluster.js +371 -0
- package/dist/composites/cockroachdb-region-stack.js +369 -0
- package/dist/composites/config-connector-context.js +40 -0
- package/dist/composites/configured-app.js +135 -0
- package/dist/composites/cron-schedule.js +38 -0
- package/dist/composites/cron-workload.js +109 -0
- package/dist/composites/ebs-storage-class.js +54 -0
- package/dist/composites/efs-storage-class.js +46 -0
- package/dist/composites/external-dns-agent.js +122 -0
- package/dist/composites/filestore-storage-class.js +49 -0
- package/dist/composites/fluent-bit-agent.js +157 -0
- package/dist/composites/flux-app.js +156 -0
- package/dist/composites/gce-ingress.js +83 -0
- package/dist/composites/gce-pd-storage-class.js +49 -0
- package/dist/composites/gke-external-dns-agent.js +129 -0
- package/dist/composites/gke-fluent-bit-agent.js +165 -0
- package/dist/composites/gke-gateway.js +91 -0
- package/dist/composites/gke-otel-collector.js +94 -0
- package/dist/composites/index.js +51 -0
- package/dist/composites/inference-service.js +76 -0
- package/dist/composites/irsa-service-account.js +77 -0
- package/dist/composites/member-defaults.js +14 -0
- package/dist/composites/metrics-server.js +181 -0
- package/dist/composites/model.js +92 -0
- package/dist/composites/monitored-service.js +152 -0
- package/dist/composites/namespace-env.js +114 -0
- package/dist/composites/network-isolated-app.js +124 -0
- package/dist/composites/node-agent.js +149 -0
- package/dist/composites/operator-stack.js +268 -0
- package/dist/composites/otel-collector-agent.js +142 -0
- package/dist/composites/otel-collector-gateway.js +216 -0
- package/dist/composites/otel-collector-node.js +176 -0
- package/dist/composites/otel-collector-rbac.js +115 -0
- package/dist/composites/otel-collector-shape.js +128 -0
- package/dist/composites/otel-collector.js +115 -0
- package/dist/composites/otel-operator-collector.js +123 -0
- package/dist/composites/ray-cluster.js +378 -0
- package/dist/composites/ray-job.js +136 -0
- package/dist/composites/ray-service.js +178 -0
- package/dist/composites/secure-ingress.js +100 -0
- package/dist/composites/security-context.js +1 -0
- package/dist/composites/sidecar-app.js +105 -0
- package/dist/composites/stateful-app.js +111 -0
- package/dist/composites/vllm-serving-runtime.js +114 -0
- package/dist/composites/web-app.js +157 -0
- package/dist/composites/worker-pool.js +167 -0
- package/dist/composites/workload-identity-sa.js +81 -0
- package/dist/composites/workload-identity-service-account.js +77 -0
- package/dist/config-schema.js +72 -0
- package/dist/config.js +59 -0
- package/dist/coverage.js +27 -0
- package/dist/crd/crd-sources.js +615 -0
- package/dist/crd/loader.js +181 -0
- package/dist/crd/oci-chart.js +144 -0
- package/dist/crd/parser.js +382 -0
- package/dist/crd/project-codegen.js +273 -0
- package/dist/crd/types.js +7 -0
- package/dist/deep-observe-hooks.js +306 -0
- package/dist/deep-observe.js +234 -0
- package/dist/default-labels.js +87 -0
- package/dist/describe-resources.js +699 -0
- package/dist/describe-stack-status.js +99 -0
- package/dist/detect.js +11 -0
- package/dist/effect-receipt-row.js +205 -0
- package/dist/export-resources.js +39 -0
- package/dist/generated/index.js +1092 -0
- package/dist/generated/runtime.js +4 -0
- package/dist/group-namespace.js +96 -0
- package/dist/import/embedded.js +197 -0
- package/dist/import/generator.js +288 -0
- package/dist/import/live-export.js +85 -0
- package/dist/import/parser.js +204 -0
- package/dist/import/testdata/embedded/fixtures.js +60 -0
- package/dist/include/entity.js +78 -0
- package/dist/include/resolve.js +170 -0
- package/dist/index.js +59 -0
- package/dist/integrity.json +3 -3
- package/dist/kube/apply.js +90 -0
- package/dist/kube/connect.js +46 -0
- package/dist/kube/delete.js +138 -0
- package/dist/kube/describe.js +169 -0
- package/dist/kube/events.js +132 -0
- package/dist/kube/flags.js +91 -0
- package/dist/kube/get.js +159 -0
- package/dist/kube/group.js +123 -0
- package/dist/kube/logs.js +82 -0
- package/dist/kube/project.js +94 -0
- package/dist/kube/render.js +227 -0
- package/dist/kube/source.js +122 -0
- package/dist/kube/target.js +63 -0
- package/dist/kube/testing.js +28 -0
- package/dist/kube/top.js +99 -0
- package/dist/kube/verdict.js +72 -0
- package/dist/kube/wait.js +129 -0
- package/dist/kustomize/render.js +73 -0
- package/dist/kustomize/rendered-entity.js +67 -0
- package/dist/kustomize/root.js +68 -0
- package/dist/lint/audit-catalog.js +61 -0
- package/dist/lint/audit-lineage.js +118 -0
- package/dist/lint/post-synth/argo-helpers.js +36 -0
- package/dist/lint/post-synth/argo002.js +31 -0
- package/dist/lint/post-synth/argo003.js +53 -0
- package/dist/lint/post-synth/argo005.js +54 -0
- package/dist/lint/post-synth/crd-schema-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/crd-schema-helpers.js +214 -0
- package/dist/lint/post-synth/flux002.js +56 -0
- package/dist/lint/post-synth/flux003.js +50 -0
- package/dist/lint/post-synth/index.js +104 -0
- package/dist/lint/post-synth/k8s-helpers.js +186 -0
- package/dist/lint/post-synth/monitoring-selection-helpers.js +163 -0
- package/dist/lint/post-synth/otel-placement-helpers.js +293 -0
- package/dist/lint/post-synth/sops-helpers.js +43 -0
- package/dist/lint/post-synth/wk8005.js +44 -0
- package/dist/lint/post-synth/wk8006.js +56 -0
- package/dist/lint/post-synth/wk8041.js +60 -0
- package/dist/lint/post-synth/wk8042.js +36 -0
- package/dist/lint/post-synth/wk8101.js +52 -0
- package/dist/lint/post-synth/wk8102.js +30 -0
- package/dist/lint/post-synth/wk8103.js +33 -0
- package/dist/lint/post-synth/wk8104.js +58 -0
- package/dist/lint/post-synth/wk8105.js +33 -0
- package/dist/lint/post-synth/wk8201.js +44 -0
- package/dist/lint/post-synth/wk8202.js +34 -0
- package/dist/lint/post-synth/wk8203.js +34 -0
- package/dist/lint/post-synth/wk8204.js +71 -0
- package/dist/lint/post-synth/wk8205.js +38 -0
- package/dist/lint/post-synth/wk8207.js +33 -0
- package/dist/lint/post-synth/wk8208.js +33 -0
- package/dist/lint/post-synth/wk8209.js +33 -0
- package/dist/lint/post-synth/wk8301.js +49 -0
- package/dist/lint/post-synth/wk8302.js +34 -0
- package/dist/lint/post-synth/wk8303.js +68 -0
- package/dist/lint/post-synth/wk8304.js +58 -0
- package/dist/lint/post-synth/wk8305.js +96 -0
- package/dist/lint/post-synth/wk8306.js +38 -0
- package/dist/lint/post-synth/wk8401.js +86 -0
- package/dist/lint/post-synth/wk8402.js +31 -0
- package/dist/lint/post-synth/wk8403.js +49 -0
- package/dist/lint/post-synth/wk8404.js +36 -0
- package/dist/lint/post-synth/wk8405.js +65 -0
- package/dist/lint/post-synth/wk8406.js +50 -0
- package/dist/lint/post-synth/wk8407.js +58 -0
- package/dist/lint/post-synth/wk8501.js +36 -0
- package/dist/lint/post-synth/wk8502.js +35 -0
- package/dist/lint/post-synth/wk8503.js +164 -0
- package/dist/lint/post-synth/wk8504.js +20 -0
- package/dist/lint/post-synth/wk8505.js +31 -0
- package/dist/lint/post-synth/wk8601.js +40 -0
- package/dist/lint/post-synth/wk8602.js +120 -0
- package/dist/lint/post-synth/wk8603.js +63 -0
- package/dist/lint/post-synth/wk8604.js +31 -0
- package/dist/lint/post-synth/wk8605.js +124 -0
- package/dist/lint/post-synth/wk8606.js +22 -0
- package/dist/lint/post-synth/wk8701.js +31 -0
- package/dist/lint/post-synth/wk8702.js +37 -0
- package/dist/lint/post-synth/wk8703.js +31 -0
- package/dist/lint/post-synth/wk8704.js +135 -0
- package/dist/lint/post-synth/wk8705.js +38 -0
- package/dist/lint/rules/argo-appset-single-project.js +56 -0
- package/dist/lint/rules/argo-ast.js +94 -0
- package/dist/lint/rules/argo-automated-prune.js +59 -0
- package/dist/lint/rules/flux-source-ref-pin.js +44 -0
- package/dist/lint/rules/hardcoded-namespace.js +57 -0
- package/dist/lint/rules/latest-image-tag.js +103 -0
- package/dist/lint/rules/missing-resource-limits.js +85 -0
- package/dist/lsp/completions.d.ts.map +1 -1
- package/dist/lsp/completions.js +18 -0
- package/dist/lsp/hover.d.ts.map +1 -1
- package/dist/lsp/hover.js +57 -0
- package/dist/manifest-entity.js +71 -0
- package/dist/manifest.json +1 -1
- package/dist/micro-time.js +49 -0
- package/dist/op/activities/apply-diff.d.ts +31 -0
- package/dist/op/activities/apply-diff.d.ts.map +1 -0
- package/dist/op/activities/apply-diff.js +79 -0
- package/dist/op/activities/argo.js +98 -0
- package/dist/op/activities/ensure-secret.js +38 -0
- package/dist/op/activities/index.js +51 -0
- package/dist/op/activities/kubectl.d.ts +64 -0
- package/dist/op/activities/kubectl.d.ts.map +1 -1
- package/dist/op/activities/kubectl.js +517 -0
- package/dist/op/activities/wait-for-ready.js +229 -0
- package/dist/op/builders.js +68 -0
- package/dist/package-cli.js +21 -0
- package/dist/patch/json-patch.js +187 -0
- package/dist/patch/rendered-patch.js +94 -0
- package/dist/plugin.js +741 -0
- package/dist/project-kinds.js +56 -0
- package/dist/receipt-store.js +216 -0
- package/dist/rules/crd-schema-helpers.ts +2 -1
- package/dist/secret-labels.js +33 -0
- package/dist/secret-store.js +116 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +578 -0
- package/dist/sops/encrypted-secret-file.js +194 -0
- package/dist/sops/entity.js +32 -0
- package/dist/spec/fetch.js +58 -0
- package/dist/spec/parse.js +622 -0
- package/dist/subscribe-changes.js +168 -0
- package/dist/teardown.js +197 -0
- package/dist/telemetry-release.js +86 -0
- package/dist/validate-cli.js +17 -0
- package/dist/validate.js +47 -0
- package/dist/variables.js +34 -0
- package/dist/whoami.js +109 -0
- package/package.json +12 -12
- package/src/api/operation-surface.ts +2 -1
- package/src/codegen/package.ts +2 -2
- package/src/components/index.ts +3 -0
- package/src/components/kubectl-apply-plan.k3d.e2e.test.ts +127 -0
- package/src/components/kubectl-apply.test.ts +262 -0
- package/src/components/kubectl-apply.ts +341 -12
- package/src/deep-observe-hooks.ts +2 -2
- package/src/import/roundtrip-build.test.ts +46 -0
- package/src/lint/post-synth/crd-schema-helpers.ts +2 -1
- package/src/lsp/completions.ts +2 -1
- package/src/lsp/hover.ts +2 -1
- package/src/op/activities/apply-diff.ts +87 -0
- package/src/op/activities/kubectl-plan.test.ts +224 -0
- package/src/op/activities/kubectl.ts +204 -16
- package/src/serializer.ts +2 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { readinessFor, waitForReady, ReadinessFailedError } from "./wait-for-ready.js";
|
|
4
|
+
const execAsync = promisify(exec);
|
|
5
|
+
/** Error thrown when the Application reaches a terminal unhealthy state. */
|
|
6
|
+
export class ArgoSyncFailedError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "ArgoSyncFailedError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Read status via the Argo CD REST API. */
|
|
13
|
+
async function fetchViaApi(args, signal) {
|
|
14
|
+
const base = args.server.replace(/\/$/, "");
|
|
15
|
+
const ns = args.namespace ?? "argocd";
|
|
16
|
+
const url = `${base}/api/v1/applications/${encodeURIComponent(args.appName)}?appNamespace=${encodeURIComponent(ns)}`;
|
|
17
|
+
const headers = { Accept: "application/json" };
|
|
18
|
+
if (args.authToken)
|
|
19
|
+
headers.Authorization = `Bearer ${args.authToken}`;
|
|
20
|
+
// Honor `insecure` without importing https Agent types — Node respects this
|
|
21
|
+
// env toggle for the duration of the call.
|
|
22
|
+
const prevTlsReject = process.env.NODE_TLS_REJECT_UNAUTHORIZED;
|
|
23
|
+
if (args.insecure)
|
|
24
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
25
|
+
try {
|
|
26
|
+
const res = await fetch(url, { headers, signal });
|
|
27
|
+
if (!res.ok) {
|
|
28
|
+
throw new Error(`Argo CD API returned ${res.status} for application "${args.appName}"`);
|
|
29
|
+
}
|
|
30
|
+
const body = (await res.json());
|
|
31
|
+
return {
|
|
32
|
+
health: body.status?.health?.status ?? "Unknown",
|
|
33
|
+
sync: body.status?.sync?.status ?? "Unknown",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
if (args.insecure) {
|
|
38
|
+
if (prevTlsReject === undefined)
|
|
39
|
+
delete process.env.NODE_TLS_REJECT_UNAUTHORIZED;
|
|
40
|
+
else
|
|
41
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = prevTlsReject;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Read status via `kubectl get application -o json`. */
|
|
46
|
+
async function fetchViaKubectl(args, signal) {
|
|
47
|
+
const ns = args.namespace ?? "argocd";
|
|
48
|
+
const ctx = args.context ? `--context ${args.context}` : "";
|
|
49
|
+
const cmd = `kubectl get application ${args.appName} -n ${ns} ${ctx} ` +
|
|
50
|
+
`-o jsonpath='{.status.health.status}|{.status.sync.status}'`;
|
|
51
|
+
const { stdout } = await execAsync(cmd, { signal });
|
|
52
|
+
const [health = "Unknown", sync = "Unknown"] = stdout.trim().replace(/^'|'$/g, "").split("|");
|
|
53
|
+
return { health: health || "Unknown", sync: sync || "Unknown" };
|
|
54
|
+
}
|
|
55
|
+
/** Default fetcher: REST API when `server` is set, else kubectl. */
|
|
56
|
+
export const defaultArgoStatusFetcher = (args, signal) => args.server ? fetchViaApi(args, signal) : fetchViaKubectl(args, signal);
|
|
57
|
+
/**
|
|
58
|
+
* Poll until the Application is Healthy and Synced. Throws
|
|
59
|
+
* `ArgoSyncFailedError` if it reaches a terminal unhealthy state (Degraded /
|
|
60
|
+
* Missing).
|
|
61
|
+
*
|
|
62
|
+
* Delegates the poll loop and the ready/terminal evaluation to the
|
|
63
|
+
* generic `waitForReady` using the shared `argoproj.io/Application` readiness
|
|
64
|
+
* spec. The Argo `ArgoStatusFetcher` is adapted into a `ResourceFetcher` that
|
|
65
|
+
* shapes `{health, sync}` into the `status.health.status` / `status.sync.status`
|
|
66
|
+
* paths the spec reads — so the REST-API path is preserved.
|
|
67
|
+
*
|
|
68
|
+
* @param fetcher injectable status reader (defaults to kubectl/REST). Tests pass
|
|
69
|
+
* a fake to drive Healthy/Progressing/Degraded transitions.
|
|
70
|
+
*/
|
|
71
|
+
export async function waitForArgoSync(args, signal, fetcher = defaultArgoStatusFetcher) {
|
|
72
|
+
const spec = readinessFor("argoproj.io", "Application");
|
|
73
|
+
// Adapt the Argo status fetcher into the object shape the spec's paths read.
|
|
74
|
+
const resourceFetcher = async (_a, s) => {
|
|
75
|
+
const status = await fetcher(args, s);
|
|
76
|
+
return { status: { health: { status: status.health }, sync: { status: status.sync } } };
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
const obj = await waitForReady({
|
|
80
|
+
kind: "application",
|
|
81
|
+
name: args.appName,
|
|
82
|
+
namespace: args.namespace ?? "argocd",
|
|
83
|
+
group: "argoproj.io",
|
|
84
|
+
spec,
|
|
85
|
+
intervalMs: args.intervalMs ?? 15000,
|
|
86
|
+
}, signal, resourceFetcher);
|
|
87
|
+
const status = obj.status;
|
|
88
|
+
return { health: status.health.status, sync: status.sync.status };
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
// Preserve the Argo-specific error type (the argoSync profile marks it
|
|
92
|
+
// non-retryable) while reusing the generic terminal detection.
|
|
93
|
+
if (err instanceof ReadinessFailedError) {
|
|
94
|
+
throw new ArgoSyncFailedError(`Argo Application "${args.appName}" reached a terminal unhealthy state (Degraded / Missing) — it will not become Healthy without intervention.`);
|
|
95
|
+
}
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ensureSecret` — the activity behind core's `ensureSecret(...)` op step
|
|
3
|
+
* builder (#1829), provided by the store's lexicon as that builder promises
|
|
4
|
+
* (#1830). Registered by name through the activity registry when a project's
|
|
5
|
+
* `chant.config.ts` lists the `k8s` lexicon, exactly like `kubectlApply`.
|
|
6
|
+
*
|
|
7
|
+
* All it does is connect (the same environment→cluster binding every k8s
|
|
8
|
+
* path uses), build the namespace-scoped store adapter, and run core's one
|
|
9
|
+
* materialization engine over it. The contract — present means done, never
|
|
10
|
+
* mint over an existing value, mismatches fail naming key names only, no
|
|
11
|
+
* output carries material — lives in core (`secret-materialization.ts`) and
|
|
12
|
+
* in the adapter (../../secret-store.ts), not here.
|
|
13
|
+
*/
|
|
14
|
+
import { ensureSecretMaterialization, } from "@intentius/chant/secret-materialization";
|
|
15
|
+
import { defaultK8sConnector } from "../../api/connect.js";
|
|
16
|
+
import { k8sSecretStore } from "../../secret-store.js";
|
|
17
|
+
/**
|
|
18
|
+
* Ensure a `generated-once` Secret exists in the target cluster. Returns
|
|
19
|
+
* names only — see core's `EnsureSecretOutcome`.
|
|
20
|
+
*/
|
|
21
|
+
export async function ensureSecret(args, _signal, connect = defaultK8sConnector) {
|
|
22
|
+
const { client } = await connect({
|
|
23
|
+
...(args.environment !== undefined ? { environment: args.environment } : {}),
|
|
24
|
+
...(args.context !== undefined ? { context: args.context } : {}),
|
|
25
|
+
...(args.cwd !== undefined ? { cwd: args.cwd } : {}),
|
|
26
|
+
});
|
|
27
|
+
const marker = args.stack
|
|
28
|
+
? { stack: args.stack, ...(args.env ? { env: args.env } : {}) }
|
|
29
|
+
: undefined;
|
|
30
|
+
const store = k8sSecretStore(args.namespace ?? client.defaultNamespace, client, {
|
|
31
|
+
...(marker ? { marker } : {}),
|
|
32
|
+
});
|
|
33
|
+
return ensureSecretMaterialization(store, {
|
|
34
|
+
name: args.name,
|
|
35
|
+
keys: args.keys,
|
|
36
|
+
...(args.metadata ? { metadata: args.metadata } : {}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* k8s Op activities — resolved by the core activity registry when a project's
|
|
3
|
+
* `chant.config.ts` lists the `k8s` lexicon. Relocated from the hosting lexicon
|
|
4
|
+
* (#809) so Kubernetes-facing imperative activities live with their product:
|
|
5
|
+
* - kubectlApply — server-side apply a rendered manifest (and, since chant
|
|
6
|
+
* #1075, prune chant-owned objects it no longer declares; `applyManifest`
|
|
7
|
+
* is the same work with a report of what it did, which is what core's
|
|
8
|
+
* `nativeApply` dispatcher calls for a kubectl target)
|
|
9
|
+
* - waitForArgoSync — block until an Argo CD Application is Healthy && Synced
|
|
10
|
+
*
|
|
11
|
+
* k3dUp / k3dDown moved again, to the k3d lexicon (chant #1410) — a lexicon
|
|
12
|
+
* owns its own product's activities, and k3d is its own product now. Projects
|
|
13
|
+
* using them list `k3d` in `lexicons`; loadActivities(["k3d"]) provides them.
|
|
14
|
+
*
|
|
15
|
+
* The step builders (kubectlApply, k3dUp, k3dDown) stay in core and reach
|
|
16
|
+
* authors through `@intentius/chant/op` like the other core builders. Each
|
|
17
|
+
* activity is dependency-light — it shells out to a CLI and does not import the
|
|
18
|
+
* k8s declarable surface — so `loadActivities`
|
|
19
|
+
* (`packages/core/src/op/activity-registry.ts`), which imports this module at
|
|
20
|
+
* run time, pulls in nothing expensive.
|
|
21
|
+
*/
|
|
22
|
+
export { kubectlApply, applyManifest, readManifestDocuments } from "./kubectl.js";
|
|
23
|
+
// Generated-once secret materialization (#1830) — the activity behind core's
|
|
24
|
+
// `ensureSecret(...)` step builder (#1829). Read-then-write over the
|
|
25
|
+
// namespace-scoped store adapter in ../../secret-store.ts; no output carries
|
|
26
|
+
// secret material.
|
|
27
|
+
export { ensureSecret } from "./ensure-secret.js";
|
|
28
|
+
export { waitForArgoSync, defaultArgoStatusFetcher, ArgoSyncFailedError } from "./argo.js";
|
|
29
|
+
export { waitForReady, defaultResourceFetcher, apiResourceFetcher, ReadinessFailedError, readinessFor, isReady, firstTerminal, DEFAULT_READINESS, READINESS_OVERRIDES, } from "./wait-for-ready.js";
|
|
30
|
+
// Environment→cluster binding (chant #1100) — the same resolver
|
|
31
|
+
// `describeResources` (the read path) uses. `kubectlApply` and `waitForReady`
|
|
32
|
+
// above already accept an optional `context`; a workflow author who wants the
|
|
33
|
+
// write path to target the environment's bound cluster (rather than an
|
|
34
|
+
// ambient one, closing the read/write split) resolves it here and passes the
|
|
35
|
+
// result through, e.g. `kubectlApply({ manifest, context: (await
|
|
36
|
+
// resolveClusterTarget(config, environment, "k8s")).context })`. Re-exported
|
|
37
|
+
// from core rather than duplicated so both paths agree on one source of
|
|
38
|
+
// truth — see `lexicons/k8s/src/config.ts` for the config shape.
|
|
39
|
+
export { resolveClusterTarget, ClusterBindingMismatchError } from "@intentius/chant/kubectl-context";
|
|
40
|
+
// Effect-receipt activities (#2074): core's receipt seam (#1834) bound to
|
|
41
|
+
// this lexicon's ConfigMap-backed store (../../receipt-store.ts), the same
|
|
42
|
+
// way the aws lexicon binds its SSM store (#1835). Re-exported individually:
|
|
43
|
+
// `receiptRead`/`receiptWrite` serve the `effect()` step's
|
|
44
|
+
// read-compare-run-write, `receiptStaleness` serves WatchOp's read-only
|
|
45
|
+
// staleness reporting.
|
|
46
|
+
import { receiptActivities } from "@intentius/chant/op/receipt-store";
|
|
47
|
+
import { k8sReceiptStore } from "../../receipt-store.js";
|
|
48
|
+
const boundReceiptActivities = receiptActivities(k8sReceiptStore());
|
|
49
|
+
export const receiptRead = boundReceiptActivities.receiptRead;
|
|
50
|
+
export const receiptWrite = boundReceiptActivities.receiptWrite;
|
|
51
|
+
export const receiptStaleness = boundReceiptActivities.receiptStaleness;
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import type { K8sObject } from "@intentius/chant-k8s-client";
|
|
34
34
|
import { type K8sConnector } from "../../api/connect.js";
|
|
35
|
+
import { type FieldChange } from "./apply-diff.js";
|
|
35
36
|
/**
|
|
36
37
|
* How the apply treats chant-owned objects that are no longer declared. The
|
|
37
38
|
* same three values `nativeApply` has always taken; `gated` differs from
|
|
@@ -149,6 +150,69 @@ export declare function resolveFieldManager(args: KubectlApplyArgs): Promise<str
|
|
|
149
150
|
* reports the shell command it ran.
|
|
150
151
|
*/
|
|
151
152
|
export declare function applyManifest(args: KubectlApplyArgs, signal?: AbortSignal, connect?: K8sConnector): Promise<ApplyManifestResult>;
|
|
153
|
+
/** What a dry-run apply would do to one declared object (#3998). */
|
|
154
|
+
export interface PlannedObject {
|
|
155
|
+
ref: AppliedRef;
|
|
156
|
+
/** `create` when no live object exists, `no-op` when the dry run equals it, `update` otherwise. */
|
|
157
|
+
action: "create" | "update" | "no-op";
|
|
158
|
+
/**
|
|
159
|
+
* For a create, the document as the apply sends it (ownership stamped).
|
|
160
|
+
* Not the dry-run result: the server can fill in values a dry run picks
|
|
161
|
+
* afresh each time (a Service's cluster IP), which would make the plan
|
|
162
|
+
* differ from itself.
|
|
163
|
+
*/
|
|
164
|
+
object?: Record<string, unknown>;
|
|
165
|
+
/** The fields an update changes, live against the dry-run result, both normalized. */
|
|
166
|
+
changes: FieldChange[];
|
|
167
|
+
/**
|
|
168
|
+
* The API server rejected the dry run of a change to a live object because
|
|
169
|
+
* it changes an immutable field. The apply does not delete and recreate,
|
|
170
|
+
* so it would fail the same way. The server's message.
|
|
171
|
+
*/
|
|
172
|
+
refused?: string;
|
|
173
|
+
}
|
|
174
|
+
/** What {@link planManifest} found. */
|
|
175
|
+
export interface ManifestPlanResult {
|
|
176
|
+
fieldManager: string;
|
|
177
|
+
stack?: string;
|
|
178
|
+
objects: PlannedObject[];
|
|
179
|
+
/** What the apply's prune would delete: empty unless `deleteMode` deletes. */
|
|
180
|
+
deletes: AppliedRef[];
|
|
181
|
+
/** Owned, undeclared objects the prune keeps (#1830, #2074). */
|
|
182
|
+
retained: AppliedRef[];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Say what {@link applyManifest} would do, without changing anything (#3998).
|
|
186
|
+
*
|
|
187
|
+
* Every document is stamped and dry-run applied exactly as the apply sends
|
|
188
|
+
* it: the same field manager, `force: false`, and the same retake of a
|
|
189
|
+
* conflict chant has only with itself. The live object is read first and
|
|
190
|
+
* compared with the dry-run result through `./apply-diff.ts`, so a field the
|
|
191
|
+
* server defaults counts as unchanged when the live object already has it.
|
|
192
|
+
*
|
|
193
|
+
* An object in a namespace an earlier document of the same plan creates
|
|
194
|
+
* cannot be dry-run (the server answers 404, as the namespace was never
|
|
195
|
+
* persisted), so it plans as a create of the document as sent.
|
|
196
|
+
*
|
|
197
|
+
* Deletes come from the apply's own prune scope (`findOrphans`): marker
|
|
198
|
+
* scoped, in the namespaces the apply set touches, generated-once Secrets
|
|
199
|
+
* and effect receipts kept. They are found only when `deleteMode` is not
|
|
200
|
+
* `never`, as the apply prunes only then.
|
|
201
|
+
*/
|
|
202
|
+
export declare function planManifest(args: KubectlApplyArgs, signal?: AbortSignal, connect?: K8sConnector): Promise<ManifestPlanResult>;
|
|
203
|
+
/** Where {@link readLiveObjects} reads, and which objects. */
|
|
204
|
+
export interface ReadLiveObjectsArgs {
|
|
205
|
+
refs: AppliedRef[];
|
|
206
|
+
environment?: string;
|
|
207
|
+
context?: string;
|
|
208
|
+
cwd?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Read each of `refs` as the cluster holds it now, `undefined` for one that
|
|
212
|
+
* does not exist (#3999). `kubectl-apply` reads the fields its step names as
|
|
213
|
+
* outputs from these.
|
|
214
|
+
*/
|
|
215
|
+
export declare function readLiveObjects(args: ReadLiveObjectsArgs, signal?: AbortSignal, connect?: K8sConnector): Promise<Array<Record<string, unknown> | undefined>>;
|
|
152
216
|
/**
|
|
153
217
|
* Apply every document in `args.manifest`.
|
|
154
218
|
* Uses the longInfra profile: 20m timeout, three attempts backing off from 30s.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kubectl.d.ts","sourceRoot":"","sources":["../../../src/op/activities/kubectl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAWH,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"kubectl.d.ts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