@vibesdotdev/infra-doks 0.0.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 +107 -0
- package/SPEC.md +285 -0
- package/dist/client/digitalocean-app-deploy.client.d.ts +46 -0
- package/dist/client/digitalocean-app-deploy.client.d.ts.map +1 -0
- package/dist/client/digitalocean-app-deploy.client.js +135 -0
- package/dist/client/digitalocean-app-deploy.client.js.map +1 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +18 -0
- package/dist/client/index.js.map +1 -0
- package/dist/cloud/base.d.ts +33 -0
- package/dist/cloud/base.d.ts.map +1 -0
- package/dist/cloud/base.js +86 -0
- package/dist/cloud/base.js.map +1 -0
- package/dist/cloud/digitalocean.d.ts +33 -0
- package/dist/cloud/digitalocean.d.ts.map +1 -0
- package/dist/cloud/digitalocean.js +258 -0
- package/dist/cloud/digitalocean.js.map +1 -0
- package/dist/cloud/factory.d.ts +28 -0
- package/dist/cloud/factory.d.ts.map +1 -0
- package/dist/cloud/factory.js +151 -0
- package/dist/cloud/factory.js.map +1 -0
- package/dist/cloud/index.d.ts +12 -0
- package/dist/cloud/index.d.ts.map +1 -0
- package/dist/cloud/index.js +11 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/doks.plugin.d.ts +41 -0
- package/dist/doks.plugin.d.ts.map +1 -0
- package/dist/doks.plugin.js +287 -0
- package/dist/doks.plugin.js.map +1 -0
- package/dist/implementations/deployment.impl.d.ts +34 -0
- package/dist/implementations/deployment.impl.d.ts.map +1 -0
- package/dist/implementations/deployment.impl.js +86 -0
- package/dist/implementations/deployment.impl.js.map +1 -0
- package/dist/implementations/droplet.impl.d.ts +85 -0
- package/dist/implementations/droplet.impl.d.ts.map +1 -0
- package/dist/implementations/droplet.impl.js +113 -0
- package/dist/implementations/droplet.impl.js.map +1 -0
- package/dist/implementations/gitea.impl.d.ts +68 -0
- package/dist/implementations/gitea.impl.d.ts.map +1 -0
- package/dist/implementations/gitea.impl.js +295 -0
- package/dist/implementations/gitea.impl.js.map +1 -0
- package/dist/implementations/managed-db.impl.d.ts +25 -0
- package/dist/implementations/managed-db.impl.d.ts.map +1 -0
- package/dist/implementations/managed-db.impl.js +31 -0
- package/dist/implementations/managed-db.impl.js.map +1 -0
- package/dist/implementations/managed-redis.impl.d.ts +37 -0
- package/dist/implementations/managed-redis.impl.d.ts.map +1 -0
- package/dist/implementations/managed-redis.impl.js +40 -0
- package/dist/implementations/managed-redis.impl.js.map +1 -0
- package/dist/implementations/spaces.impl.d.ts +36 -0
- package/dist/implementations/spaces.impl.d.ts.map +1 -0
- package/dist/implementations/spaces.impl.js +40 -0
- package/dist/implementations/spaces.impl.js.map +1 -0
- package/dist/implementations/statefulset.impl.d.ts +65 -0
- package/dist/implementations/statefulset.impl.d.ts.map +1 -0
- package/dist/implementations/statefulset.impl.js +165 -0
- package/dist/implementations/statefulset.impl.js.map +1 -0
- package/dist/implementations/verdaccio.impl.d.ts +65 -0
- package/dist/implementations/verdaccio.impl.d.ts.map +1 -0
- package/dist/implementations/verdaccio.impl.js +259 -0
- package/dist/implementations/verdaccio.impl.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/kubernetes/index.d.ts +95 -0
- package/dist/kubernetes/index.d.ts.map +1 -0
- package/dist/kubernetes/index.js +625 -0
- package/dist/kubernetes/index.js.map +1 -0
- package/dist/secrets/index.d.ts +4 -0
- package/dist/secrets/index.d.ts.map +1 -0
- package/dist/secrets/index.js +4 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/vault.descriptor.d.ts +10 -0
- package/dist/secrets/vault.descriptor.d.ts.map +1 -0
- package/dist/secrets/vault.descriptor.js +25 -0
- package/dist/secrets/vault.descriptor.js.map +1 -0
- package/dist/secrets/vault.impl.cloud.d.ts +40 -0
- package/dist/secrets/vault.impl.cloud.d.ts.map +1 -0
- package/dist/secrets/vault.impl.cloud.js +178 -0
- package/dist/secrets/vault.impl.cloud.js.map +1 -0
- package/dist/secrets/vault.impl.d.ts +29 -0
- package/dist/secrets/vault.impl.d.ts.map +1 -0
- package/dist/secrets/vault.impl.js +137 -0
- package/dist/secrets/vault.impl.js.map +1 -0
- package/dist/types.d.ts +509 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +47 -0
- package/dist/types.js.map +1 -0
- package/package.json +145 -0
- package/src/client/digitalocean-app-deploy.client.ts +226 -0
- package/src/client/index.ts +24 -0
- package/src/cloud/base.ts +149 -0
- package/src/cloud/digitalocean.ts +363 -0
- package/src/cloud/factory.ts +190 -0
- package/src/cloud/index.ts +81 -0
- package/src/doks.plugin.ts +401 -0
- package/src/implementations/deployment.impl.ts +93 -0
- package/src/implementations/droplet.impl.ts +157 -0
- package/src/implementations/gitea.impl.ts +319 -0
- package/src/implementations/managed-db.impl.ts +37 -0
- package/src/implementations/managed-redis.impl.ts +49 -0
- package/src/implementations/spaces.impl.ts +52 -0
- package/src/implementations/statefulset.impl.ts +186 -0
- package/src/implementations/verdaccio.impl.ts +300 -0
- package/src/index.ts +136 -0
- package/src/kubernetes/index.ts +754 -0
- package/src/secrets/index.ts +9 -0
- package/src/secrets/vault.descriptor.ts +28 -0
- package/src/secrets/vault.impl.cloud.ts +278 -0
- package/src/secrets/vault.impl.ts +149 -0
- package/src/types.ts +563 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kubernetes manifest type definitions.
|
|
3
|
+
*
|
|
4
|
+
* These types represent the subset of K8s API objects used by DOKS infrastructure
|
|
5
|
+
* implementations. Each type produces a plain object serializable to YAML.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Shared
|
|
9
|
+
|
|
10
|
+
export interface K8sMetadata {
|
|
11
|
+
name?: string;
|
|
12
|
+
namespace?: string;
|
|
13
|
+
labels?: Record<string, string>;
|
|
14
|
+
annotations?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface K8sLabelSelector {
|
|
18
|
+
matchLabels: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Container & Pod
|
|
22
|
+
|
|
23
|
+
export interface K8sResourceQuantity {
|
|
24
|
+
cpu?: string;
|
|
25
|
+
memory?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface K8sResourceRequirements {
|
|
29
|
+
requests?: K8sResourceQuantity;
|
|
30
|
+
limits?: K8sResourceQuantity;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface K8sEnvFromSource {
|
|
34
|
+
configMapRef?: { name: string };
|
|
35
|
+
secretRef?: { name: string };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface K8sEnvVar {
|
|
39
|
+
name: string;
|
|
40
|
+
value?: string;
|
|
41
|
+
valueFrom?: {
|
|
42
|
+
secretKeyRef?: { name: string; key: string };
|
|
43
|
+
configMapKeyRef?: { name: string; key: string };
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface K8sProbe {
|
|
48
|
+
httpGet?: { path: string; port: number };
|
|
49
|
+
tcpSocket?: { port: number };
|
|
50
|
+
exec?: { command: string[] };
|
|
51
|
+
initialDelaySeconds?: number;
|
|
52
|
+
periodSeconds?: number;
|
|
53
|
+
timeoutSeconds?: number;
|
|
54
|
+
failureThreshold?: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface K8sContainerPort {
|
|
58
|
+
name?: string;
|
|
59
|
+
containerPort: number;
|
|
60
|
+
protocol?: 'TCP' | 'UDP';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface K8sVolumeMount {
|
|
64
|
+
name: string;
|
|
65
|
+
mountPath: string;
|
|
66
|
+
readOnly?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface K8sContainer {
|
|
70
|
+
name: string;
|
|
71
|
+
image: string;
|
|
72
|
+
command?: string[];
|
|
73
|
+
args?: string[];
|
|
74
|
+
ports?: K8sContainerPort[];
|
|
75
|
+
env?: K8sEnvVar[];
|
|
76
|
+
envFrom?: K8sEnvFromSource[];
|
|
77
|
+
resources?: K8sResourceRequirements;
|
|
78
|
+
volumeMounts?: K8sVolumeMount[];
|
|
79
|
+
livenessProbe?: K8sProbe;
|
|
80
|
+
readinessProbe?: K8sProbe;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface K8sConfigMapKeyToPath {
|
|
84
|
+
key: string;
|
|
85
|
+
path: string;
|
|
86
|
+
mode?: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface K8sVolume {
|
|
90
|
+
name: string;
|
|
91
|
+
emptyDir?: Record<string, never>;
|
|
92
|
+
configMap?: {
|
|
93
|
+
name: string;
|
|
94
|
+
items?: K8sConfigMapKeyToPath[];
|
|
95
|
+
defaultMode?: number;
|
|
96
|
+
optional?: boolean;
|
|
97
|
+
};
|
|
98
|
+
secret?: { secretName: string };
|
|
99
|
+
persistentVolumeClaim?: { claimName: string };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface K8sPodSpec {
|
|
103
|
+
containers: K8sContainer[];
|
|
104
|
+
initContainers?: K8sContainer[];
|
|
105
|
+
volumes?: K8sVolume[];
|
|
106
|
+
serviceAccountName?: string;
|
|
107
|
+
nodeSelector?: Record<string, string>;
|
|
108
|
+
tolerations?: Array<{
|
|
109
|
+
key?: string;
|
|
110
|
+
operator?: string;
|
|
111
|
+
value?: string;
|
|
112
|
+
effect?: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface K8sPodTemplateSpec {
|
|
117
|
+
metadata: K8sMetadata;
|
|
118
|
+
spec: K8sPodSpec;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Deployment
|
|
122
|
+
|
|
123
|
+
export interface K8sDeployment {
|
|
124
|
+
apiVersion: 'apps/v1';
|
|
125
|
+
kind: 'Deployment';
|
|
126
|
+
metadata: K8sMetadata;
|
|
127
|
+
spec: {
|
|
128
|
+
replicas: number;
|
|
129
|
+
selector: K8sLabelSelector;
|
|
130
|
+
template: K8sPodTemplateSpec;
|
|
131
|
+
strategy?: {
|
|
132
|
+
type: 'RollingUpdate' | 'Recreate';
|
|
133
|
+
rollingUpdate?: { maxSurge?: string | number; maxUnavailable?: string | number };
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// StatefulSet
|
|
139
|
+
|
|
140
|
+
export interface K8sPersistentVolumeClaimSpec {
|
|
141
|
+
accessModes: string[];
|
|
142
|
+
resources: { requests: { storage: string } };
|
|
143
|
+
storageClassName?: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface K8sVolumeClaimTemplate {
|
|
147
|
+
metadata: K8sMetadata;
|
|
148
|
+
spec: K8sPersistentVolumeClaimSpec;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface K8sStatefulSet {
|
|
152
|
+
apiVersion: 'apps/v1';
|
|
153
|
+
kind: 'StatefulSet';
|
|
154
|
+
metadata: K8sMetadata;
|
|
155
|
+
spec: {
|
|
156
|
+
serviceName: string;
|
|
157
|
+
replicas: number;
|
|
158
|
+
selector: K8sLabelSelector;
|
|
159
|
+
template: K8sPodTemplateSpec;
|
|
160
|
+
volumeClaimTemplates?: K8sVolumeClaimTemplate[];
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Service
|
|
165
|
+
|
|
166
|
+
export interface K8sServicePort {
|
|
167
|
+
name?: string;
|
|
168
|
+
port: number;
|
|
169
|
+
targetPort: number | string;
|
|
170
|
+
protocol?: 'TCP' | 'UDP';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface K8sService {
|
|
174
|
+
apiVersion: 'v1';
|
|
175
|
+
kind: 'Service';
|
|
176
|
+
metadata: K8sMetadata;
|
|
177
|
+
spec: {
|
|
178
|
+
type?: 'ClusterIP' | 'NodePort' | 'LoadBalancer' | 'ExternalName';
|
|
179
|
+
selector: Record<string, string>;
|
|
180
|
+
ports: K8sServicePort[];
|
|
181
|
+
clusterIP?: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ConfigMap
|
|
186
|
+
|
|
187
|
+
export interface K8sConfigMap {
|
|
188
|
+
apiVersion: 'v1';
|
|
189
|
+
kind: 'ConfigMap';
|
|
190
|
+
metadata: K8sMetadata;
|
|
191
|
+
data?: Record<string, string>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Secret
|
|
195
|
+
|
|
196
|
+
export interface K8sSecret {
|
|
197
|
+
apiVersion: 'v1';
|
|
198
|
+
kind: 'Secret';
|
|
199
|
+
metadata: K8sMetadata;
|
|
200
|
+
type?: string;
|
|
201
|
+
data?: Record<string, string>;
|
|
202
|
+
stringData?: Record<string, string>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// DigitalOcean Managed Service Specs
|
|
206
|
+
|
|
207
|
+
export interface DOManagedDBSpec {
|
|
208
|
+
name: string;
|
|
209
|
+
engine: string;
|
|
210
|
+
version: string;
|
|
211
|
+
size: string;
|
|
212
|
+
region: string;
|
|
213
|
+
num_nodes: number;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface DOManagedRedisSpec {
|
|
217
|
+
name: string;
|
|
218
|
+
engine: 'redis';
|
|
219
|
+
version: string;
|
|
220
|
+
size: string;
|
|
221
|
+
region: string;
|
|
222
|
+
num_nodes: number;
|
|
223
|
+
eviction_policy?: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface DOSpacesSpec {
|
|
227
|
+
name: string;
|
|
228
|
+
region: string;
|
|
229
|
+
acl: 'private' | 'public-read';
|
|
230
|
+
cors_rules?: Array<{
|
|
231
|
+
allowed_origins: string[];
|
|
232
|
+
allowed_methods: string[];
|
|
233
|
+
allowed_headers?: string[];
|
|
234
|
+
max_age_seconds?: number;
|
|
235
|
+
}>;
|
|
236
|
+
lifecycle_rules?: Array<{
|
|
237
|
+
prefix?: string;
|
|
238
|
+
expiration_days?: number;
|
|
239
|
+
}>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Cloud Provider Types (migrated from integrations/cloud)
|
|
243
|
+
|
|
244
|
+
export type InstanceStatus =
|
|
245
|
+
| 'pending'
|
|
246
|
+
| 'running'
|
|
247
|
+
| 'stopping'
|
|
248
|
+
| 'stopped'
|
|
249
|
+
| 'terminating'
|
|
250
|
+
| 'terminated'
|
|
251
|
+
| 'error';
|
|
252
|
+
|
|
253
|
+
export type VolumeStatus = 'creating' | 'available' | 'in-use' | 'deleting' | 'deleted' | 'error';
|
|
254
|
+
|
|
255
|
+
export interface CloudProvider {
|
|
256
|
+
name: string;
|
|
257
|
+
createInstance(config: InstanceConfig): Promise<CloudInstance>;
|
|
258
|
+
deleteInstance(instanceId: string): Promise<void>;
|
|
259
|
+
getInstance(instanceId: string): Promise<CloudInstance | null>;
|
|
260
|
+
listInstances(filters?: InstanceFilters): Promise<CloudInstance[]>;
|
|
261
|
+
createVolume(config: VolumeConfig): Promise<CloudVolume>;
|
|
262
|
+
attachVolume(volumeId: string, instanceId: string): Promise<void>;
|
|
263
|
+
detachVolume(volumeId: string): Promise<void>;
|
|
264
|
+
deleteVolume(volumeId: string): Promise<void>;
|
|
265
|
+
listVolumes(filters?: VolumeFilters): Promise<CloudVolume[]>;
|
|
266
|
+
getOrCreateVPC(name: string): Promise<string>;
|
|
267
|
+
addSSHKey(name: string, publicKey: string): Promise<string>;
|
|
268
|
+
listSSHKeys(): Promise<SSHKey[]>;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface InstanceConfig {
|
|
272
|
+
name: string;
|
|
273
|
+
type: string;
|
|
274
|
+
region: string;
|
|
275
|
+
image: string;
|
|
276
|
+
sshKeys?: string[];
|
|
277
|
+
vpcId?: string;
|
|
278
|
+
userData?: string;
|
|
279
|
+
tags: Record<string, string>;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface CloudInstance {
|
|
283
|
+
id: string;
|
|
284
|
+
name: string;
|
|
285
|
+
type: string;
|
|
286
|
+
region: string;
|
|
287
|
+
status: InstanceStatus;
|
|
288
|
+
publicIp?: string;
|
|
289
|
+
privateIp?: string;
|
|
290
|
+
createdAt: Date;
|
|
291
|
+
tags: Record<string, string>;
|
|
292
|
+
metadata?: Record<string, unknown>;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface InstanceFilters {
|
|
296
|
+
status?: InstanceStatus[];
|
|
297
|
+
tags?: Record<string, string>;
|
|
298
|
+
region?: string;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface VolumeConfig {
|
|
302
|
+
name: string;
|
|
303
|
+
size: number;
|
|
304
|
+
region: string;
|
|
305
|
+
tags?: Record<string, string>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface CloudVolume {
|
|
309
|
+
id: string;
|
|
310
|
+
name: string;
|
|
311
|
+
size: number;
|
|
312
|
+
region: string;
|
|
313
|
+
status: VolumeStatus;
|
|
314
|
+
attachedTo?: string;
|
|
315
|
+
createdAt: Date;
|
|
316
|
+
tags?: Record<string, string>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export interface VolumeFilters {
|
|
320
|
+
status?: VolumeStatus[];
|
|
321
|
+
region?: string;
|
|
322
|
+
attachedTo?: string;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface SSHKey {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
fingerprint: string;
|
|
329
|
+
publicKey: string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface CloudProviderConfig {
|
|
333
|
+
type: 'digitalocean' | 'aws' | 'gcp' | 'azure';
|
|
334
|
+
credentials: string;
|
|
335
|
+
region?: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export class CloudProviderError extends Error {
|
|
339
|
+
constructor(
|
|
340
|
+
message: string,
|
|
341
|
+
public code: string,
|
|
342
|
+
public provider: string,
|
|
343
|
+
public details?: unknown
|
|
344
|
+
) {
|
|
345
|
+
super(message);
|
|
346
|
+
this.name = 'CloudProviderError';
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Kubernetes Types (migrated from integrations/infrastructure/kubernetes)
|
|
351
|
+
|
|
352
|
+
export type PodPhase = 'Pending' | 'Running' | 'Succeeded' | 'Failed' | 'Unknown';
|
|
353
|
+
export type ConditionStatus = 'True' | 'False' | 'Unknown';
|
|
354
|
+
export type DeploymentConditionType = 'Available' | 'Progressing' | 'ReplicaFailure';
|
|
355
|
+
export type ServiceType = 'ClusterIP' | 'NodePort' | 'LoadBalancer' | 'ExternalName';
|
|
356
|
+
export type ServiceProtocol = 'TCP' | 'UDP' | 'SCTP';
|
|
357
|
+
export type EventType = 'Normal' | 'Warning';
|
|
358
|
+
export type ContainerState =
|
|
359
|
+
| { running?: { startedAt?: Date } }
|
|
360
|
+
| { terminated?: { exitCode?: number; reason?: string; message?: string; startedAt?: Date; finishedAt?: Date } }
|
|
361
|
+
| { waiting?: { reason?: string; message?: string } };
|
|
362
|
+
|
|
363
|
+
export interface K8sConfig {
|
|
364
|
+
inCluster?: boolean;
|
|
365
|
+
kubeconfig?: string;
|
|
366
|
+
context?: string;
|
|
367
|
+
namespace?: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface K8sEnvironment {
|
|
371
|
+
name: string;
|
|
372
|
+
context: string;
|
|
373
|
+
namespace: string;
|
|
374
|
+
apiServer?: string;
|
|
375
|
+
provider?: 'eks' | 'aks' | 'gke' | 'docker-desktop' | 'minikube' | 'other';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface PodSelector {
|
|
379
|
+
name?: string;
|
|
380
|
+
namespace?: string;
|
|
381
|
+
labels?: Record<string, string>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface PodStatus {
|
|
385
|
+
name: string;
|
|
386
|
+
namespace: string;
|
|
387
|
+
phase: PodPhase;
|
|
388
|
+
ready: boolean;
|
|
389
|
+
restarts: number;
|
|
390
|
+
age: string;
|
|
391
|
+
ip?: string;
|
|
392
|
+
node?: string;
|
|
393
|
+
conditions: Array<{
|
|
394
|
+
type: string;
|
|
395
|
+
status: ConditionStatus;
|
|
396
|
+
reason?: string;
|
|
397
|
+
message?: string;
|
|
398
|
+
lastTransitionTime: Date;
|
|
399
|
+
}>;
|
|
400
|
+
containers: Array<{
|
|
401
|
+
name: string;
|
|
402
|
+
ready: boolean;
|
|
403
|
+
restartCount: number;
|
|
404
|
+
state: ContainerState;
|
|
405
|
+
image: string;
|
|
406
|
+
imageID: string;
|
|
407
|
+
}>;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export interface LogOptions {
|
|
411
|
+
follow?: boolean;
|
|
412
|
+
tailLines?: number;
|
|
413
|
+
container?: string;
|
|
414
|
+
previous?: boolean;
|
|
415
|
+
sinceSeconds?: number;
|
|
416
|
+
limitBytes?: number;
|
|
417
|
+
timestamps?: boolean;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface LogEntry {
|
|
421
|
+
timestamp: Date;
|
|
422
|
+
pod: string;
|
|
423
|
+
namespace: string;
|
|
424
|
+
container: string;
|
|
425
|
+
message: string;
|
|
426
|
+
level?: string;
|
|
427
|
+
cluster?: string;
|
|
428
|
+
node?: string;
|
|
429
|
+
labels?: Record<string, string>;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export interface LogStream {
|
|
433
|
+
subscribe(callback: (log: LogEntry) => void): () => void;
|
|
434
|
+
pause(): void;
|
|
435
|
+
resume(): void;
|
|
436
|
+
close(): void;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export interface DeploymentStatus {
|
|
440
|
+
name: string;
|
|
441
|
+
namespace: string;
|
|
442
|
+
replicas: {
|
|
443
|
+
desired: number;
|
|
444
|
+
current: number;
|
|
445
|
+
available: number;
|
|
446
|
+
updated: number;
|
|
447
|
+
};
|
|
448
|
+
conditions: Array<{
|
|
449
|
+
type: DeploymentConditionType;
|
|
450
|
+
status: ConditionStatus;
|
|
451
|
+
reason?: string;
|
|
452
|
+
message?: string;
|
|
453
|
+
lastUpdateTime: Date;
|
|
454
|
+
lastTransitionTime: Date;
|
|
455
|
+
}>;
|
|
456
|
+
strategy: string;
|
|
457
|
+
minReadySeconds: number;
|
|
458
|
+
revisionHistoryLimit: number;
|
|
459
|
+
selector: Record<string, string>;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface ServiceInfo {
|
|
463
|
+
name: string;
|
|
464
|
+
namespace: string;
|
|
465
|
+
type: ServiceType;
|
|
466
|
+
clusterIP?: string;
|
|
467
|
+
externalIPs?: string[];
|
|
468
|
+
loadBalancerIP?: string;
|
|
469
|
+
ports: Array<{
|
|
470
|
+
name?: string;
|
|
471
|
+
protocol: ServiceProtocol;
|
|
472
|
+
port: number;
|
|
473
|
+
targetPort: number | string;
|
|
474
|
+
nodePort?: number;
|
|
475
|
+
}>;
|
|
476
|
+
selector: Record<string, string> | null;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export interface PodMetrics {
|
|
480
|
+
pod: string;
|
|
481
|
+
namespace: string;
|
|
482
|
+
containers: Record<string, ResourceMetrics>;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export interface ResourceMetrics {
|
|
486
|
+
cpu?: { usage: number };
|
|
487
|
+
memory?: { usage: number };
|
|
488
|
+
timestamp?: Date;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface K8sEvent {
|
|
492
|
+
type: EventType;
|
|
493
|
+
reason: string;
|
|
494
|
+
message: string;
|
|
495
|
+
source: {
|
|
496
|
+
component?: string;
|
|
497
|
+
host?: string;
|
|
498
|
+
};
|
|
499
|
+
firstTimestamp: Date;
|
|
500
|
+
lastTimestamp: Date;
|
|
501
|
+
count: number;
|
|
502
|
+
involvedObject: {
|
|
503
|
+
kind: string;
|
|
504
|
+
name: string;
|
|
505
|
+
namespace?: string;
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export interface ExecOptions {
|
|
510
|
+
pod: string;
|
|
511
|
+
container?: string;
|
|
512
|
+
command: string[];
|
|
513
|
+
namespace?: string;
|
|
514
|
+
tty?: boolean;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export interface ExecResult {
|
|
518
|
+
stdout: string;
|
|
519
|
+
stderr: string;
|
|
520
|
+
exitCode: number;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export interface PortForwardOptions {
|
|
524
|
+
pod: string;
|
|
525
|
+
remotePort: number;
|
|
526
|
+
localPort: number;
|
|
527
|
+
namespace?: string;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export interface PortForward {
|
|
531
|
+
localPort: number;
|
|
532
|
+
remotePort: number;
|
|
533
|
+
close(): void;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export class K8sError extends Error {
|
|
537
|
+
constructor(
|
|
538
|
+
message: string,
|
|
539
|
+
public statusCode?: number,
|
|
540
|
+
public reason?: string
|
|
541
|
+
) {
|
|
542
|
+
super(message);
|
|
543
|
+
this.name = 'K8sError';
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export class K8sAuthError extends K8sError {
|
|
548
|
+
constructor(message: string) {
|
|
549
|
+
super(message, 401, 'Unauthorized');
|
|
550
|
+
this.name = 'K8sAuthError';
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export class K8sNotFoundError extends K8sError {
|
|
555
|
+
constructor(
|
|
556
|
+
public kind: string,
|
|
557
|
+
public name: string,
|
|
558
|
+
public namespace?: string
|
|
559
|
+
) {
|
|
560
|
+
super(`${kind} '${name}' not found${namespace ? ` in namespace ${namespace}` : ''}`, 404, 'NotFound');
|
|
561
|
+
this.name = 'K8sNotFoundError';
|
|
562
|
+
}
|
|
563
|
+
}
|