@intentius/chant 0.41.0 → 0.41.2
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/cli/build-params-cli.d.ts +24 -0
- package/dist/cli/build-params-cli.d.ts.map +1 -1
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/components/capability-plugin.d.ts +16 -0
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +5 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/deploy-units.d.ts +49 -0
- package/dist/components/deploy-units.d.ts.map +1 -0
- package/dist/components/starter-plugin.d.ts +1 -1
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/graph-detail.d.ts +16 -0
- package/dist/graph-detail.d.ts.map +1 -1
- package/dist/kubectl-context.d.ts +22 -14
- package/dist/kubectl-context.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/build-params-cli.ts +35 -0
- package/src/cli/handlers/components.ts +29 -23
- package/src/cli/handlers/graph.test.ts +51 -1
- package/src/cli/handlers/graph.ts +40 -5
- package/src/cli/handlers/lifecycle.ts +18 -3
- package/src/components/capability-plugin.test.ts +21 -0
- package/src/components/capability-plugin.ts +33 -0
- package/src/components/cli-support.test.ts +17 -0
- package/src/components/cli-support.ts +11 -1
- package/src/components/deploy-units.test.ts +42 -0
- package/src/components/deploy-units.ts +82 -0
- package/src/components/starter-plugin.ts +4 -2
- package/src/config.test.ts +53 -0
- package/src/config.ts +41 -3
- package/src/graph-detail.test.ts +37 -1
- package/src/graph-detail.ts +28 -0
- package/src/kubectl-context.test.ts +16 -24
- package/src/kubectl-context.ts +22 -19
package/src/kubectl-context.ts
CHANGED
|
@@ -38,11 +38,13 @@ export interface K8sConfigShape {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
* kubectl context
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
41
|
+
* Historically thrown when an environment declared a cluster binding but the
|
|
42
|
+
* ambient kubectl context disagreed with it (#1100/#1155). As of #1488 the
|
|
43
|
+
* resolver no longer polices ambient at all — a declared binding is USED, not
|
|
44
|
+
* checked — so {@link resolveClusterTarget} never throws this anymore. The
|
|
45
|
+
* class stays exported because the k8s lexicon's read/write paths still catch
|
|
46
|
+
* it (converting a refusal into NOT-OBSERVED), and a custom connector may
|
|
47
|
+
* still throw it to get that classification.
|
|
46
48
|
*/
|
|
47
49
|
export class ClusterBindingMismatchError extends Error {
|
|
48
50
|
constructor(
|
|
@@ -77,8 +79,11 @@ export interface ResolvedClusterTarget {
|
|
|
77
79
|
* `kubectl config current-context`; the k8s lexicon's typed API client
|
|
78
80
|
* (chant #1074) supplies one that reads the parsed kubeconfig instead, so a
|
|
79
81
|
* client that never needs the `kubectl` binary does not acquire a dependency
|
|
80
|
-
* on it just to check the binding.
|
|
81
|
-
*
|
|
82
|
+
* on it just to check the binding.
|
|
83
|
+
*
|
|
84
|
+
* As of #1488 the resolver itself no longer reads ambient (a declared binding
|
|
85
|
+
* is used directly), so this hook only matters to callers that surface the
|
|
86
|
+
* ambient context in their own messages.
|
|
82
87
|
*/
|
|
83
88
|
export type AmbientContextReader = () => Promise<string | undefined>;
|
|
84
89
|
|
|
@@ -112,13 +117,16 @@ export interface ResolveClusterTargetOptions {
|
|
|
112
117
|
* - No binding declared: returns `{ source: "ambient" }` — unchanged
|
|
113
118
|
* behavior — but logs a visible warning identifying the caller and
|
|
114
119
|
* environment, so the fallback is never silent (#1100 acceptance).
|
|
115
|
-
* - Binding declared
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
120
|
+
* - Binding declared: returns `{ context: bound, source: "bound" }`,
|
|
121
|
+
* regardless of what is ambient (#1488). The declared binding is the
|
|
122
|
+
* selection, not a check: callers pass this context explicitly on every
|
|
123
|
+
* read and write, so whichever cluster `kubectl` happens to be pointed at
|
|
124
|
+
* is irrelevant. Any k3d cluster another project creates mid-session used
|
|
125
|
+
* to steal the ambient context and turn a healthy estate grey with
|
|
126
|
+
* `read-failed` as the only explanation; now it cannot. A bound context
|
|
127
|
+
* that is absent from the kubeconfig fails downstream in the typed client
|
|
128
|
+
* with an error naming the context and the `k8s.profiles.<env>.context`
|
|
129
|
+
* binding — never by falling back to ambient.
|
|
122
130
|
*/
|
|
123
131
|
export async function resolveClusterTarget(
|
|
124
132
|
config: Record<string, unknown>,
|
|
@@ -141,11 +149,6 @@ export async function resolveClusterTarget(
|
|
|
141
149
|
return { source: "ambient" };
|
|
142
150
|
}
|
|
143
151
|
|
|
144
|
-
const ambient = await (options.ambientContext ?? currentAmbientContext)();
|
|
145
|
-
if (ambient && ambient !== bound) {
|
|
146
|
-
throw new ClusterBindingMismatchError(environment, bound, ambient);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
152
|
return { context: bound, source: "bound" };
|
|
150
153
|
}
|
|
151
154
|
|