@cat-factory/cli 0.10.5 → 0.11.0
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/README.md +8 -0
- package/dist/args.d.ts +16 -1
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +44 -14
- package/dist/args.js.map +1 -1
- package/dist/host-shell.d.ts +26 -0
- package/dist/host-shell.d.ts.map +1 -1
- package/dist/host-shell.js +19 -0
- package/dist/host-shell.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/k3s-handler.d.ts +35 -20
- package/dist/k3s-handler.d.ts.map +1 -1
- package/dist/k3s-handler.js +54 -26
- package/dist/k3s-handler.js.map +1 -1
- package/dist/k3s-ingress.d.ts +259 -0
- package/dist/k3s-ingress.d.ts.map +1 -0
- package/dist/k3s-ingress.js +372 -0
- package/dist/k3s-ingress.js.map +1 -0
- package/dist/k3s-probe.d.ts +38 -3
- package/dist/k3s-probe.d.ts.map +1 -1
- package/dist/k3s-probe.js +93 -5
- package/dist/k3s-probe.js.map +1 -1
- package/dist/k3s-provision.d.ts +92 -18
- package/dist/k3s-provision.d.ts.map +1 -1
- package/dist/k3s-provision.js +280 -28
- package/dist/k3s-provision.js.map +1 -1
- package/dist/k3s.d.ts +3 -0
- package/dist/k3s.d.ts.map +1 -1
- package/dist/k3s.js +149 -24
- package/dist/k3s.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"k3s-ingress.js","sourceRoot":"","sources":["../src/k3s-ingress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAGjB,UAAU,GAEX,MAAM,iBAAiB,CAAA;AAExB;;;;;;;;;;;;GAYG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAA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,CAAA;QACF,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,GAAG,EAAE,GAAG,mBAAmB,GAAG,QAAQ;YAAE,OAAO,IAAI,CAAA;QAClF,MAAM,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAClC,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,mBAAmB,CAChC,KAAgB,EAChB,OAAwC;IAExC,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IACvC,MAAM,MAAM,GAAG,MAAM,UAAU,CAC7B,KAAK,EACL,qBAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAC5D,CAAA;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,uBAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC"}
|
package/dist/k3s-probe.d.ts
CHANGED
|
@@ -28,7 +28,42 @@ export interface HostDetections {
|
|
|
28
28
|
kindClusters: string[];
|
|
29
29
|
}
|
|
30
30
|
/** The setup paths the probe can offer. */
|
|
31
|
-
export type OfferId = 'use-existing' | 'create-k3d' | 'create-kind' | 'install-k3s';
|
|
31
|
+
export type OfferId = 'use-existing' | 'create-k3d' | 'create-kind' | 'recreate-k3d' | 'recreate-kind' | 'install-k3s';
|
|
32
|
+
/**
|
|
33
|
+
* The DESTRUCTIVE offers, keyed by the runtime each one rebuilds. This is the ONE definition of
|
|
34
|
+
* the recreate set: {@link recreateOfferFor} resolves `--recreate`'s target from it and
|
|
35
|
+
* {@link isRecreateOffer} recognises one, so a `K3sRuntime` with no entry cannot be folded into a
|
|
36
|
+
* neighbour's branch by a two-way ternary.
|
|
37
|
+
*
|
|
38
|
+
* `k3s` has no entry deliberately: it is a HOST SERVICE (a systemd unit installed by `curl | sh`,
|
|
39
|
+
* which this CLI only ever prints), so there is no cluster for the CLI to delete and build again.
|
|
40
|
+
*/
|
|
41
|
+
export declare const RECREATE_OFFERS: {
|
|
42
|
+
readonly k3d: 'recreate-k3d';
|
|
43
|
+
readonly kind: 'recreate-kind';
|
|
44
|
+
};
|
|
45
|
+
/** A runtime `--recreate` can target: one with an entry in {@link RECREATE_OFFERS}. */
|
|
46
|
+
export type RecreatableRuntime = keyof typeof RECREATE_OFFERS;
|
|
47
|
+
export type RecreateOfferId = (typeof RECREATE_OFFERS)[RecreatableRuntime];
|
|
48
|
+
/** The recreate offer for a runtime, or `null` when that runtime has no recreate at all. */
|
|
49
|
+
export declare function recreateOfferFor(runtime: K3sRuntime): RecreateOfferId | null;
|
|
50
|
+
/** Whether an offer is one of the destructive ones. */
|
|
51
|
+
export declare function isRecreateOffer(id: OfferId): id is RecreateOfferId;
|
|
52
|
+
/**
|
|
53
|
+
* The k3d/kind cluster a REUSED kubeconfig context names, when the CLI can both name it and build
|
|
54
|
+
* it again. `null` for anything else (a bare k3s host service, a shared cluster, a context whose
|
|
55
|
+
* cluster the runtime no longer reports).
|
|
56
|
+
*
|
|
57
|
+
* This exists because a remedy has to be a command that WORKS. `--recreate`'s target rule is
|
|
58
|
+
* exactly "a k3d/kind cluster this command can name", and on the reuse path nothing else knows
|
|
59
|
+
* which cluster that is: the offer was `use-existing`, so no name was passed. Without this, the
|
|
60
|
+
* missing-host-port remedy printed `cat-factory k3s --recreate` against the DEFAULT name, which
|
|
61
|
+
* `chooseOffer` then refused for any cluster not called `cat-factory`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function recreateTargetForContext(d: HostDetections): {
|
|
64
|
+
runtime: RecreatableRuntime;
|
|
65
|
+
clusterName: string;
|
|
66
|
+
} | null;
|
|
32
67
|
/** One offered setup path, with whether it's currently possible + why not. */
|
|
33
68
|
export interface Offer {
|
|
34
69
|
id: OfferId;
|
|
@@ -51,7 +86,7 @@ export interface HostState {
|
|
|
51
86
|
* `install-k3s` offer's copy — k3s is Linux-only, so on Windows/macOS that path points at
|
|
52
87
|
* k3s-in-Docker via k3d instead of a `curl | sh` install that can't run there.
|
|
53
88
|
*/
|
|
54
|
-
export declare function classifyHost(d: HostDetections, preferred?: K3sRuntime, platform?: NodeJS.Platform): HostState;
|
|
89
|
+
export declare function classifyHost(d: HostDetections, preferred?: K3sRuntime, platform?: NodeJS.Platform, clusterName?: string): HostState;
|
|
55
90
|
/** Parse `k3d cluster list --output json` (an array of `{ name }`) into cluster names. */
|
|
56
91
|
export declare function parseK3dClusters(stdout: string): string[];
|
|
57
92
|
/** Parse `kind get clusters` (newline-separated names; a "No kind clusters" note ⇒ empty). */
|
|
@@ -74,5 +109,5 @@ export declare function hasServerVersion(stdout: string): boolean;
|
|
|
74
109
|
* `--request-timeout` — a kubeconfig pointing at a down cluster then fails fast instead of hanging
|
|
75
110
|
* the probe (the {@link HostShell} watchdog is the outer backstop).
|
|
76
111
|
*/
|
|
77
|
-
export declare function probeHost(shell: HostShell, preferred?: K3sRuntime, platform?: NodeJS.Platform): Promise<HostState>;
|
|
112
|
+
export declare function probeHost(shell: HostShell, preferred?: K3sRuntime, platform?: NodeJS.Platform, clusterName?: string): Promise<HostState>;
|
|
78
113
|
//# sourceMappingURL=k3s-probe.d.ts.map
|
package/dist/k3s-probe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k3s-probe.d.ts","sourceRoot":"","sources":["../src/k3s-probe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"k3s-probe.d.ts","sourceRoot":"","sources":["../src/k3s-probe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAKnE,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC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C9E,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,OAAO,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;IACpB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,mGAAmG;AACnG,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,cAAc,CAAA;IAC1B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,WAAW,EAAE,OAAO,CAAA;CACrB;AAuBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,CAAC,EAAE,cAAc,EACjB,SAAS,GAAE,UAAkB,EAC7B,QAAQ,GAAE,MAAM,CAAC,QAAkB,EACnC,WAAW,GAAE,MAA6B,GACzC,SAAS,CA2FX;AAgBD,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAYzD;AAED,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAK1D;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5E;AAED,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAOxD;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,EAChB,SAAS,GAAE,UAAkB,EAC7B,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,WAAW,GAAE,MAA6B,GACzC,OAAO,CAAC,SAAS,CAAC,CA0CpB"}
|
package/dist/k3s-probe.js
CHANGED
|
@@ -1,9 +1,66 @@
|
|
|
1
|
-
import {} from './args.js';
|
|
1
|
+
import { OPTION_DEFAULTS } from './args.js';
|
|
2
2
|
import { COMMAND_NOT_FOUND } from './host-shell.js';
|
|
3
|
+
/** The cluster name the recreate offers key off when `--cluster-name` was not supplied. */
|
|
4
|
+
const DEFAULT_CLUSTER_NAME = OPTION_DEFAULTS.k3sClusterName;
|
|
5
|
+
/**
|
|
6
|
+
* The DESTRUCTIVE offers, keyed by the runtime each one rebuilds. This is the ONE definition of
|
|
7
|
+
* the recreate set: {@link recreateOfferFor} resolves `--recreate`'s target from it and
|
|
8
|
+
* {@link isRecreateOffer} recognises one, so a `K3sRuntime` with no entry cannot be folded into a
|
|
9
|
+
* neighbour's branch by a two-way ternary.
|
|
10
|
+
*
|
|
11
|
+
* `k3s` has no entry deliberately: it is a HOST SERVICE (a systemd unit installed by `curl | sh`,
|
|
12
|
+
* which this CLI only ever prints), so there is no cluster for the CLI to delete and build again.
|
|
13
|
+
*/
|
|
14
|
+
export const RECREATE_OFFERS = {
|
|
15
|
+
k3d: 'recreate-k3d',
|
|
16
|
+
kind: 'recreate-kind',
|
|
17
|
+
};
|
|
18
|
+
/** The recreate offer for a runtime, or `null` when that runtime has no recreate at all. */
|
|
19
|
+
export function recreateOfferFor(runtime) {
|
|
20
|
+
return runtime in RECREATE_OFFERS ? RECREATE_OFFERS[runtime] : null;
|
|
21
|
+
}
|
|
22
|
+
/** Whether an offer is one of the destructive ones. */
|
|
23
|
+
export function isRecreateOffer(id) {
|
|
24
|
+
return Object.values(RECREATE_OFFERS).includes(id);
|
|
25
|
+
}
|
|
26
|
+
/** kubeconfig context prefixes k3d/kind assign, paired with the runtime that owns them. */
|
|
27
|
+
const CONTEXT_RUNTIMES = [
|
|
28
|
+
['k3d-', 'k3d'],
|
|
29
|
+
['kind-', 'kind'],
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* The k3d/kind cluster a REUSED kubeconfig context names, when the CLI can both name it and build
|
|
33
|
+
* it again. `null` for anything else (a bare k3s host service, a shared cluster, a context whose
|
|
34
|
+
* cluster the runtime no longer reports).
|
|
35
|
+
*
|
|
36
|
+
* This exists because a remedy has to be a command that WORKS. `--recreate`'s target rule is
|
|
37
|
+
* exactly "a k3d/kind cluster this command can name", and on the reuse path nothing else knows
|
|
38
|
+
* which cluster that is: the offer was `use-existing`, so no name was passed. Without this, the
|
|
39
|
+
* missing-host-port remedy printed `cat-factory k3s --recreate` against the DEFAULT name, which
|
|
40
|
+
* `chooseOffer` then refused for any cluster not called `cat-factory`.
|
|
41
|
+
*/
|
|
42
|
+
export function recreateTargetForContext(d) {
|
|
43
|
+
const context = d.clusterContext;
|
|
44
|
+
if (!context)
|
|
45
|
+
return null;
|
|
46
|
+
for (const [prefix, runtime] of CONTEXT_RUNTIMES) {
|
|
47
|
+
if (!context.startsWith(prefix))
|
|
48
|
+
continue;
|
|
49
|
+
const clusterName = context.slice(prefix.length);
|
|
50
|
+
const known = runtime === 'kind' ? d.kindClusters : d.k3dClusters;
|
|
51
|
+
if (clusterName.length > 0 && known.includes(clusterName))
|
|
52
|
+
return { runtime, clusterName };
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
3
56
|
/**
|
|
4
57
|
* Priority order for picking the recommendation, given the user's preferred runtime. A live cluster
|
|
5
58
|
* always wins; otherwise the preferred distribution's create/install path is tried first, then the
|
|
6
59
|
* others as fallbacks. Every list ends with `install-k3s`, which is always available.
|
|
60
|
+
*
|
|
61
|
+
* The `recreate-*` offers appear in NO list, deliberately: they destroy a cluster, and a
|
|
62
|
+
* recommendation is what `--yes` follows when nobody is watching. They are reachable only by an
|
|
63
|
+
* explicit `--recreate` or an interactive pick, so the destructive intent is always stated.
|
|
7
64
|
*/
|
|
8
65
|
function offerPriority(preferred) {
|
|
9
66
|
switch (preferred) {
|
|
@@ -23,7 +80,7 @@ function offerPriority(preferred) {
|
|
|
23
80
|
* `install-k3s` offer's copy — k3s is Linux-only, so on Windows/macOS that path points at
|
|
24
81
|
* k3s-in-Docker via k3d instead of a `curl | sh` install that can't run there.
|
|
25
82
|
*/
|
|
26
|
-
export function classifyHost(d, preferred = 'k3d', platform = 'linux') {
|
|
83
|
+
export function classifyHost(d, preferred = 'k3d', platform = 'linux', clusterName = DEFAULT_CLUSTER_NAME) {
|
|
27
84
|
const useExisting = {
|
|
28
85
|
id: 'use-existing',
|
|
29
86
|
label: d.clusterContext
|
|
@@ -67,7 +124,38 @@ export function classifyHost(d, preferred = 'k3d', platform = 'linux') {
|
|
|
67
124
|
available: true,
|
|
68
125
|
recommended: false,
|
|
69
126
|
};
|
|
70
|
-
|
|
127
|
+
// Recreating is a first-class operation rather than the remedy for any one condition: these
|
|
128
|
+
// clusters are transient and the reasons to want a fresh one are open-ended (wedged, created by
|
|
129
|
+
// hand with the wrong flags, a version bump, a pile of leftover namespaces, or no stated reason
|
|
130
|
+
// at all). What does NOT open up is the TARGET, and that is a safety boundary: it is offered
|
|
131
|
+
// only for a cluster this CLI can both NAME and build again, which is why there is no recreate
|
|
132
|
+
// for `use-existing` (that fires for any reachable kubeconfig, including a shared cluster, and
|
|
133
|
+
// there is no recipe for re-creating "whatever this context points at").
|
|
134
|
+
const recreate = (runtime) => {
|
|
135
|
+
const id = RECREATE_OFFERS[runtime];
|
|
136
|
+
const tooling = runtime === 'kind' ? d.kind : d.k3d;
|
|
137
|
+
const clusters = runtime === 'kind' ? d.kindClusters : d.k3dClusters;
|
|
138
|
+
const known = clusters.includes(clusterName);
|
|
139
|
+
return {
|
|
140
|
+
id,
|
|
141
|
+
label: `Recreate the ${runtime} cluster "${clusterName}" (DESTROYS it and everything on it)`,
|
|
142
|
+
available: d.docker.running && tooling.installed && known,
|
|
143
|
+
recommended: false,
|
|
144
|
+
reason: dockerReason ??
|
|
145
|
+
(!tooling.installed
|
|
146
|
+
? `${runtime} is not installed`
|
|
147
|
+
: !known
|
|
148
|
+
? `no ${runtime} cluster named "${clusterName}" exists`
|
|
149
|
+
: undefined),
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
const offers = [
|
|
153
|
+
useExisting,
|
|
154
|
+
createK3d,
|
|
155
|
+
createKind,
|
|
156
|
+
...Object.keys(RECREATE_OFFERS).map(recreate),
|
|
157
|
+
installK3s,
|
|
158
|
+
];
|
|
71
159
|
const recommended = offerPriority(preferred).find((id) => offers.find((o) => o.id === id)?.available) ??
|
|
72
160
|
'install-k3s';
|
|
73
161
|
for (const o of offers)
|
|
@@ -142,7 +230,7 @@ export function hasServerVersion(stdout) {
|
|
|
142
230
|
* `--request-timeout` — a kubeconfig pointing at a down cluster then fails fast instead of hanging
|
|
143
231
|
* the probe (the {@link HostShell} watchdog is the outer backstop).
|
|
144
232
|
*/
|
|
145
|
-
export async function probeHost(shell, preferred = 'k3d', platform = process.platform) {
|
|
233
|
+
export async function probeHost(shell, preferred = 'k3d', platform = process.platform, clusterName = DEFAULT_CLUSTER_NAME) {
|
|
146
234
|
const [kubectlVersion, kubectlContext, k3dVersion, k3dList, kindVersion, kindList, k3sVersion, dockerVersion,] = await Promise.all([
|
|
147
235
|
shell.run('kubectl', ['version', '--output=json', '--request-timeout=3s']),
|
|
148
236
|
shell.run('kubectl', ['config', 'current-context']),
|
|
@@ -171,6 +259,6 @@ export async function probeHost(shell, preferred = 'k3d', platform = process.pla
|
|
|
171
259
|
k3dClusters: k3dList.code === 0 ? parseK3dClusters(k3dList.stdout) : [],
|
|
172
260
|
kindClusters: kindList.code === 0 ? parseKindClusters(kindList.stdout) : [],
|
|
173
261
|
};
|
|
174
|
-
return classifyHost(detections, preferred, platform);
|
|
262
|
+
return classifyHost(detections, preferred, platform, clusterName);
|
|
175
263
|
}
|
|
176
264
|
//# sourceMappingURL=k3s-probe.js.map
|
package/dist/k3s-probe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k3s-probe.js","sourceRoot":"","sources":["../src/k3s-probe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"k3s-probe.js","sourceRoot":"","sources":["../src/k3s-probe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,eAAe,EAAE,MAAM,WAAW,CAAA;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C,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QACvF,MAAM,EAAE;YACN,SAAS,EAAE,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC;YAC1C,OAAO,EAAE,aAAa,CAAC,IAAI,KAAK,CAAC,IAAI,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,SAAS;SACnF;QACD,gBAAgB,EAAE,cAAc,CAAC,IAAI,KAAK,CAAC,IAAI,gBAAgB,CAAC,cAAc,CAAC,MAAM,CAAC;QACtF,cAAc,EAAE,OAAO;QACvB,WAAW,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;QACvE,YAAY,EAAE,QAAQ,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;KAC5E,CAAA;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;AACnE,CAAC"}
|
package/dist/k3s-provision.d.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { type CliOptions } from './args.js';
|
|
2
|
-
import { type HostShell } from './host-shell.js';
|
|
2
|
+
import { type Command, type HostShell } from './host-shell.js';
|
|
3
|
+
import { type IngressReadiness, type TcpProbe } from './k3s-ingress.js';
|
|
3
4
|
import { type Io } from './io.js';
|
|
4
5
|
import { type HostState, type OfferId } from './k3s-probe.js';
|
|
5
6
|
/** The namespace + ServiceAccount + long-lived token Secret the guided setup creates. */
|
|
6
7
|
export declare const CAT_FACTORY_NAMESPACE = "cat-factory";
|
|
7
8
|
export declare const SERVICE_ACCOUNT_NAME = "cat-factory";
|
|
9
|
+
/** The apiserver port k3d/kind is asked to publish (the kube default). */
|
|
10
|
+
export declare const DEFAULT_API_PORT = 6443;
|
|
8
11
|
/**
|
|
9
12
|
* Watchdog budget (ms) for `k3d cluster create` / `kind create cluster`. These pull node images on
|
|
10
13
|
* the first run and routinely take 30–90s, so they need far more than the {@link HostShell} default
|
|
11
14
|
* (10s) — otherwise the watchdog SIGKILLs the create mid-flight and the whole create path fails.
|
|
12
15
|
*/
|
|
13
16
|
export declare const CLUSTER_CREATE_TIMEOUT_MS = 300000;
|
|
14
|
-
/**
|
|
15
|
-
export
|
|
16
|
-
cmd: string;
|
|
17
|
-
args: string[];
|
|
18
|
-
input?: string;
|
|
19
|
-
/** Per-command watchdog override (ms). Absent ⇒ the {@link HostShell} default applies. */
|
|
20
|
-
timeoutMs?: number;
|
|
21
|
-
}
|
|
17
|
+
/** Watchdog budget (ms) for `k3d/kind cluster delete`, which tears down containers + volumes. */
|
|
18
|
+
export declare const CLUSTER_DELETE_TIMEOUT_MS = 120000;
|
|
22
19
|
/**
|
|
23
20
|
* The resolved local-k3s connection produced by provisioning: the apiserver URL read from the
|
|
24
21
|
* kubeconfig plus the minted ServiceAccount token. Consumed by the hand-off (slice 3 builds the
|
|
@@ -29,9 +26,27 @@ export interface ResolvedConnection {
|
|
|
29
26
|
engine: 'local-k3s';
|
|
30
27
|
/** The provisioned/created cluster name (create paths only; absent for reuse). */
|
|
31
28
|
clusterName?: string;
|
|
29
|
+
/** The distribution the cluster was created/recreated with; absent when reusing a context. */
|
|
30
|
+
runtime?: 'k3d' | 'kind';
|
|
32
31
|
apiServerUrl: string;
|
|
33
32
|
apiToken: string;
|
|
34
33
|
insecureSkipTlsVerify: true;
|
|
34
|
+
/**
|
|
35
|
+
* What the ingress probe ESTABLISHED, never what the distribution is assumed to do. Everything
|
|
36
|
+
* downstream that would otherwise promise an ingress-derived environment URL (the printed
|
|
37
|
+
* summary, the connect-form deep link) keys off this.
|
|
38
|
+
*/
|
|
39
|
+
ingress: IngressReadiness;
|
|
40
|
+
/**
|
|
41
|
+
* The cluster a `--recreate` could name, when there is one: the cluster this run built, or (on
|
|
42
|
+
* the reuse path) the k3d/kind cluster the kubeconfig context resolves to. Absent when no such
|
|
43
|
+
* target exists, and a remedy that would print a recreate has to WITHHOLD it then, because
|
|
44
|
+
* `--recreate` refuses anything it cannot name.
|
|
45
|
+
*/
|
|
46
|
+
recreateTarget?: {
|
|
47
|
+
runtime: 'k3d' | 'kind';
|
|
48
|
+
clusterName: string;
|
|
49
|
+
};
|
|
35
50
|
}
|
|
36
51
|
/** Raised when a provisioning command fails; carries an actionable message (never the token). */
|
|
37
52
|
export declare class ProvisionError extends Error {
|
|
@@ -57,10 +72,48 @@ export declare class ProvisionError extends Error {
|
|
|
57
72
|
* token must be kept private.)
|
|
58
73
|
*/
|
|
59
74
|
export declare const RBAC_MANIFEST = "apiVersion: v1\nkind: Namespace\nmetadata:\n name: cat-factory\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: cat-factory\n namespace: cat-factory\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: cat-factory-env\nrules:\n - apiGroups: ['']\n resources: ['namespaces']\n verbs: ['create', 'get', 'list', 'watch', 'delete']\n - apiGroups: ['']\n resources: ['services', 'configmaps', 'persistentvolumeclaims', 'pods']\n verbs: ['create', 'get', 'list', 'watch', 'patch', 'update', 'delete']\n - apiGroups: ['']\n resources: ['secrets', 'serviceaccounts']\n verbs: ['create', 'get', 'patch', 'update', 'delete']\n - apiGroups: ['']\n resources: ['pods/proxy']\n verbs: ['create', 'get']\n - apiGroups: ['apps']\n resources: ['deployments', 'statefulsets', 'replicasets']\n verbs: ['create', 'get', 'list', 'watch', 'patch', 'update', 'delete']\n - apiGroups: ['batch']\n resources: ['jobs']\n verbs: ['create', 'get', 'list', 'watch', 'patch', 'update', 'delete']\n - apiGroups: ['networking.k8s.io']\n resources: ['ingresses']\n verbs: ['create', 'get', 'list', 'watch', 'patch', 'update', 'delete']\n - apiGroups: ['gateway.networking.k8s.io']\n resources: ['gateways', 'httproutes']\n verbs: ['create', 'get', 'list', 'watch', 'patch', 'update', 'delete']\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: cat-factory-env\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: cat-factory-env\nsubjects:\n - kind: ServiceAccount\n name: cat-factory\n namespace: cat-factory\n---\napiVersion: v1\nkind: Secret\nmetadata:\n name: cat-factory-token\n namespace: cat-factory\n annotations:\n kubernetes.io/service-account.name: cat-factory\ntype: kubernetes.io/service-account-token\n";
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
/**
|
|
76
|
+
* `k3d cluster create <name> --api-port <p> -p <ingress>:80@loadbalancer`.
|
|
77
|
+
*
|
|
78
|
+
* The `-p` is the half that used to be missing, and it can only be supplied HERE: k3d forwards
|
|
79
|
+
* exactly the host ports it was asked for when the load-balancer container was created, and
|
|
80
|
+
* Docker cannot publish a new one onto a running container. A cluster created without it can
|
|
81
|
+
* never serve an ingress-derived URL, however correct the rest of the configuration is.
|
|
82
|
+
*
|
|
83
|
+
* A default k3d cluster DOES bundle an ingress controller (k3s installs Traefik through a
|
|
84
|
+
* HelmChart manifest, verified against k3d 5.7.5 / k3s v1.30.6), so the create path publishes a
|
|
85
|
+
* port and installs nothing.
|
|
86
|
+
*/
|
|
87
|
+
export declare function k3dCreateCommand(name: string, apiPort?: number, ingressPort?: number): Command;
|
|
88
|
+
/**
|
|
89
|
+
* The kind cluster config fed to `kind create cluster --config -`.
|
|
90
|
+
*
|
|
91
|
+
* Both settings are create-time-only and both are needed before any ingress controller can work:
|
|
92
|
+
* `extraPortMappings` is kind's equivalent of k3d's `-p`, and `ingress-ready=true` is the node
|
|
93
|
+
* label every published kind ingress recipe selects on.
|
|
94
|
+
*
|
|
95
|
+
* What this deliberately does NOT do is install a controller. kind, unlike k3d, ships none, and
|
|
96
|
+
* the ways to get one (a third-party manifest fetched from the internet, or the separate
|
|
97
|
+
* `cloud-provider-kind` host process) are both choices about what runs on the operator's machine
|
|
98
|
+
* that a guided setup should not make silently. So the create path lays the irreversible half and
|
|
99
|
+
* the probe then reports the controller as verified-missing with the exact command, which a
|
|
100
|
+
* re-run turns into a verified-ready.
|
|
101
|
+
*/
|
|
102
|
+
export declare function kindClusterConfig(ingressPort?: number): string;
|
|
103
|
+
/** `kind create cluster --name <name> --config -`, with the ingress config on stdin. */
|
|
104
|
+
export declare function kindCreateCommand(name: string, ingressPort?: number): Command;
|
|
105
|
+
/**
|
|
106
|
+
* The create command for either distribution, so every caller (the create path, the recreate leg,
|
|
107
|
+
* and the printed guidance) issues the SAME line. The printed one used to be hand-written and had
|
|
108
|
+
* therefore lost the `-p` publish flag, telling an operator to build exactly the cluster whose
|
|
109
|
+
* missing host port the next run then asked them to recreate.
|
|
110
|
+
*/
|
|
111
|
+
export declare function clusterCreateCommand(runtime: 'k3d' | 'kind', name: string, ingressPort?: number): Command;
|
|
112
|
+
/** `k3d cluster delete <name>` / `kind delete cluster --name <name>`. Destroys the cluster. */
|
|
113
|
+
export declare function clusterDeleteCommand(runtime: 'k3d' | 'kind', name: string): Command;
|
|
114
|
+
/** Namespaces on the target context, read so a destructive prompt can name what is on it. */
|
|
115
|
+
export declare function listNamespacesCommand(context?: string): Command;
|
|
116
|
+
export declare function parseUserNamespaces(stdout: string): string[];
|
|
64
117
|
/** The kubeconfig context name k3d/kind assigns to a cluster it creates. */
|
|
65
118
|
export declare function contextName(runtime: 'k3d' | 'kind', name: string): string;
|
|
66
119
|
/** `kubectl apply -f -` with the RBAC manifest on stdin (idempotent), targeting `context`. */
|
|
@@ -84,8 +137,12 @@ export declare function looksLocalCluster(context: string | undefined, apiServer
|
|
|
84
137
|
export interface ProvisionDeps {
|
|
85
138
|
shell: HostShell;
|
|
86
139
|
io: Io;
|
|
140
|
+
/** TCP reachability seam, used to establish that a host ingress port is actually served. */
|
|
141
|
+
tcp: TcpProbe;
|
|
87
142
|
/** Delay between token-Secret read attempts (real setTimeout; a no-op in tests). */
|
|
88
143
|
sleep?: (ms: number) => Promise<void>;
|
|
144
|
+
/** Clock the ingress settle wait is measured against (default `Date.now`); see `probeIngress`. */
|
|
145
|
+
now?: () => number;
|
|
89
146
|
/**
|
|
90
147
|
* How many times to poll the freshly-applied token Secret for a populated `.data.token` before
|
|
91
148
|
* giving up (500ms between attempts). Absent ⇒ {@link DEFAULT_TOKEN_READ_ATTEMPTS} (a snappy
|
|
@@ -94,12 +151,29 @@ export interface ProvisionDeps {
|
|
|
94
151
|
*/
|
|
95
152
|
tokenReadAttempts?: number;
|
|
96
153
|
}
|
|
154
|
+
/** The host port a Docker failure names as already bound, when it names one. */
|
|
155
|
+
export declare function boundPortFromDetail(detail: string): number | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* An extra hint appended to a create failure that looks like a host-port collision.
|
|
158
|
+
*
|
|
159
|
+
* A create asks for TWO host ports, so the hint READS which one Docker refused out of its own
|
|
160
|
+
* message instead of naming the apiserver port, which it used to do unconditionally and would
|
|
161
|
+
* misattribute an ingress-port collision. Port 80 is taken often enough on Windows and macOS that
|
|
162
|
+
* an opaque `k3d cluster create` failure here is the likely first experience, so the hint names
|
|
163
|
+
* the flag that moves it.
|
|
164
|
+
*/
|
|
165
|
+
export declare function portCollisionHint(ingressPort: number): (detail: string) => string;
|
|
166
|
+
/** The distribution behind a create/recreate offer; `null` for the reuse path. */
|
|
167
|
+
export declare function offerRuntime(chosen: OfferId): 'k3d' | 'kind' | null;
|
|
168
|
+
/** The ingress host port a run targets: `--ingress-port`, else {@link DEFAULT_INGRESS_PORT}. */
|
|
169
|
+
export declare function resolveIngressPort(options: CliOptions): number;
|
|
97
170
|
/**
|
|
98
|
-
* Provision (or reuse) a local cluster for the chosen offer, create the
|
|
99
|
-
* ServiceAccount + RBAC, mint a long-lived token,
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
171
|
+
* Provision (create, recreate or reuse) a local cluster for the chosen offer, create the
|
|
172
|
+
* least-privilege ServiceAccount + RBAC, mint a long-lived token, read the apiserver URL, and
|
|
173
|
+
* PROBE whether an ingress-derived environment URL can actually be served, returning the resolved
|
|
174
|
+
* `local-k3s` connection. Every MUTATING step (cluster create/delete, RBAC apply) is behind an
|
|
175
|
+
* explicit confirm unless `--yes`. Idempotent apart from `recreate-*`: an existing cluster/SA is
|
|
176
|
+
* reused, not duplicated. `install-k3s` is NOT handled here (guidance-only).
|
|
103
177
|
*/
|
|
104
178
|
export declare function provisionCluster(chosen: Exclude<OfferId, 'install-k3s'>, state: HostState, options: CliOptions, deps: ProvisionDeps): Promise<ResolvedConnection>;
|
|
105
179
|
//# sourceMappingURL=k3s-provision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k3s-provision.d.ts","sourceRoot":"","sources":["../src/k3s-provision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"k3s-provision.d.ts","sourceRoot":"","sources":["../src/k3s-provision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EAKL,KAAK,gBAAgB,EAErB,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,OAAO,EAGb,MAAM,gBAAgB,CAAA;AAEvB,yFAAyF;AACzF,eAAO,MAAM,qBAAqB,gBAAgB,CAAA;AAClD,eAAO,MAAM,oBAAoB,gBAAgB,CAAA;AAEjD,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,OAAO,CAAA;AAEpC;;;;GAI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