@alchemy.run/kubernetes 2.0.0-beta.85 → 2.0.0-beta.86
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/lib/BuiltinAdapters.d.ts.map +1 -1
- package/lib/BuiltinAdapters.js.map +1 -1
- package/lib/Client.d.ts +7 -7
- package/lib/Client.d.ts.map +1 -1
- package/lib/Client.js.map +1 -1
- package/lib/ClusterAdapter.d.ts +3 -2
- package/lib/ClusterAdapter.d.ts.map +1 -1
- package/lib/ClusterAdapter.js.map +1 -1
- package/lib/Connection.d.ts.map +1 -1
- package/lib/Connection.js.map +1 -1
- package/lib/Deployment.d.ts +55 -2
- package/lib/Deployment.d.ts.map +1 -1
- package/lib/Deployment.js +45 -0
- package/lib/Deployment.js.map +1 -1
- package/lib/HelmChart.d.ts.map +1 -1
- package/lib/HelmChart.js.map +1 -1
- package/lib/Job.d.ts +42 -2
- package/lib/Job.d.ts.map +1 -1
- package/lib/Job.js +33 -0
- package/lib/Job.js.map +1 -1
- package/lib/LocalCluster.d.ts +22 -1
- package/lib/LocalCluster.d.ts.map +1 -1
- package/lib/LocalCluster.js +22 -0
- package/lib/LocalCluster.js.map +1 -1
- package/lib/Manifest.d.ts +33 -1
- package/lib/Manifest.d.ts.map +1 -1
- package/lib/Manifest.js +26 -0
- package/lib/Manifest.js.map +1 -1
- package/lib/Objects.d.ts.map +1 -1
- package/lib/Objects.js.map +1 -1
- package/lib/Providers.d.ts.map +1 -1
- package/lib/Providers.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internal/declared.d.ts.map +1 -1
- package/lib/internal/declared.js.map +1 -1
- package/lib/internal/helm.d.ts.map +1 -1
- package/lib/internal/helm.js.map +1 -1
- package/lib/internal/kind.d.ts.map +1 -1
- package/lib/internal/kind.js.map +1 -1
- package/lib/internal/kubeconfig.d.ts.map +1 -1
- package/lib/internal/kubeconfig.js +16 -7
- package/lib/internal/kubeconfig.js.map +1 -1
- package/lib/internal/registry.d.ts +1 -1
- package/lib/internal/registry.d.ts.map +1 -1
- package/lib/internal/registry.js.map +1 -1
- package/lib/internal/workload.d.ts.map +1 -1
- package/lib/internal/workload.js +4 -0
- package/lib/internal/workload.js.map +1 -1
- package/package.json +9 -9
- package/src/ClusterAdapter.ts +3 -2
- package/src/Deployment.ts +56 -2
- package/src/Job.ts +44 -2
- package/src/LocalCluster.ts +35 -1
- package/src/Manifest.ts +48 -2
- package/src/internal/kubeconfig.ts +16 -7
- package/src/internal/workload.ts +4 -0
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* path: AKS/GKE/EKS CLI-managed contexts work through their exec plugins
|
|
7
7
|
* (`kubelogin`, `gke-gcloud-auth-plugin`, `aws eks get-token`).
|
|
8
8
|
*/
|
|
9
|
+
import * as Clock from "effect/Clock";
|
|
9
10
|
import * as Config from "effect/Config";
|
|
10
11
|
import * as Data from "effect/Data";
|
|
12
|
+
import * as DateTime from "effect/DateTime";
|
|
11
13
|
import * as Effect from "effect/Effect";
|
|
12
14
|
import * as FileSystem from "effect/FileSystem";
|
|
15
|
+
import * as Option from "effect/Option";
|
|
13
16
|
import * as Path from "effect/Path";
|
|
14
17
|
import * as ChildProcess from "effect/process/ChildProcess";
|
|
15
18
|
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
|
|
@@ -76,6 +79,8 @@ const decodeBase64 = (value: string) => Buffer.from(value, "base64").toString("u
|
|
|
76
79
|
|
|
77
80
|
const expandHome = Effect.fn(function* (input: string) {
|
|
78
81
|
if (!input.startsWith("~")) return input;
|
|
82
|
+
// `~` is the user's real home directory, not a configured value.
|
|
83
|
+
// oxlint-disable-next-line effecttsgo/process-env-in-effect -- home expansion reads the real process env
|
|
79
84
|
const home = yield* Effect.sync(() => process.env.HOME ?? process.env.USERPROFILE);
|
|
80
85
|
if (!home) {
|
|
81
86
|
return yield* new KubeConfigError({
|
|
@@ -199,7 +204,7 @@ export const runExecCredential = Effect.fn(function* (options: {
|
|
|
199
204
|
}) {
|
|
200
205
|
const cacheKey = JSON.stringify([options.command, options.args ?? [], options.env ?? {}]);
|
|
201
206
|
const cached = execCache.get(cacheKey);
|
|
202
|
-
const now = yield*
|
|
207
|
+
const now = yield* Clock.currentTimeMillis;
|
|
203
208
|
if (cached && cached.expiresAt > now) {
|
|
204
209
|
return cached.credentials;
|
|
205
210
|
}
|
|
@@ -270,12 +275,16 @@ export const runExecCredential = Effect.fn(function* (options: {
|
|
|
270
275
|
: undefined,
|
|
271
276
|
};
|
|
272
277
|
|
|
273
|
-
const
|
|
274
|
-
?
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
const declaredExpiry = status.expirationTimestamp
|
|
279
|
+
? DateTime.make(status.expirationTimestamp)
|
|
280
|
+
: Option.none();
|
|
281
|
+
const expiresAt = Option.match(declaredExpiry, {
|
|
282
|
+
// Re-mint 30s before the declared expiry.
|
|
283
|
+
onSome: (expiry) => DateTime.toEpochMillis(expiry) - 30_000,
|
|
284
|
+
// No (valid) declared expiry: cache briefly so bursts of requests share
|
|
285
|
+
// one plugin invocation without holding a stale credential for long.
|
|
286
|
+
onNone: () => now + 60_000,
|
|
287
|
+
});
|
|
279
288
|
execCache.set(cacheKey, { credentials, expiresAt });
|
|
280
289
|
|
|
281
290
|
return credentials;
|
package/src/internal/workload.ts
CHANGED
|
@@ -344,6 +344,7 @@ import * as Context from "effect/Context";
|
|
|
344
344
|
import * as Config from "effect/Config";
|
|
345
345
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
346
346
|
import * as Effect from "effect/Effect";
|
|
347
|
+
import * as SecureRandom from "effect/crypto/SecureRandom";
|
|
347
348
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
348
349
|
import * as Layer from "effect/Layer";
|
|
349
350
|
import * as Logger from "effect/Logger";
|
|
@@ -361,6 +362,7 @@ const layer = makeEntrypointLayer(tag, entrypoint);
|
|
|
361
362
|
const platform = Layer.mergeAll(
|
|
362
363
|
BunServices.layer,
|
|
363
364
|
FetchHttpClient.layer,
|
|
365
|
+
SecureRandom.layerWebCrypto,
|
|
364
366
|
Logger.layer([Logger.consolePretty()]),
|
|
365
367
|
);
|
|
366
368
|
|
|
@@ -434,6 +436,7 @@ import * as Context from "effect/Context";
|
|
|
434
436
|
import * as Config from "effect/Config";
|
|
435
437
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
436
438
|
import * as Effect from "effect/Effect";
|
|
439
|
+
import * as SecureRandom from "effect/crypto/SecureRandom";
|
|
437
440
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
438
441
|
import * as Layer from "effect/Layer";
|
|
439
442
|
import * as Logger from "effect/Logger";
|
|
@@ -447,6 +450,7 @@ const layer = makeEntrypointLayer(tag, entrypoint);
|
|
|
447
450
|
const platform = Layer.mergeAll(
|
|
448
451
|
BunServices.layer,
|
|
449
452
|
FetchHttpClient.layer,
|
|
453
|
+
SecureRandom.layerWebCrypto,
|
|
450
454
|
Logger.layer([Logger.consolePretty()]),
|
|
451
455
|
);
|
|
452
456
|
|