alchemy-docker-k3s 0.1.0-alpha.5 → 0.1.1
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 +1 -1
- package/dist/index.mjs +22 -12
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,5 +4,5 @@ Persistent single-node local K3s clusters, backed by k3d, that implement
|
|
|
4
4
|
Alchemy's `Kubernetes.ClusterLike` contract.
|
|
5
5
|
|
|
6
6
|
See the
|
|
7
|
-
[repository documentation](https://github.com/toolbar23/alchemy-
|
|
7
|
+
[repository documentation](https://github.com/toolbar23/alchemy-k8s#local-cluster)
|
|
8
8
|
for configuration, port mapping, and update behavior.
|
package/dist/index.mjs
CHANGED
|
@@ -101,18 +101,28 @@ const assertSameMinor = (current, desired) => {
|
|
|
101
101
|
//#region ../shared/src/channel.ts
|
|
102
102
|
const resolveChannelVersion = async (channel, fetcher = fetch) => {
|
|
103
103
|
validateChannel(channel);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
104
|
+
let lastError;
|
|
105
|
+
for (let attempt = 1; attempt <= 3; attempt += 1) try {
|
|
106
|
+
const response = await fetcher(`https://update.k3s.io/v1-release/channels/${channel}`, {
|
|
107
|
+
redirect: "manual",
|
|
108
|
+
signal: AbortSignal.timeout(15e3)
|
|
109
|
+
});
|
|
110
|
+
const location = response.headers.get("location");
|
|
111
|
+
if (response.status >= 300 && response.status < 400) {
|
|
112
|
+
if (location === null) throw new Error(`HTTP ${response.status} without a Location header`);
|
|
113
|
+
const match = /(?:^|\/)(v\d+\.\d+\.\d+(?:\+k3s\d+)?)(?:$|[/?#])/.exec(decodeURIComponent(location));
|
|
114
|
+
if (match?.[1] !== void 0) return match[1];
|
|
115
|
+
throw new Error(`redirect contained no recognizable release version: ${location}`);
|
|
116
|
+
}
|
|
117
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
118
|
+
const bodyMatch = /v\d+\.\d+\.\d+(?:\+k3s\d+)?/.exec((await response.text()).trim());
|
|
119
|
+
if (bodyMatch?.[0] !== void 0) return bodyMatch[0];
|
|
120
|
+
throw new Error("response contained no recognizable release version");
|
|
121
|
+
} catch (error) {
|
|
122
|
+
lastError = error;
|
|
123
|
+
if (attempt < 3) await new Promise((resolve) => setTimeout(resolve, attempt === 1 ? 250 : 1e3));
|
|
124
|
+
}
|
|
125
|
+
throw new Error(`Unable to resolve K3s channel ${channel} after 3 attempts: ${lastError instanceof Error ? lastError.message : String(lastError)}`, { cause: lastError });
|
|
116
126
|
};
|
|
117
127
|
//#endregion
|
|
118
128
|
//#region ../shared/src/kubeconfig.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy-docker-k3s",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Persistent local k3d clusters for Alchemy",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/toolbar23/alchemy-
|
|
26
|
+
"url": "git+https://github.com/toolbar23/alchemy-k8s.git",
|
|
27
27
|
"directory": "packages/docker"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://github.com/toolbar23/alchemy-
|
|
30
|
-
"bugs": "https://github.com/toolbar23/alchemy-
|
|
29
|
+
"homepage": "https://github.com/toolbar23/alchemy-k8s#readme",
|
|
30
|
+
"bugs": "https://github.com/toolbar23/alchemy-k8s/issues",
|
|
31
31
|
"keywords": [
|
|
32
32
|
"alchemy",
|
|
33
33
|
"docker",
|