@skaile/provider-k8s 0.0.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/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/README.md +64 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +190 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Skaile
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @skaile/provider-k8s
|
|
2
|
+
|
|
3
|
+
A [Kubernetes](https://kubernetes.io/) deploy target for
|
|
4
|
+
[`@skaile/workspaces`](https://www.npmjs.com/package/@skaile/workspaces). v0.1.0
|
|
5
|
+
stands a workspace up as a Pod behind a ClusterIP Service and reaches it over a
|
|
6
|
+
local `kubectl port-forward` tunnel.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
skaile plugin install @skaile/provider-k8s
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The `@kubernetes/client-node` SDK is an **optional peer dependency** — install it
|
|
15
|
+
in your project so the provider can lazy-load it at runtime:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @kubernetes/client-node
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Add it to `skaile.yaml`:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
plugins:
|
|
25
|
+
- "@skaile/provider-k8s@^0.1.0"
|
|
26
|
+
|
|
27
|
+
deploy:
|
|
28
|
+
target: k8s
|
|
29
|
+
config:
|
|
30
|
+
namespace: default
|
|
31
|
+
image: ghcr.io/me/workspace:1
|
|
32
|
+
port: 8080
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Config
|
|
36
|
+
|
|
37
|
+
| Field | Type | Default | Notes |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| `namespace` | string | `default` | Target namespace |
|
|
40
|
+
| `image` | string | — | Workspace image (required — bring-your-own) |
|
|
41
|
+
| `port` | number | `8080` | Container + service port |
|
|
42
|
+
| `serviceAccount` | string | — | Pod service account |
|
|
43
|
+
| `env` | record | `{}` | Extra container env |
|
|
44
|
+
| `serviceType` | `ClusterIP` | `ClusterIP` | Only ClusterIP in v0.1.0 |
|
|
45
|
+
| `localForwardPort` | number | — | Local port for the forward tunnel |
|
|
46
|
+
| `buildStrategy` | `local \| remote \| managed` | `local` | k8s is bring-your-own-image |
|
|
47
|
+
|
|
48
|
+
## How it works
|
|
49
|
+
|
|
50
|
+
- `@kubernetes/client-node` is lazy-loaded via a dynamic `import()` inside
|
|
51
|
+
`create()`/`restore()`, so this package builds and typechecks without the SDK
|
|
52
|
+
installed (offline-safe).
|
|
53
|
+
- Creates a Pod + ClusterIP Service, waits for the Pod to reach `Running`, and
|
|
54
|
+
exposes `ws://127.0.0.1:<localForwardPort|port>` via a port-forward tunnel.
|
|
55
|
+
- `tlsTermination: "edge"` (TLS terminates at the cluster ingress; the
|
|
56
|
+
port-forward tunnel is loopback-only on the operator's machine).
|
|
57
|
+
|
|
58
|
+
## Limitations (v0.1.0)
|
|
59
|
+
|
|
60
|
+
- ClusterIP + port-forward only. NodePort / LoadBalancer / Ingress are future
|
|
61
|
+
work (they add ingress class, annotations, and TLS cert source knobs).
|
|
62
|
+
- Bring-your-own-image: in-cluster builds are not performed.
|
|
63
|
+
- Requires `@kubernetes/client-node` and a working kubeconfig in the host
|
|
64
|
+
environment at runtime.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { DeployTarget, PluginRegistry } from '@skaile/workspaces/plugin-registry';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Minimal local interface for `@kubernetes/client-node` — only the members this
|
|
6
|
+
* provider actually calls.
|
|
7
|
+
*
|
|
8
|
+
* The SDK is an *optional* peer dependency, lazy-loaded via a string-literal
|
|
9
|
+
* dynamic `import()`. Typing against this minimal surface (rather than the real
|
|
10
|
+
* package's types) keeps the package building + typechecking standalone
|
|
11
|
+
* offline; the host project supplies the real SDK at runtime.
|
|
12
|
+
*/
|
|
13
|
+
/** A `V1Pod`-ish object (subset we read). */
|
|
14
|
+
interface K8sPod {
|
|
15
|
+
metadata?: {
|
|
16
|
+
name?: string;
|
|
17
|
+
namespace?: string;
|
|
18
|
+
};
|
|
19
|
+
status?: {
|
|
20
|
+
phase?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** A `V1Service`-ish object (subset we read). */
|
|
24
|
+
interface K8sService {
|
|
25
|
+
metadata?: {
|
|
26
|
+
name?: string;
|
|
27
|
+
namespace?: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** `CoreV1Api` subset. */
|
|
31
|
+
interface CoreV1Api {
|
|
32
|
+
createNamespacedPod(arg: {
|
|
33
|
+
namespace: string;
|
|
34
|
+
body: unknown;
|
|
35
|
+
}): Promise<K8sPod>;
|
|
36
|
+
readNamespacedPod(arg: {
|
|
37
|
+
name: string;
|
|
38
|
+
namespace: string;
|
|
39
|
+
}): Promise<K8sPod>;
|
|
40
|
+
deleteNamespacedPod(arg: {
|
|
41
|
+
name: string;
|
|
42
|
+
namespace: string;
|
|
43
|
+
}): Promise<unknown>;
|
|
44
|
+
createNamespacedService(arg: {
|
|
45
|
+
namespace: string;
|
|
46
|
+
body: unknown;
|
|
47
|
+
}): Promise<K8sService>;
|
|
48
|
+
deleteNamespacedService(arg: {
|
|
49
|
+
name: string;
|
|
50
|
+
namespace: string;
|
|
51
|
+
}): Promise<unknown>;
|
|
52
|
+
}
|
|
53
|
+
/** `KubeConfig` subset. */
|
|
54
|
+
interface KubeConfig {
|
|
55
|
+
loadFromDefault(): void;
|
|
56
|
+
makeApiClient(api: any): CoreV1Api;
|
|
57
|
+
}
|
|
58
|
+
/** The `@kubernetes/client-node` module surface we depend on. */
|
|
59
|
+
interface K8sModule {
|
|
60
|
+
KubeConfig: new () => KubeConfig;
|
|
61
|
+
CoreV1Api: unknown;
|
|
62
|
+
}
|
|
63
|
+
/** Loader seam: returns the SDK module. Default does a real dynamic import. */
|
|
64
|
+
type SdkLoader = () => Promise<K8sModule>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `k8sDeployTarget` — deploy a workspace as a Pod + ClusterIP Service in
|
|
68
|
+
* Kubernetes, reached via `kubectl port-forward`. `tlsTermination: "edge"`
|
|
69
|
+
* (TLS terminates at the cluster ingress; v0.1.0 reaches the service over a
|
|
70
|
+
* local port-forward tunnel).
|
|
71
|
+
*
|
|
72
|
+
* `buildStrategy` defaults to `local` — k8s is bring-your-own-image, so the
|
|
73
|
+
* operator supplies `config.image`. `@kubernetes/client-node` is an *optional*
|
|
74
|
+
* peer, lazy-loaded inside `create()`/`restore()` via an injectable loader so
|
|
75
|
+
* the package builds standalone and the test stays hermetic.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
declare const k8sConfigSchema: z.ZodObject<{
|
|
79
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
80
|
+
image: z.ZodString;
|
|
81
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
82
|
+
serviceAccount: z.ZodOptional<z.ZodString>;
|
|
83
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
84
|
+
serviceType: z.ZodDefault<z.ZodLiteral<"ClusterIP">>;
|
|
85
|
+
localForwardPort: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
buildStrategy: z.ZodDefault<z.ZodEnum<{
|
|
87
|
+
local: "local";
|
|
88
|
+
remote: "remote";
|
|
89
|
+
managed: "managed";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
type K8sConfig = z.infer<typeof k8sConfigSchema>;
|
|
93
|
+
declare const k8sPayloadSchema: z.ZodObject<{
|
|
94
|
+
namespace: z.ZodString;
|
|
95
|
+
podName: z.ZodString;
|
|
96
|
+
serviceName: z.ZodString;
|
|
97
|
+
localForwardPort: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
type K8sPayload = z.infer<typeof k8sPayloadSchema>;
|
|
100
|
+
/** Injectable seams so tests never load the real `@kubernetes/client-node`. */
|
|
101
|
+
interface K8sTargetOptions {
|
|
102
|
+
loadSdk?: SdkLoader;
|
|
103
|
+
pollIntervalMs?: number;
|
|
104
|
+
}
|
|
105
|
+
/** Build the Kubernetes deploy target with optional injected seams. */
|
|
106
|
+
declare function makeK8sDeployTarget(opts?: K8sTargetOptions): DeployTarget<K8sConfig, K8sPayload>;
|
|
107
|
+
/** Default Kubernetes deploy target registered by `register()`. */
|
|
108
|
+
declare const k8sDeployTarget: DeployTarget<{
|
|
109
|
+
namespace: string;
|
|
110
|
+
image: string;
|
|
111
|
+
port: number;
|
|
112
|
+
env: Record<string, string>;
|
|
113
|
+
serviceType: "ClusterIP";
|
|
114
|
+
buildStrategy: "local" | "remote" | "managed";
|
|
115
|
+
serviceAccount?: string | undefined;
|
|
116
|
+
localForwardPort?: number | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
namespace: string;
|
|
119
|
+
podName: string;
|
|
120
|
+
serviceName: string;
|
|
121
|
+
localForwardPort?: number | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* `@skaile/provider-k8s` — Kubernetes deploy target for `@skaile/workspaces`.
|
|
126
|
+
*
|
|
127
|
+
* v0.1.0 ships ClusterIP + port-forward only. Requires the optional peer
|
|
128
|
+
* `@kubernetes/client-node` to be installed in the host project (lazy-loaded at
|
|
129
|
+
* runtime). Install via `skaile plugin install @skaile/provider-k8s`.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
/** Register this plugin's deploy target with a registry. */
|
|
133
|
+
declare function register(registry: PluginRegistry): void;
|
|
134
|
+
|
|
135
|
+
export { type CoreV1Api, type K8sModule, type K8sTargetOptions, type KubeConfig, type SdkLoader, k8sDeployTarget, makeK8sDeployTarget, register };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// src/target.ts
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
|
|
4
|
+
// src/sdk-types.ts
|
|
5
|
+
var defaultSdkLoader = async () => {
|
|
6
|
+
const mod = await import("@kubernetes/client-node");
|
|
7
|
+
if (!mod?.KubeConfig) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"@kubernetes/client-node is not installed. Run `skaile plugin install @skaile/provider-k8s` and add @kubernetes/client-node to your project."
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
return mod;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/target.ts
|
|
16
|
+
var k8sConfigSchema = z.object({
|
|
17
|
+
namespace: z.string().default("default"),
|
|
18
|
+
image: z.string().min(1),
|
|
19
|
+
port: z.number().int().positive().default(8080),
|
|
20
|
+
serviceAccount: z.string().optional(),
|
|
21
|
+
env: z.record(z.string(), z.string()).default({}),
|
|
22
|
+
// v0.1.0 ships ClusterIP + port-forward only; NodePort/LoadBalancer/Ingress
|
|
23
|
+
// are documented as future work.
|
|
24
|
+
serviceType: z.literal("ClusterIP").default("ClusterIP"),
|
|
25
|
+
localForwardPort: z.number().int().positive().optional(),
|
|
26
|
+
buildStrategy: z.enum(["local", "remote", "managed"]).default("local")
|
|
27
|
+
}).strict();
|
|
28
|
+
var k8sPayloadSchema = z.object({
|
|
29
|
+
namespace: z.string(),
|
|
30
|
+
podName: z.string(),
|
|
31
|
+
serviceName: z.string(),
|
|
32
|
+
localForwardPort: z.number().optional()
|
|
33
|
+
});
|
|
34
|
+
var DEFAULT_READY_TIMEOUT_MS = 12e4;
|
|
35
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
36
|
+
async function sleep(ms, signal) {
|
|
37
|
+
return await new Promise((resolve, reject) => {
|
|
38
|
+
const timer = setTimeout(() => {
|
|
39
|
+
signal.removeEventListener("abort", onAbort);
|
|
40
|
+
resolve();
|
|
41
|
+
}, ms);
|
|
42
|
+
const onAbort = () => {
|
|
43
|
+
clearTimeout(timer);
|
|
44
|
+
reject(new Error("aborted while polling pod phase"));
|
|
45
|
+
};
|
|
46
|
+
if (signal.aborted) onAbort();
|
|
47
|
+
else signal.addEventListener("abort", onAbort);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function makeApi(loadSdk) {
|
|
51
|
+
const k8s = await loadSdk();
|
|
52
|
+
const kc = new k8s.KubeConfig();
|
|
53
|
+
kc.loadFromDefault();
|
|
54
|
+
return kc.makeApiClient(k8s.CoreV1Api);
|
|
55
|
+
}
|
|
56
|
+
function buildHandle(api, payload, config, ctx, ready, initialState) {
|
|
57
|
+
let state = initialState;
|
|
58
|
+
const forwardPort = payload.localForwardPort ?? config.port;
|
|
59
|
+
return {
|
|
60
|
+
// Reached over a local port-forward tunnel to the ClusterIP service.
|
|
61
|
+
wsUrl: `ws://127.0.0.1:${forwardPort}`,
|
|
62
|
+
wsAuth: ctx.wsAuth ? "<redacted>" : void 0,
|
|
63
|
+
get state() {
|
|
64
|
+
return state;
|
|
65
|
+
},
|
|
66
|
+
payload,
|
|
67
|
+
async waitReady(timeoutMs) {
|
|
68
|
+
try {
|
|
69
|
+
await ready();
|
|
70
|
+
state = "ready";
|
|
71
|
+
} catch (err) {
|
|
72
|
+
state = "errored";
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
void timeoutMs;
|
|
76
|
+
},
|
|
77
|
+
async health() {
|
|
78
|
+
try {
|
|
79
|
+
const pod = await api.readNamespacedPod({
|
|
80
|
+
name: payload.podName,
|
|
81
|
+
namespace: payload.namespace
|
|
82
|
+
});
|
|
83
|
+
const healthy = pod.status?.phase === "Running";
|
|
84
|
+
return healthy ? { healthy } : { healthy, detail: `pod ${payload.podName} phase=${pod.status?.phase ?? "unknown"}` };
|
|
85
|
+
} catch (err) {
|
|
86
|
+
return { healthy: false, detail: err.message };
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async stop() {
|
|
90
|
+
state = "stopping";
|
|
91
|
+
await api.deleteNamespacedService({ name: payload.serviceName, namespace: payload.namespace }).catch(() => {
|
|
92
|
+
});
|
|
93
|
+
await api.deleteNamespacedPod({ name: payload.podName, namespace: payload.namespace }).catch(() => {
|
|
94
|
+
});
|
|
95
|
+
state = "stopped";
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function makeK8sDeployTarget(opts = {}) {
|
|
100
|
+
const loadSdk = opts.loadSdk ?? defaultSdkLoader;
|
|
101
|
+
const pollIntervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
102
|
+
return {
|
|
103
|
+
id: "k8s",
|
|
104
|
+
displayName: "Kubernetes (ClusterIP + port-forward)",
|
|
105
|
+
apiVersion: 1,
|
|
106
|
+
tlsTermination: "edge",
|
|
107
|
+
configSchema: k8sConfigSchema,
|
|
108
|
+
payloadSchema: k8sPayloadSchema,
|
|
109
|
+
async create(config, ctx) {
|
|
110
|
+
const api = await makeApi(loadSdk);
|
|
111
|
+
const podName = `skaile-ws-${ctx.workspaceId}`;
|
|
112
|
+
const serviceName = `skaile-ws-${ctx.workspaceId}-svc`;
|
|
113
|
+
const image = config.image ?? ctx.imageRef;
|
|
114
|
+
if (!image) throw new Error("k8s deploy requires an image (buildStrategy is local)");
|
|
115
|
+
const podBody = {
|
|
116
|
+
metadata: { name: podName, namespace: config.namespace, labels: { app: podName } },
|
|
117
|
+
spec: {
|
|
118
|
+
serviceAccountName: config.serviceAccount,
|
|
119
|
+
containers: [
|
|
120
|
+
{
|
|
121
|
+
name: "workspace",
|
|
122
|
+
image,
|
|
123
|
+
ports: [{ containerPort: config.port }],
|
|
124
|
+
env: Object.entries({ ...config.env, ...ctx.env }).map(([name, value]) => ({
|
|
125
|
+
name,
|
|
126
|
+
value
|
|
127
|
+
}))
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
await api.createNamespacedPod({ namespace: config.namespace, body: podBody });
|
|
133
|
+
const serviceBody = {
|
|
134
|
+
metadata: { name: serviceName, namespace: config.namespace },
|
|
135
|
+
spec: {
|
|
136
|
+
type: config.serviceType,
|
|
137
|
+
selector: { app: podName },
|
|
138
|
+
ports: [{ port: config.port, targetPort: config.port }]
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
await api.createNamespacedService({ namespace: config.namespace, body: serviceBody });
|
|
142
|
+
ctx.log.info("k8s pod + service created", { podName, serviceName });
|
|
143
|
+
const payload = {
|
|
144
|
+
namespace: config.namespace,
|
|
145
|
+
podName,
|
|
146
|
+
serviceName,
|
|
147
|
+
localForwardPort: config.localForwardPort
|
|
148
|
+
};
|
|
149
|
+
const ready = async () => {
|
|
150
|
+
const deadline = Date.now() + DEFAULT_READY_TIMEOUT_MS;
|
|
151
|
+
for (; ; ) {
|
|
152
|
+
const pod = await api.readNamespacedPod({ name: podName, namespace: config.namespace });
|
|
153
|
+
if (pod.status?.phase === "Running") return;
|
|
154
|
+
if (Date.now() > deadline) {
|
|
155
|
+
throw new Error(`timed out waiting for pod ${podName} to reach Running`);
|
|
156
|
+
}
|
|
157
|
+
await sleep(pollIntervalMs, ctx.signal);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
return buildHandle(api, payload, config, ctx, ready, "starting");
|
|
161
|
+
},
|
|
162
|
+
async restore(payload, ctx) {
|
|
163
|
+
const api = await makeApi(loadSdk);
|
|
164
|
+
const pod = await api.readNamespacedPod({
|
|
165
|
+
name: payload.podName,
|
|
166
|
+
namespace: payload.namespace
|
|
167
|
+
});
|
|
168
|
+
if (pod.status?.phase !== "Running") {
|
|
169
|
+
throw new Error(
|
|
170
|
+
`k8s pod ${payload.podName} is not running (phase=${pod.status?.phase ?? "unknown"})`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
ctx.log.info("re-attached to k8s pod", { podName: payload.podName });
|
|
174
|
+
return buildHandle(api, payload, { port: 8080 }, ctx, async () => {
|
|
175
|
+
}, "ready");
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
var k8sDeployTarget = makeK8sDeployTarget();
|
|
180
|
+
|
|
181
|
+
// src/index.ts
|
|
182
|
+
function register(registry) {
|
|
183
|
+
registry.register("deployTarget", k8sDeployTarget);
|
|
184
|
+
}
|
|
185
|
+
export {
|
|
186
|
+
k8sDeployTarget,
|
|
187
|
+
makeK8sDeployTarget,
|
|
188
|
+
register
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/target.ts","../src/sdk-types.ts","../src/index.ts"],"sourcesContent":["/**\n * `k8sDeployTarget` — deploy a workspace as a Pod + ClusterIP Service in\n * Kubernetes, reached via `kubectl port-forward`. `tlsTermination: \"edge\"`\n * (TLS terminates at the cluster ingress; v0.1.0 reaches the service over a\n * local port-forward tunnel).\n *\n * `buildStrategy` defaults to `local` — k8s is bring-your-own-image, so the\n * operator supplies `config.image`. `@kubernetes/client-node` is an *optional*\n * peer, lazy-loaded inside `create()`/`restore()` via an injectable loader so\n * the package builds standalone and the test stays hermetic.\n */\n\nimport type { DeployContext, DeployHandle, DeployTarget } from \"@skaile/workspaces/plugin-registry\";\nimport * as z from \"zod\";\nimport { type CoreV1Api, defaultSdkLoader, type SdkLoader } from \"./sdk-types.js\";\n\nconst k8sConfigSchema = z\n .object({\n namespace: z.string().default(\"default\"),\n image: z.string().min(1),\n port: z.number().int().positive().default(8080),\n serviceAccount: z.string().optional(),\n env: z.record(z.string(), z.string()).default({}),\n // v0.1.0 ships ClusterIP + port-forward only; NodePort/LoadBalancer/Ingress\n // are documented as future work.\n serviceType: z.literal(\"ClusterIP\").default(\"ClusterIP\"),\n localForwardPort: z.number().int().positive().optional(),\n buildStrategy: z.enum([\"local\", \"remote\", \"managed\"]).default(\"local\"),\n })\n .strict();\n\ntype K8sConfig = z.infer<typeof k8sConfigSchema>;\n\nconst k8sPayloadSchema = z.object({\n namespace: z.string(),\n podName: z.string(),\n serviceName: z.string(),\n localForwardPort: z.number().optional(),\n});\n\ntype K8sPayload = z.infer<typeof k8sPayloadSchema>;\n\nconst DEFAULT_READY_TIMEOUT_MS = 120_000;\nconst DEFAULT_POLL_INTERVAL_MS = 1_000;\n\n/** Injectable seams so tests never load the real `@kubernetes/client-node`. */\nexport interface K8sTargetOptions {\n loadSdk?: SdkLoader;\n pollIntervalMs?: number;\n}\n\nasync function sleep(ms: number, signal: AbortSignal): Promise<void> {\n return await new Promise<void>((resolve, reject) => {\n const timer = setTimeout(() => {\n signal.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n const onAbort = () => {\n clearTimeout(timer);\n reject(new Error(\"aborted while polling pod phase\"));\n };\n if (signal.aborted) onAbort();\n else signal.addEventListener(\"abort\", onAbort);\n });\n}\n\nasync function makeApi(loadSdk: SdkLoader): Promise<CoreV1Api> {\n const k8s = await loadSdk();\n const kc = new k8s.KubeConfig();\n kc.loadFromDefault();\n return kc.makeApiClient(k8s.CoreV1Api);\n}\n\nfunction buildHandle(\n api: CoreV1Api,\n payload: K8sPayload,\n config: Pick<K8sConfig, \"port\">,\n ctx: DeployContext,\n ready: () => Promise<void>,\n initialState: DeployHandle[\"state\"],\n): DeployHandle<K8sPayload> {\n let state: DeployHandle[\"state\"] = initialState;\n const forwardPort = payload.localForwardPort ?? config.port;\n return {\n // Reached over a local port-forward tunnel to the ClusterIP service.\n wsUrl: `ws://127.0.0.1:${forwardPort}`,\n wsAuth: ctx.wsAuth ? \"<redacted>\" : undefined,\n get state() {\n return state;\n },\n payload,\n async waitReady(timeoutMs?: number) {\n try {\n await ready();\n state = \"ready\";\n } catch (err) {\n state = \"errored\";\n throw err;\n }\n void timeoutMs;\n },\n async health() {\n try {\n const pod = await api.readNamespacedPod({\n name: payload.podName,\n namespace: payload.namespace,\n });\n const healthy = pod.status?.phase === \"Running\";\n return healthy\n ? { healthy }\n : { healthy, detail: `pod ${payload.podName} phase=${pod.status?.phase ?? \"unknown\"}` };\n } catch (err) {\n return { healthy: false, detail: (err as Error).message };\n }\n },\n async stop() {\n state = \"stopping\";\n // Idempotent teardown: ignore 404s when the objects are already gone.\n await api\n .deleteNamespacedService({ name: payload.serviceName, namespace: payload.namespace })\n .catch(() => {});\n await api\n .deleteNamespacedPod({ name: payload.podName, namespace: payload.namespace })\n .catch(() => {});\n state = \"stopped\";\n },\n };\n}\n\n/** Build the Kubernetes deploy target with optional injected seams. */\nexport function makeK8sDeployTarget(\n opts: K8sTargetOptions = {},\n): DeployTarget<K8sConfig, K8sPayload> {\n const loadSdk = opts.loadSdk ?? defaultSdkLoader;\n const pollIntervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n\n return {\n id: \"k8s\",\n displayName: \"Kubernetes (ClusterIP + port-forward)\",\n apiVersion: 1,\n tlsTermination: \"edge\",\n configSchema: k8sConfigSchema as unknown as z.ZodType<K8sConfig>,\n payloadSchema: k8sPayloadSchema,\n\n async create(config, ctx) {\n const api = await makeApi(loadSdk);\n const podName = `skaile-ws-${ctx.workspaceId}`;\n const serviceName = `skaile-ws-${ctx.workspaceId}-svc`;\n const image = config.image ?? ctx.imageRef;\n if (!image) throw new Error(\"k8s deploy requires an image (buildStrategy is local)\");\n\n const podBody = {\n metadata: { name: podName, namespace: config.namespace, labels: { app: podName } },\n spec: {\n serviceAccountName: config.serviceAccount,\n containers: [\n {\n name: \"workspace\",\n image,\n ports: [{ containerPort: config.port }],\n env: Object.entries({ ...config.env, ...ctx.env }).map(([name, value]) => ({\n name,\n value,\n })),\n },\n ],\n },\n };\n await api.createNamespacedPod({ namespace: config.namespace, body: podBody });\n\n const serviceBody = {\n metadata: { name: serviceName, namespace: config.namespace },\n spec: {\n type: config.serviceType,\n selector: { app: podName },\n ports: [{ port: config.port, targetPort: config.port }],\n },\n };\n await api.createNamespacedService({ namespace: config.namespace, body: serviceBody });\n ctx.log.info(\"k8s pod + service created\", { podName, serviceName });\n\n const payload: K8sPayload = {\n namespace: config.namespace,\n podName,\n serviceName,\n localForwardPort: config.localForwardPort,\n };\n const ready = async () => {\n const deadline = Date.now() + DEFAULT_READY_TIMEOUT_MS;\n for (;;) {\n const pod = await api.readNamespacedPod({ name: podName, namespace: config.namespace });\n if (pod.status?.phase === \"Running\") return;\n if (Date.now() > deadline) {\n throw new Error(`timed out waiting for pod ${podName} to reach Running`);\n }\n await sleep(pollIntervalMs, ctx.signal);\n }\n };\n return buildHandle(api, payload, config, ctx, ready, \"starting\");\n },\n\n async restore(payload, ctx) {\n const api = await makeApi(loadSdk);\n const pod = await api.readNamespacedPod({\n name: payload.podName,\n namespace: payload.namespace,\n });\n if (pod.status?.phase !== \"Running\") {\n throw new Error(\n `k8s pod ${payload.podName} is not running (phase=${pod.status?.phase ?? \"unknown\"})`,\n );\n }\n ctx.log.info(\"re-attached to k8s pod\", { podName: payload.podName });\n return buildHandle(api, payload, { port: 8080 }, ctx, async () => {}, \"ready\");\n },\n };\n}\n\n/** Default Kubernetes deploy target registered by `register()`. */\nexport const k8sDeployTarget = makeK8sDeployTarget();\n","/**\n * Minimal local interface for `@kubernetes/client-node` — only the members this\n * provider actually calls.\n *\n * The SDK is an *optional* peer dependency, lazy-loaded via a string-literal\n * dynamic `import()`. Typing against this minimal surface (rather than the real\n * package's types) keeps the package building + typechecking standalone\n * offline; the host project supplies the real SDK at runtime.\n */\n\n/** A `V1Pod`-ish object (subset we read). */\nexport interface K8sPod {\n metadata?: { name?: string; namespace?: string };\n status?: { phase?: string };\n}\n\n/** A `V1Service`-ish object (subset we read). */\nexport interface K8sService {\n metadata?: { name?: string; namespace?: string };\n}\n\n/** `CoreV1Api` subset. */\nexport interface CoreV1Api {\n createNamespacedPod(arg: { namespace: string; body: unknown }): Promise<K8sPod>;\n readNamespacedPod(arg: { name: string; namespace: string }): Promise<K8sPod>;\n deleteNamespacedPod(arg: { name: string; namespace: string }): Promise<unknown>;\n createNamespacedService(arg: { namespace: string; body: unknown }): Promise<K8sService>;\n deleteNamespacedService(arg: { name: string; namespace: string }): Promise<unknown>;\n}\n\n/** `KubeConfig` subset. */\nexport interface KubeConfig {\n loadFromDefault(): void;\n // biome-ignore lint/suspicious/noExplicitAny: api ctor passed through opaquely\n makeApiClient(api: any): CoreV1Api;\n}\n\n/** The `@kubernetes/client-node` module surface we depend on. */\nexport interface K8sModule {\n KubeConfig: new () => KubeConfig;\n CoreV1Api: unknown;\n}\n\n/** Loader seam: returns the SDK module. Default does a real dynamic import. */\nexport type SdkLoader = () => Promise<K8sModule>;\n\n/**\n * Default loader: lazy `import(\"@kubernetes/client-node\")`. The string literal\n * keeps bundlers from eagerly resolving the optional peer; only evaluated when\n * `create()`/`restore()` run.\n */\nexport const defaultSdkLoader: SdkLoader = async () => {\n const mod = (await import(\"@kubernetes/client-node\" as string)) as unknown as K8sModule;\n if (!mod?.KubeConfig) {\n throw new Error(\n \"@kubernetes/client-node is not installed. Run `skaile plugin install @skaile/provider-k8s` and add @kubernetes/client-node to your project.\",\n );\n }\n return mod;\n};\n","/**\n * `@skaile/provider-k8s` — Kubernetes deploy target for `@skaile/workspaces`.\n *\n * v0.1.0 ships ClusterIP + port-forward only. Requires the optional peer\n * `@kubernetes/client-node` to be installed in the host project (lazy-loaded at\n * runtime). Install via `skaile plugin install @skaile/provider-k8s`.\n */\n\nimport type { PluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport { k8sDeployTarget } from \"./target.js\";\n\nexport { k8sDeployTarget, makeK8sDeployTarget } from \"./target.js\";\nexport type { K8sTargetOptions } from \"./target.js\";\nexport type { CoreV1Api, K8sModule, KubeConfig, SdkLoader } from \"./sdk-types.js\";\n\n/** Register this plugin's deploy target with a registry. */\nexport function register(registry: PluginRegistry): void {\n registry.register(\"deployTarget\", k8sDeployTarget);\n}\n"],"mappings":";AAaA,YAAY,OAAO;;;ACsCZ,IAAM,mBAA8B,YAAY;AACrD,QAAM,MAAO,MAAM,OAAO,yBAAmC;AAC7D,MAAI,CAAC,KAAK,YAAY;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;AD3CA,IAAM,kBACH,SAAO;AAAA,EACN,WAAa,SAAO,EAAE,QAAQ,SAAS;AAAA,EACvC,OAAS,SAAO,EAAE,IAAI,CAAC;AAAA,EACvB,MAAQ,SAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,IAAI;AAAA,EAC9C,gBAAkB,SAAO,EAAE,SAAS;AAAA,EACpC,KAAO,SAAS,SAAO,GAAK,SAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA;AAAA;AAAA,EAGhD,aAAe,UAAQ,WAAW,EAAE,QAAQ,WAAW;AAAA,EACvD,kBAAoB,SAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,eAAiB,OAAK,CAAC,SAAS,UAAU,SAAS,CAAC,EAAE,QAAQ,OAAO;AACvE,CAAC,EACA,OAAO;AAIV,IAAM,mBAAqB,SAAO;AAAA,EAChC,WAAa,SAAO;AAAA,EACpB,SAAW,SAAO;AAAA,EAClB,aAAe,SAAO;AAAA,EACtB,kBAAoB,SAAO,EAAE,SAAS;AACxC,CAAC;AAID,IAAM,2BAA2B;AACjC,IAAM,2BAA2B;AAQjC,eAAe,MAAM,IAAY,QAAoC;AACnE,SAAO,MAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAClD,UAAM,Q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Q,SAAS,SAAS;AAAA,QACpF;AAAA,MACF;AACA,UAAI,IAAI,KAAK,0BAA0B,EAAE,SAAS,QAAQ,QAAQ,CAAC;AACnE,aAAO,YAAY,KAAK,SAAS,EAAE,MAAM,KAAK,GAAG,KAAK,YAAY;AAAA,MAAC,GAAG,OAAO;AAAA,IAC/E;AAAA,EACF;AACF;AAGO,IAAM,kBAAkB,oBAAoB;;;AE3M5C,SAAS,SAAS,UAAgC;AACvD,WAAS,SAAS,gBAAgB,eAAe;AACnD;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skaile/provider-k8s",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Kubernetes (ClusterIP + port-forward) deploy target for @skaile/workspaces",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"CHANGELOG.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@skaile/workspaces": ">=0.22.0-0",
|
|
26
|
+
"@kubernetes/client-node": ">=0.20.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"@kubernetes/client-node": {
|
|
30
|
+
"optional": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@skaile/workspaces": "0.21.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"test:watch": "vitest",
|
|
41
|
+
"format": "biome format --write .",
|
|
42
|
+
"lint": "biome lint .",
|
|
43
|
+
"check": "biome check ."
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/skaile-ai/workspaces.git",
|
|
51
|
+
"directory": "packages/provider-k8s"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/skaile-ai/workspaces/tree/main/packages/provider-k8s#readme",
|
|
54
|
+
"bugs": "https://github.com/skaile-ai/workspaces/issues",
|
|
55
|
+
"license": "Apache-2.0",
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"zod": "^4.4.0"
|
|
58
|
+
}
|
|
59
|
+
}
|