k8ts 0.4.19 → 0.4.21
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/dist/file/exports.d.ts +4 -5
- package/dist/file/exports.d.ts.map +1 -1
- package/dist/file/exports.js +1 -0
- package/dist/file/exports.js.map +1 -1
- package/dist/file/factory.d.ts +1 -2
- package/dist/file/factory.d.ts.map +1 -1
- package/dist/file/factory.js +6 -4
- package/dist/file/factory.js.map +1 -1
- package/dist/file/file.d.ts +6 -7
- package/dist/file/file.d.ts.map +1 -1
- package/dist/file/file.js.map +1 -1
- package/dist/file/origin.d.ts +3 -3
- package/dist/file/origin.d.ts.map +1 -1
- package/dist/file/origin.js.map +1 -1
- package/dist/kind-map.d.ts +4 -3
- package/dist/kind-map.d.ts.map +1 -1
- package/dist/kind-map.js +2 -1
- package/dist/kind-map.js.map +1 -1
- package/dist/kinds.d.ts +91 -0
- package/dist/kinds.d.ts.map +1 -0
- package/dist/kinds.js +71 -0
- package/dist/kinds.js.map +1 -0
- package/dist/node/abs-resource.d.ts +6 -6
- package/dist/node/abs-resource.d.ts.map +1 -1
- package/dist/node/abs-resource.js.map +1 -1
- package/dist/node/equiv-cdk8s.d.ts +4 -5
- package/dist/node/equiv-cdk8s.d.ts.map +1 -1
- package/dist/node/equiv-cdk8s.js.map +1 -1
- package/dist/node/manifest-resource.d.ts +4 -0
- package/dist/node/manifest-resource.d.ts.map +1 -1
- package/dist/node/manifest-resource.js.map +1 -1
- package/dist/node/sub-resource.d.ts +2 -2
- package/dist/node/sub-resource.d.ts.map +1 -1
- package/dist/node/sub-resource.js.map +1 -1
- package/dist/resources/configmap/configmap.d.ts.map +1 -1
- package/dist/resources/configmap/configmap.js +3 -4
- package/dist/resources/configmap/configmap.js.map +1 -1
- package/dist/resources/deployment/deployment.d.ts +6 -1
- package/dist/resources/deployment/deployment.d.ts.map +1 -1
- package/dist/resources/deployment/deployment.js +4 -4
- package/dist/resources/deployment/deployment.js.map +1 -1
- package/dist/resources/http-route/http-route.d.ts +4 -5
- package/dist/resources/http-route/http-route.d.ts.map +1 -1
- package/dist/resources/http-route/http-route.js +3 -5
- package/dist/resources/http-route/http-route.js.map +1 -1
- package/dist/resources/namespace/namespace.d.ts.map +1 -1
- package/dist/resources/namespace/namespace.js +3 -4
- package/dist/resources/namespace/namespace.js.map +1 -1
- package/dist/resources/persistent/claim/pvc.d.ts +3 -2
- package/dist/resources/persistent/claim/pvc.d.ts.map +1 -1
- package/dist/resources/persistent/claim/pvc.js +7 -5
- package/dist/resources/persistent/claim/pvc.js.map +1 -1
- package/dist/resources/persistent/volume/pv.d.ts +10 -7
- package/dist/resources/persistent/volume/pv.d.ts.map +1 -1
- package/dist/resources/persistent/volume/pv.js +4 -3
- package/dist/resources/persistent/volume/pv.js.map +1 -1
- package/dist/resources/pod/container/container.d.ts +15 -11
- package/dist/resources/pod/container/container.d.ts.map +1 -1
- package/dist/resources/pod/container/container.js +10 -8
- package/dist/resources/pod/container/container.js.map +1 -1
- package/dist/resources/pod/container/mounts.d.ts +14 -9
- package/dist/resources/pod/container/mounts.d.ts.map +1 -1
- package/dist/resources/pod/container/mounts.js +14 -13
- package/dist/resources/pod/container/mounts.js.map +1 -1
- package/dist/resources/pod/pod-template.d.ts +29 -14
- package/dist/resources/pod/pod-template.d.ts.map +1 -1
- package/dist/resources/pod/pod-template.js +10 -7
- package/dist/resources/pod/pod-template.js.map +1 -1
- package/dist/resources/pod/volume/devices.d.ts +1 -1
- package/dist/resources/pod/volume/devices.d.ts.map +1 -1
- package/dist/resources/pod/volume/devices.js +7 -5
- package/dist/resources/pod/volume/devices.js.map +1 -1
- package/dist/resources/pod/volume/volumes.d.ts +2 -2
- package/dist/resources/pod/volume/volumes.d.ts.map +1 -1
- package/dist/resources/pod/volume/volumes.js +8 -5
- package/dist/resources/pod/volume/volumes.js.map +1 -1
- package/dist/resources/secret/secret.d.ts +1 -1
- package/dist/resources/secret/secret.d.ts.map +1 -1
- package/dist/resources/secret/secret.js +3 -4
- package/dist/resources/secret/secret.js.map +1 -1
- package/dist/resources/service/service-port.d.ts +6 -6
- package/dist/resources/service/service-port.d.ts.map +1 -1
- package/dist/resources/service/service-port.js +10 -8
- package/dist/resources/service/service-port.js.map +1 -1
- package/dist/resources/service/service.d.ts +12 -6
- package/dist/resources/service/service.d.ts.map +1 -1
- package/dist/resources/service/service.js +14 -8
- package/dist/resources/service/service.js.map +1 -1
- package/dist/resources/utils/adapters.d.ts.map +1 -1
- package/dist/resources/utils/adapters.js +3 -1
- package/dist/resources/utils/adapters.js.map +1 -1
- package/dist/runner/exporter/serializer.js +1 -1
- package/dist/runner/exporter/serializer.js.map +1 -1
- package/dist/src.tsbuildinfo +1 -1
- package/dist/world/world.d.ts +2 -3
- package/dist/world/world.d.ts.map +1 -1
- package/dist/world/world.js.map +1 -1
- package/package.json +11 -10
- package/src/file/exports.ts +6 -5
- package/src/file/factory.ts +25 -19
- package/src/file/file.ts +6 -7
- package/src/file/origin.ts +3 -3
- package/src/kind-map.ts +6 -3
- package/src/kinds.ts +127 -0
- package/src/node/abs-resource.ts +7 -6
- package/src/node/equiv-cdk8s.ts +4 -5
- package/src/node/manifest-resource.ts +4 -0
- package/src/node/sub-resource.ts +2 -2
- package/src/resources/configmap/configmap.ts +3 -4
- package/src/resources/deployment/deployment.ts +9 -5
- package/src/resources/http-route/http-route.ts +4 -6
- package/src/resources/namespace/namespace.ts +3 -4
- package/src/resources/persistent/claim/pvc.ts +9 -6
- package/src/resources/persistent/volume/pv.ts +8 -7
- package/src/resources/pod/container/container.ts +21 -12
- package/src/resources/pod/container/mounts.ts +20 -15
- package/src/resources/pod/pod-template.ts +30 -20
- package/src/resources/pod/volume/devices.ts +7 -4
- package/src/resources/pod/volume/volumes.ts +10 -5
- package/src/resources/secret/secret.ts +3 -4
- package/src/resources/service/service-port.ts +12 -8
- package/src/resources/service/service.ts +30 -20
- package/src/resources/utils/adapters.ts +3 -1
- package/src/runner/exporter/serializer.ts +1 -1
- package/src/world/world.ts +4 -5
- package/dist/api-versions.d.ts +0 -5
- package/dist/api-versions.d.ts.map +0 -1
- package/dist/api-versions.js +0 -8
- package/dist/api-versions.js.map +0 -1
- package/src/api-versions.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "k8ts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.21",
|
|
4
4
|
"description": "Powerful framwork for building Kubernetes manifests in TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kubernetes",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"default": "./dist/index.js",
|
|
35
35
|
"types": "./dist/index.d.ts"
|
|
36
36
|
},
|
|
37
|
-
"./
|
|
38
|
-
"require": "./dist/
|
|
39
|
-
"import": "./dist/
|
|
40
|
-
"default": "./dist/
|
|
41
|
-
"types": "./dist/
|
|
37
|
+
"./kinds": {
|
|
38
|
+
"require": "./dist/kinds.js",
|
|
39
|
+
"import": "./dist/kinds.js",
|
|
40
|
+
"default": "./dist/kinds.js",
|
|
41
|
+
"types": "./dist/kinds.d.ts"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"main": "dist/index.js",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"doddle": "^5.0.0-beta.16",
|
|
68
68
|
"emittery": "0.13.1",
|
|
69
69
|
"immutable": "^5.0.3",
|
|
70
|
+
"ip-address": "^10.0.1",
|
|
70
71
|
"js-yaml": "^4.1.0",
|
|
71
72
|
"lodash": "^4.17.21",
|
|
72
73
|
"ora": "5.4.1",
|
|
@@ -76,8 +77,8 @@
|
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@datreeio/datree-cdk8s": "^1.3.5",
|
|
79
|
-
"@k8ts/instruments": "^0.4.
|
|
80
|
-
"@k8ts/metadata": "^0.4.
|
|
80
|
+
"@k8ts/instruments": "^0.4.7",
|
|
81
|
+
"@k8ts/metadata": "^0.4.6",
|
|
81
82
|
"@swc/core": "^1.11.11",
|
|
82
83
|
"@swc/jest": "^0.2.37",
|
|
83
84
|
"@types/chalk": "^2.2.4",
|
|
@@ -97,8 +98,8 @@
|
|
|
97
98
|
"yamprint": "^0.8.4"
|
|
98
99
|
},
|
|
99
100
|
"peerDependencies": {
|
|
100
|
-
"@k8ts/instruments": "^0.4.
|
|
101
|
-
"@k8ts/metadata": "^0.4.
|
|
101
|
+
"@k8ts/instruments": "^0.4.7",
|
|
102
|
+
"@k8ts/metadata": "^0.4.6"
|
|
102
103
|
},
|
|
103
104
|
"packageManager": "yarn@4.1.1",
|
|
104
105
|
"engines": {
|
package/src/file/exports.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FutureExports, Producer } from "@k8ts/instruments"
|
|
1
|
+
import { FutureExports, LiveRefable, Producer } from "@k8ts/instruments"
|
|
2
2
|
import { seq, type Seq } from "doddle"
|
|
3
|
-
import
|
|
3
|
+
import { ManifestResource } from "../node"
|
|
4
4
|
import { k8ts_namespace } from "../runner/exporter/meta"
|
|
5
5
|
import { Factory } from "./factory"
|
|
6
6
|
import type { FileOrigin } from "./origin"
|
|
@@ -12,7 +12,7 @@ export namespace FileExports {
|
|
|
12
12
|
> = Producer.Producer<Factory.FromScope<Scope>, Produced>
|
|
13
13
|
export interface Props<
|
|
14
14
|
Scope extends FileOrigin.Scope = FileOrigin.Scope,
|
|
15
|
-
Produced extends
|
|
15
|
+
Produced extends LiveRefable = LiveRefable
|
|
16
16
|
> {
|
|
17
17
|
origin: FileOrigin<Scope>
|
|
18
18
|
FILE: Producer<Scope, Produced>
|
|
@@ -20,7 +20,7 @@ export namespace FileExports {
|
|
|
20
20
|
|
|
21
21
|
export class Core {
|
|
22
22
|
#props: Props
|
|
23
|
-
#produced: Seq<
|
|
23
|
+
#produced: Seq<LiveRefable>
|
|
24
24
|
constructor(props: Props) {
|
|
25
25
|
this.#props = props
|
|
26
26
|
const producer = Producer.map(props.FILE, () => {
|
|
@@ -31,6 +31,7 @@ export namespace FileExports {
|
|
|
31
31
|
}
|
|
32
32
|
})
|
|
33
33
|
this.#produced = seq(() => producer(props.origin))
|
|
34
|
+
.as<ManifestResource>()
|
|
34
35
|
.each(x => {
|
|
35
36
|
x.meta.add(k8ts_namespace, {
|
|
36
37
|
"#is-exported": "true"
|
|
@@ -52,7 +53,7 @@ export namespace FileExports {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
export function make<Scope extends FileOrigin.Scope, Produced extends
|
|
56
|
+
export function make<Scope extends FileOrigin.Scope, Produced extends LiveRefable>(
|
|
56
57
|
props: Props<Scope, Produced>
|
|
57
58
|
): Core & FutureExports<Produced> {
|
|
58
59
|
const core = new Core(props as any)
|
package/src/file/factory.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Origin,
|
|
3
|
+
Trace,
|
|
4
|
+
TraceEmbedder,
|
|
5
|
+
auto_register,
|
|
6
|
+
displayers,
|
|
7
|
+
type LiveRefable
|
|
8
|
+
} from "@k8ts/instruments"
|
|
2
9
|
import chalk from "chalk"
|
|
10
|
+
import StackTracey from "stacktracey"
|
|
3
11
|
import {
|
|
4
12
|
ConfigMap,
|
|
5
13
|
DataMode,
|
|
@@ -87,37 +95,35 @@ export namespace Factory {
|
|
|
87
95
|
props: Service.Props<DeployPorts, ExposedPorts>
|
|
88
96
|
) {
|
|
89
97
|
return new Service.Service(this.origin, this._metaWithName(name), props) as LiveRefable<
|
|
90
|
-
Service<
|
|
98
|
+
Service<ExposedPorts>,
|
|
91
99
|
Name
|
|
92
100
|
>
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
private PrvDeployment<Name extends string, Ports extends string = never>(
|
|
96
|
-
name: Name,
|
|
97
|
-
props: Deployment.Props<Ports>
|
|
98
|
-
) {
|
|
99
|
-
return new Deployment.Deployment(
|
|
100
|
-
this.origin,
|
|
101
|
-
this._metaWithName(name),
|
|
102
|
-
props
|
|
103
|
-
) as LiveRefable<Deployment<Ports>, Name>
|
|
104
|
-
}
|
|
105
|
-
|
|
106
103
|
Deployment<Name extends string>(name: Name, props: Deployment.SmallerProps) {
|
|
107
104
|
const builder = this
|
|
105
|
+
const traceHere = new Trace(new StackTracey().slice(2))
|
|
106
|
+
|
|
108
107
|
return {
|
|
109
108
|
Template(templateProps?: PodTemplate.PodProps) {
|
|
110
109
|
return {
|
|
111
110
|
POD<Ports extends string>(
|
|
112
111
|
producer: PodTemplate.PodContainerProducer<Ports>
|
|
113
112
|
) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
const dep = new Deployment.Deployment(
|
|
114
|
+
builder.origin,
|
|
115
|
+
builder._metaWithName(name),
|
|
116
|
+
{
|
|
117
|
+
...props,
|
|
118
|
+
template: {
|
|
119
|
+
...templateProps,
|
|
120
|
+
POD: producer
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
|
-
|
|
123
|
+
) as LiveRefable<Deployment<Ports>, Name>
|
|
124
|
+
TraceEmbedder.set(dep.node, traceHere)
|
|
125
|
+
dep.node.origin["__attach_resource__"]([dep.node])
|
|
126
|
+
return dep
|
|
121
127
|
}
|
|
122
128
|
}
|
|
123
129
|
}
|
package/src/file/file.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { FutureExports, Origin } from "@k8ts/instruments"
|
|
2
|
-
import type { ManifestResource } from "../node"
|
|
1
|
+
import type { FutureExports, LiveRefable, Origin } from "@k8ts/instruments"
|
|
3
2
|
import { FileExports as Exports_ } from "./exports"
|
|
4
3
|
import { Factory as Factory_ } from "./factory"
|
|
5
4
|
import { FileOrigin } from "./origin"
|
|
6
|
-
export type File<T extends
|
|
5
|
+
export type File<T extends LiveRefable = LiveRefable> = File.File<T>
|
|
7
6
|
export namespace File {
|
|
8
7
|
export import Factory = Factory_
|
|
9
8
|
|
|
@@ -11,15 +10,15 @@ export namespace File {
|
|
|
11
10
|
|
|
12
11
|
export interface Props<
|
|
13
12
|
Scope extends FileOrigin.Scope = FileOrigin.Scope,
|
|
14
|
-
Produced extends
|
|
13
|
+
Produced extends LiveRefable = LiveRefable
|
|
15
14
|
> extends FileOrigin.Props<Scope> {
|
|
16
15
|
FILE: Exports.Producer<Scope, Produced>
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
export type Input = Exports.Core & Iterable<
|
|
20
|
-
export type File<T extends
|
|
18
|
+
export type Input = Exports.Core & Iterable<LiveRefable>
|
|
19
|
+
export type File<T extends LiveRefable> = Exports.Core & FutureExports<T>
|
|
21
20
|
|
|
22
|
-
export function make<Scope extends FileOrigin.Scope, Produced extends
|
|
21
|
+
export function make<Scope extends FileOrigin.Scope, Produced extends LiveRefable>(
|
|
23
22
|
name: string,
|
|
24
23
|
props: Props<Scope, Produced>,
|
|
25
24
|
parent: Origin
|
package/src/file/origin.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { BaseOriginEntity, Origin, OriginEntityProps } from "@k8ts/instruments"
|
|
1
|
+
import { BaseOriginEntity, Origin, OriginEntityProps, Refable } from "@k8ts/instruments"
|
|
2
2
|
import { Meta } from "@k8ts/metadata"
|
|
3
3
|
import { k8tsBuildKind } from "../k8ts-sys-kind"
|
|
4
|
-
import
|
|
4
|
+
import { api } from "../kinds"
|
|
5
5
|
export type FileOrigin<FScope extends FileOrigin.Scope = FileOrigin.Scope> =
|
|
6
6
|
FileOrigin.FileEntity<FScope>
|
|
7
7
|
export namespace FileOrigin {
|
|
8
|
-
export type Scope = Namespace | "cluster"
|
|
8
|
+
export type Scope = Refable<api.v1_.Namespace> | "cluster"
|
|
9
9
|
|
|
10
10
|
export interface SmallerProps extends OriginEntityProps {
|
|
11
11
|
meta?: Meta.Input
|
package/src/kind-map.ts
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
BaseOriginEntity,
|
|
3
3
|
Kind,
|
|
4
4
|
kinded,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
OriginEntityProps,
|
|
6
|
+
ResourceEntity
|
|
7
7
|
} from "@k8ts/instruments"
|
|
8
8
|
import { k8tsBuildKind } from "./k8ts-sys-kind"
|
|
9
9
|
const ident = k8tsBuildKind.kind("World")
|
|
@@ -23,7 +23,9 @@ class K8tsRootOriginEntity extends BaseOriginEntity<OriginEntityProps> {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
get decorator() {
|
|
26
|
-
return <Target extends new (...args: any[]) =>
|
|
26
|
+
return <Target extends abstract new (...args: any[]) => ResourceEntity>(
|
|
27
|
+
kind: Kind.Identifier
|
|
28
|
+
) => {
|
|
27
29
|
return (ctor: Target) => {
|
|
28
30
|
this.node.resourceKinds.add(kind, ctor)
|
|
29
31
|
kinded(kind)(ctor)
|
|
@@ -37,3 +39,4 @@ export const K8tsRootOrigin = new K8tsRootOriginEntity()
|
|
|
37
39
|
export const K8tsResources = K8tsRootOrigin.node.resourceKinds
|
|
38
40
|
|
|
39
41
|
export const k8ts = K8tsRootOrigin.decorator
|
|
42
|
+
export const REF_TYPE = Symbol.for("k8ts:ref")
|
package/src/kinds.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Kind } from "@k8ts/instruments"
|
|
2
|
+
export namespace api {
|
|
3
|
+
export const v1 = Kind.version("v1")
|
|
4
|
+
export type v1 = typeof v1
|
|
5
|
+
|
|
6
|
+
export namespace v1_ {
|
|
7
|
+
export function kind_<Name extends string>(name: Name): Kind<Name, typeof v1> {
|
|
8
|
+
return v1.kind(name)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ConfigMap = v1.kind("ConfigMap")
|
|
12
|
+
export type ConfigMap = typeof ConfigMap
|
|
13
|
+
|
|
14
|
+
export const Secret = v1.kind("Secret")
|
|
15
|
+
export type Secret = typeof Secret
|
|
16
|
+
|
|
17
|
+
export const Service = v1.kind("Service")
|
|
18
|
+
export type Service = typeof Service
|
|
19
|
+
|
|
20
|
+
export const Pod = v1.kind("Pod")
|
|
21
|
+
export type Pod = typeof Pod
|
|
22
|
+
|
|
23
|
+
export namespace Pod_ {
|
|
24
|
+
export const Container = Pod.subkind("Container")
|
|
25
|
+
export type Container = typeof Container
|
|
26
|
+
|
|
27
|
+
export const Port = Container.subkind("Port")
|
|
28
|
+
export type Port = typeof Port
|
|
29
|
+
|
|
30
|
+
export const EnvVar = Container.subkind("EnvVar")
|
|
31
|
+
export type EnvVar = typeof EnvVar
|
|
32
|
+
|
|
33
|
+
export const VolumeMount = Container.subkind("VolumeMount")
|
|
34
|
+
export type VolumeMount = typeof VolumeMount
|
|
35
|
+
|
|
36
|
+
export const DeviceMount = Container.subkind("DeviceMount")
|
|
37
|
+
export type DeviceMount = typeof DeviceMount
|
|
38
|
+
|
|
39
|
+
export const Volume = Pod.subkind("Volume")
|
|
40
|
+
export type Volume = typeof Volume
|
|
41
|
+
|
|
42
|
+
export const Device = Volume.subkind("Device")
|
|
43
|
+
export type Device = typeof Device
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const Node = v1.kind("Node")
|
|
47
|
+
export type Node = typeof Node
|
|
48
|
+
|
|
49
|
+
export const Namespace = v1.kind("Namespace")
|
|
50
|
+
export type Namespace = typeof Namespace
|
|
51
|
+
|
|
52
|
+
export const ServiceAccount = v1.kind("ServiceAccount")
|
|
53
|
+
export type ServiceAccount = typeof ServiceAccount
|
|
54
|
+
|
|
55
|
+
export const PersistentVolume = v1.kind("PersistentVolume")
|
|
56
|
+
export type PersistentVolume = typeof PersistentVolume
|
|
57
|
+
|
|
58
|
+
export const PersistentVolumeClaim = v1.kind("PersistentVolumeClaim")
|
|
59
|
+
export type PersistentVolumeClaim = typeof PersistentVolumeClaim
|
|
60
|
+
|
|
61
|
+
export const PodTemplate = v1.kind("PodTemplate")
|
|
62
|
+
export type PodTemplate = typeof PodTemplate
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const apps = Kind.group("apps")
|
|
66
|
+
export type apps = typeof apps
|
|
67
|
+
|
|
68
|
+
export namespace apps_ {
|
|
69
|
+
export const v1 = apps.version("v1")
|
|
70
|
+
export type v1 = typeof v1
|
|
71
|
+
|
|
72
|
+
export namespace v1_ {
|
|
73
|
+
export const Deployment = v1.kind("Deployment")
|
|
74
|
+
export type Deployment = typeof Deployment
|
|
75
|
+
|
|
76
|
+
export const StatefulSet = v1.kind("StatefulSet")
|
|
77
|
+
export type StatefulSet = typeof StatefulSet
|
|
78
|
+
|
|
79
|
+
export const DaemonSet = v1.kind("DaemonSet")
|
|
80
|
+
export type DaemonSet = typeof DaemonSet
|
|
81
|
+
|
|
82
|
+
export const ReplicaSet = v1.kind("ReplicaSet")
|
|
83
|
+
export type ReplicaSet = typeof ReplicaSet
|
|
84
|
+
|
|
85
|
+
export const ControllerRevision = v1.kind("ControllerRevision")
|
|
86
|
+
export type ControllerRevision = typeof ControllerRevision
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const networking = Kind.group("networking.k8s.io")
|
|
91
|
+
export type networking = typeof networking
|
|
92
|
+
|
|
93
|
+
export namespace networking_ {
|
|
94
|
+
export const v1 = networking.version("v1")
|
|
95
|
+
export type v1 = typeof v1
|
|
96
|
+
|
|
97
|
+
export namespace v1_ {
|
|
98
|
+
export const NetworkPolicy = v1.kind("NetworkPolicy")
|
|
99
|
+
export type NetworkPolicy = typeof NetworkPolicy
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const gateway = Kind.group("gateway.networking.k8s.io")
|
|
104
|
+
export type gateway = typeof gateway
|
|
105
|
+
|
|
106
|
+
export namespace gateway_ {
|
|
107
|
+
export const v1 = gateway.version("v1")
|
|
108
|
+
export type v1 = typeof v1
|
|
109
|
+
|
|
110
|
+
export namespace v1_ {
|
|
111
|
+
export const Gateway = v1.kind("Gateway")
|
|
112
|
+
export type Gateway = typeof Gateway
|
|
113
|
+
|
|
114
|
+
export const GatewayClass = v1.kind("GatewayClass")
|
|
115
|
+
export type GatewayClass = typeof GatewayClass
|
|
116
|
+
|
|
117
|
+
export const HttpRoute = v1.kind("HTTPRoute")
|
|
118
|
+
export type HttpRoute = typeof HttpRoute
|
|
119
|
+
|
|
120
|
+
export const TcpRoute = v1.kind("TCPRoute")
|
|
121
|
+
export type TcpRoute = typeof TcpRoute
|
|
122
|
+
|
|
123
|
+
export const TlsRoute = v1.kind("TLSRoute")
|
|
124
|
+
export type TlsRoute = typeof TlsRoute
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
package/src/node/abs-resource.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { displayers, Kind, Origin, RefKey, ResourceNode } from "@k8ts/instruments"
|
|
1
|
+
import { displayers, Kind, Origin, RefKey, ResourceEntity, ResourceNode } from "@k8ts/instruments"
|
|
2
2
|
import { Doddle, doddle } from "doddle"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
export interface ResourceIdentBlock {
|
|
5
|
+
kind: Kind.IdentParent
|
|
6
|
+
name: string
|
|
6
7
|
}
|
|
7
8
|
@displayers({
|
|
8
9
|
simple: s => s.node,
|
|
9
10
|
pretty: s => s.node
|
|
10
11
|
})
|
|
11
|
-
export abstract class AbsResource<Props extends object = object> {
|
|
12
|
+
export abstract class AbsResource<Props extends object = object> implements ResourceEntity {
|
|
12
13
|
abstract readonly kind: Kind.Identifier<string, Kind.Identifier>
|
|
13
14
|
|
|
14
15
|
private _node: Doddle<ResourceNode>
|
|
@@ -16,7 +17,7 @@ export abstract class AbsResource<Props extends object = object> {
|
|
|
16
17
|
get node() {
|
|
17
18
|
return this._node.pull()
|
|
18
19
|
}
|
|
19
|
-
constructor(
|
|
20
|
+
protected constructor(
|
|
20
21
|
origin: Origin,
|
|
21
22
|
readonly name: string,
|
|
22
23
|
readonly props: Props
|
package/src/node/equiv-cdk8s.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { Embedder } from "@k8ts/instruments"
|
|
1
|
+
import { Embedder, Kinded, LiveRefable } from "@k8ts/instruments"
|
|
2
2
|
import { Construct } from "constructs"
|
|
3
|
-
import { ManifestResource } from "./manifest-resource"
|
|
4
3
|
|
|
5
4
|
export type Cdk8sCtor = {
|
|
6
5
|
new (parent: Construct, id: string, props: any): Construct
|
|
7
6
|
}
|
|
8
|
-
export type
|
|
9
|
-
export const EquivCdk8s = new Embedder<
|
|
7
|
+
export type KindedCtor = new (...args: any[]) => Kinded
|
|
8
|
+
export const EquivCdk8s = new Embedder<LiveRefable, Cdk8sCtor>("CDK8S_RESOURCE")
|
|
10
9
|
|
|
11
10
|
export function equiv_cdk8s(ctor: Cdk8sCtor) {
|
|
12
|
-
return <F extends
|
|
11
|
+
return <F extends KindedCtor>(target: F) => {
|
|
13
12
|
const cdk8s = EquivCdk8s.tryGet(target.prototype)
|
|
14
13
|
if (cdk8s) {
|
|
15
14
|
throw new Error(`Target ${target} already has a cdk8s equivalent! ${cdk8s}`)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Builder, Kind, type Origin } from "@k8ts/instruments"
|
|
2
2
|
import type { Meta, MutableMeta } from "@k8ts/metadata"
|
|
3
|
+
import { ResourceIdentBlock } from "./abs-resource"
|
|
3
4
|
import { TopResource } from "./top-resource"
|
|
4
5
|
|
|
6
|
+
export interface ManifestResourceIdent extends ResourceIdentBlock {
|
|
7
|
+
name: string
|
|
8
|
+
}
|
|
5
9
|
export abstract class ManifestResource<Props extends object = object> extends TopResource<Props> {
|
|
6
10
|
protected async manifest() {
|
|
7
11
|
return Builder.get(this).manifest()
|
package/src/node/sub-resource.ts
CHANGED
|
@@ -7,14 +7,14 @@ import type { ManifestResource } from "./manifest-resource"
|
|
|
7
7
|
})
|
|
8
8
|
export abstract class SubResource<Props extends object = object> extends AbsResource<Props> {
|
|
9
9
|
constructor(
|
|
10
|
-
readonly parent: ManifestResource,
|
|
10
|
+
readonly parent: SubResource | ManifestResource,
|
|
11
11
|
name: string,
|
|
12
12
|
props: Props
|
|
13
13
|
) {
|
|
14
14
|
super(parent.node.origin, name, props)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
get namespace() {
|
|
17
|
+
get namespace(): string | undefined {
|
|
18
18
|
return this.parent.namespace
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
resolveText
|
|
9
9
|
} from "@k8ts/instruments"
|
|
10
10
|
import { CDK } from "../../_imports"
|
|
11
|
-
import { v1 } from "../../api-versions"
|
|
12
11
|
import { k8ts } from "../../kind-map"
|
|
12
|
+
import { api } from "../../kinds"
|
|
13
13
|
import { equiv_cdk8s } from "../../node/equiv-cdk8s"
|
|
14
14
|
import { ManifestResource } from "../../node/manifest-resource"
|
|
15
15
|
export type ConfigMap = ConfigMap.ConfigMap
|
|
@@ -20,8 +20,7 @@ export namespace ConfigMap {
|
|
|
20
20
|
binaryData?: DataSourceRecord_Binary
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
@k8ts(ident)
|
|
23
|
+
@k8ts(api.v1_.ConfigMap)
|
|
25
24
|
@relations("none")
|
|
26
25
|
@equiv_cdk8s(CDK.KubeConfigMap)
|
|
27
26
|
@manifest({
|
|
@@ -37,6 +36,6 @@ export namespace ConfigMap {
|
|
|
37
36
|
}
|
|
38
37
|
})
|
|
39
38
|
export class ConfigMap extends ManifestResource<Props> {
|
|
40
|
-
override kind =
|
|
39
|
+
override kind = api.v1_.ConfigMap
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { manifest, Origin, relations } from "@k8ts/instruments"
|
|
1
|
+
import { manifest, Origin, Refable, relations } from "@k8ts/instruments"
|
|
2
2
|
import { Meta, MutableMeta } from "@k8ts/metadata"
|
|
3
3
|
import { omit } from "lodash"
|
|
4
4
|
import { CDK } from "../../_imports"
|
|
5
|
-
import { apps_v1 } from "../../api-versions"
|
|
6
5
|
import { k8ts } from "../../kind-map"
|
|
6
|
+
import { api } from "../../kinds"
|
|
7
7
|
import { equiv_cdk8s } from "../../node/equiv-cdk8s"
|
|
8
8
|
import { ManifestResource } from "../../node/manifest-resource"
|
|
9
9
|
import { PodTemplate } from "../pod/pod-template"
|
|
@@ -14,9 +14,11 @@ export namespace Deployment {
|
|
|
14
14
|
export type Props<Ports extends string> = SmallerProps & {
|
|
15
15
|
template: PodTemplate.Props<Ports>
|
|
16
16
|
}
|
|
17
|
+
export type AbsDeployment<Ports extends string> = Refable<api.apps_.v1_.Deployment> & {
|
|
18
|
+
__PORTS__: Ports
|
|
19
|
+
}
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
@k8ts(ident)
|
|
21
|
+
@k8ts(api.apps_.v1_.Deployment)
|
|
20
22
|
@equiv_cdk8s(CDK.KubeDeployment)
|
|
21
23
|
@relations({
|
|
22
24
|
kids: s => [s.template]
|
|
@@ -39,8 +41,10 @@ export namespace Deployment {
|
|
|
39
41
|
}
|
|
40
42
|
})
|
|
41
43
|
export class Deployment<Ports extends string = string> extends ManifestResource<Props<Ports>> {
|
|
42
|
-
|
|
44
|
+
__PORTS__!: Ports
|
|
45
|
+
kind = api.apps_.v1_.Deployment
|
|
43
46
|
template: PodTemplate<Ports>
|
|
47
|
+
|
|
44
48
|
constructor(origin: Origin, meta: Meta | MutableMeta, props: Props<Ports>) {
|
|
45
49
|
super(origin, meta, props)
|
|
46
50
|
this.template = new PodTemplate.PodTemplate(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { manifest, relations } from "@k8ts/instruments"
|
|
2
2
|
import { CDK } from "../../_imports"
|
|
3
|
-
import { gateway_v1 } from "../../api-versions"
|
|
4
3
|
import type { External } from "../../external"
|
|
5
4
|
import { k8ts } from "../../kind-map"
|
|
5
|
+
import { api } from "../../kinds"
|
|
6
6
|
import { ManifestResource } from "../../node"
|
|
7
7
|
import { equiv_cdk8s } from "../../node/equiv-cdk8s"
|
|
8
8
|
import type { Service } from "../service"
|
|
@@ -10,15 +10,13 @@ import type { Service } from "../service"
|
|
|
10
10
|
export type HttpRoute<Ports extends string> = HttpRoute.HttpRoute<Ports>
|
|
11
11
|
|
|
12
12
|
export namespace HttpRoute {
|
|
13
|
-
const gwKind = gateway_v1.kind("Gateway")
|
|
14
13
|
export interface Props<Ports extends string> {
|
|
15
|
-
gateway: External<
|
|
14
|
+
gateway: External<api.gateway_.v1_.Gateway>
|
|
16
15
|
hostname: string
|
|
17
16
|
backend: Service.Port<Ports>
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
@k8ts(kind)
|
|
19
|
+
@k8ts(api.gateway_.v1_.HttpRoute)
|
|
22
20
|
@relations({
|
|
23
21
|
needs: self => ({
|
|
24
22
|
gateway: self.props.gateway,
|
|
@@ -42,6 +40,6 @@ export namespace HttpRoute {
|
|
|
42
40
|
}
|
|
43
41
|
})
|
|
44
42
|
export class HttpRoute<Ports extends string> extends ManifestResource<Props<Ports>> {
|
|
45
|
-
kind =
|
|
43
|
+
kind = api.gateway_.v1_.HttpRoute
|
|
46
44
|
}
|
|
47
45
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { manifest, relations, type Origin } from "@k8ts/instruments"
|
|
2
2
|
import { Meta, MutableMeta } from "@k8ts/metadata"
|
|
3
3
|
import { CDK } from "../../_imports"
|
|
4
|
-
import { v1 } from "../../api-versions"
|
|
5
4
|
import { k8ts } from "../../kind-map"
|
|
5
|
+
import { api } from "../../kinds"
|
|
6
6
|
import { equiv_cdk8s } from "../../node/equiv-cdk8s"
|
|
7
7
|
import { ManifestResource } from "../../node/manifest-resource"
|
|
8
8
|
export type Namespace = Namespace.Namespace
|
|
9
9
|
export namespace Namespace {
|
|
10
10
|
export interface Props {}
|
|
11
|
-
|
|
12
|
-
@k8ts(ident)
|
|
11
|
+
@k8ts(api.v1_.Namespace)
|
|
13
12
|
@relations("none")
|
|
14
13
|
@equiv_cdk8s(CDK.KubeNamespace)
|
|
15
14
|
@manifest({
|
|
@@ -20,7 +19,7 @@ export namespace Namespace {
|
|
|
20
19
|
}
|
|
21
20
|
})
|
|
22
21
|
export class Namespace extends ManifestResource<Props> {
|
|
23
|
-
override kind =
|
|
22
|
+
override kind = api.v1_.Namespace
|
|
24
23
|
constructor(origin: Origin, meta: Meta | MutableMeta, props?: Props) {
|
|
25
24
|
super(origin, meta.toMutable(), props ?? {})
|
|
26
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { manifest, relations, ResourcesSpec, Unit } from "@k8ts/instruments"
|
|
2
2
|
import { CDK } from "../../../_imports"
|
|
3
|
-
import { v1 } from "../../../api-versions"
|
|
4
3
|
import { k8ts } from "../../../kind-map"
|
|
4
|
+
import { api } from "../../../kinds"
|
|
5
5
|
import { ManifestResource } from "../../../node"
|
|
6
6
|
import { equiv_cdk8s } from "../../../node/equiv-cdk8s"
|
|
7
7
|
import { Access } from "../access-mode"
|
|
@@ -18,15 +18,14 @@ export namespace Pvc {
|
|
|
18
18
|
export interface Props<Mode extends DataMode> extends PvcResources {
|
|
19
19
|
accessModes: Access
|
|
20
20
|
mode?: Mode
|
|
21
|
-
bind: Pv<Mode>
|
|
21
|
+
bind: Pv.AbsPv<Mode>
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
@k8ts(ident)
|
|
24
|
+
@k8ts(api.v1_.PersistentVolumeClaim)
|
|
26
25
|
@equiv_cdk8s(CDK.KubePersistentVolumeClaim)
|
|
27
26
|
@relations({
|
|
28
27
|
needs: self => ({
|
|
29
|
-
bind: self.
|
|
28
|
+
bind: self.bound
|
|
30
29
|
})
|
|
31
30
|
})
|
|
32
31
|
@manifest({
|
|
@@ -49,6 +48,10 @@ export namespace Pvc {
|
|
|
49
48
|
}
|
|
50
49
|
})
|
|
51
50
|
export class Pvc<Mode extends DataMode = DataMode> extends ManifestResource<Props<Mode>> {
|
|
52
|
-
kind =
|
|
51
|
+
kind = api.v1_.PersistentVolumeClaim
|
|
52
|
+
|
|
53
|
+
get bound() {
|
|
54
|
+
return this.props.bind as Pv<Mode>
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { manifest, relations, type Unit } from "@k8ts/instruments"
|
|
1
|
+
import { manifest, Refable, relations, type Unit } from "@k8ts/instruments"
|
|
2
2
|
import { CDK } from "../../../_imports"
|
|
3
|
-
import { v1 } from "../../../api-versions"
|
|
4
3
|
import { MakeError } from "../../../error"
|
|
5
4
|
import { k8ts } from "../../../kind-map"
|
|
5
|
+
import { api } from "../../../kinds"
|
|
6
6
|
import { equiv_cdk8s } from "../../../node/equiv-cdk8s"
|
|
7
7
|
import { ManifestResource } from "../../../node/manifest-resource"
|
|
8
8
|
import { Access } from "../access-mode"
|
|
@@ -23,9 +23,9 @@ export namespace Pv {
|
|
|
23
23
|
nodeAffinity?: CDK.VolumeNodeAffinity
|
|
24
24
|
}
|
|
25
25
|
export type Reclaim = "Retain" | "Delete" | "Recycle"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export type AbsPv<Mode extends DataMode = DataMode> = Refable<api.v1_.PersistentVolume> & {
|
|
27
|
+
__MODE__: Mode
|
|
28
|
+
}
|
|
29
29
|
@equiv_cdk8s(CDK.KubePersistentVolume)
|
|
30
30
|
@manifest({
|
|
31
31
|
body(self) {
|
|
@@ -59,9 +59,10 @@ export namespace Pv {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
})
|
|
62
|
-
@k8ts(
|
|
62
|
+
@k8ts(api.v1_.PersistentVolume)
|
|
63
63
|
@relations("none")
|
|
64
64
|
export class Pv<Mode extends DataMode = DataMode> extends ManifestResource<Props<Mode>> {
|
|
65
|
-
|
|
65
|
+
__MODE__!: Mode
|
|
66
|
+
readonly kind = api.v1_.PersistentVolume
|
|
66
67
|
}
|
|
67
68
|
}
|