k8ts 0.4.21 → 0.4.23
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/.imports.tsbuildinfo +1 -1
- package/dist/_imports/helm.toolkit.fluxcd.io.d.ts +4894 -0
- package/dist/_imports/helm.toolkit.fluxcd.io.d.ts.map +1 -0
- package/dist/_imports/helm.toolkit.fluxcd.io.js +2430 -0
- package/dist/_imports/helm.toolkit.fluxcd.io.js.map +1 -0
- package/dist/_imports/kustomize.toolkit.fluxcd.io.d.ts +2367 -0
- package/dist/_imports/kustomize.toolkit.fluxcd.io.d.ts.map +1 -0
- package/dist/_imports/kustomize.toolkit.fluxcd.io.js +1285 -0
- package/dist/_imports/kustomize.toolkit.fluxcd.io.js.map +1 -0
- package/dist/_imports/notification.toolkit.fluxcd.io.d.ts +2005 -0
- package/dist/_imports/notification.toolkit.fluxcd.io.d.ts.map +1 -0
- package/dist/_imports/notification.toolkit.fluxcd.io.js +1575 -0
- package/dist/_imports/notification.toolkit.fluxcd.io.js.map +1 -0
- package/dist/_imports/source.toolkit.fluxcd.io.d.ts +4158 -0
- package/dist/_imports/source.toolkit.fluxcd.io.d.ts.map +1 -0
- package/dist/_imports/source.toolkit.fluxcd.io.js +2739 -0
- package/dist/_imports/source.toolkit.fluxcd.io.js.map +1 -0
- package/dist/file/factory.d.ts +1 -1
- package/dist/file/factory.d.ts.map +1 -1
- package/dist/file/factory.js.map +1 -1
- package/dist/resources/deployment/deployment.d.ts +10 -3
- package/dist/resources/deployment/deployment.d.ts.map +1 -1
- package/dist/resources/deployment/deployment.js +19 -1
- package/dist/resources/deployment/deployment.js.map +1 -1
- package/dist/resources/pod/container/container.d.ts +2 -2
- package/dist/resources/pod/container/container.d.ts.map +1 -1
- package/dist/resources/pod/container/container.js.map +1 -1
- package/dist/resources/utils/adapters.js +1 -1
- package/dist/resources/utils/adapters.js.map +1 -1
- package/dist/runner/exporter/assembler.d.ts +2 -2
- package/dist/runner/exporter/assembler.d.ts.map +1 -1
- package/dist/runner/exporter/assembler.js.map +1 -1
- package/dist/runner/exporter/serializer.d.ts +4 -3
- package/dist/runner/exporter/serializer.d.ts.map +1 -1
- package/dist/runner/exporter/serializer.js +4 -1
- package/dist/runner/exporter/serializer.js.map +1 -1
- package/dist/runner/runner.d.ts +3 -2
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +6 -1
- package/dist/runner/runner.js.map +1 -1
- package/dist/src.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/_imports/helm.toolkit.fluxcd.io.ts +6748 -0
- package/src/_imports/kustomize.toolkit.fluxcd.io.ts +3369 -0
- package/src/_imports/notification.toolkit.fluxcd.io.ts +2848 -0
- package/src/_imports/source.toolkit.fluxcd.io.ts +6054 -0
- package/src/file/factory.ts +1 -1
- package/src/resources/deployment/deployment.ts +30 -4
- package/src/resources/pod/container/container.ts +2 -1
- package/src/resources/utils/adapters.ts +1 -1
- package/src/runner/exporter/assembler.ts +2 -2
- package/src/runner/exporter/serializer.ts +8 -4
- package/src/runner/runner.ts +15 -3
package/src/file/factory.ts
CHANGED
|
@@ -100,7 +100,7 @@ export namespace Factory {
|
|
|
100
100
|
>
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
Deployment<Name extends string>(name: Name, props: Deployment.
|
|
103
|
+
Deployment<Name extends string>(name: Name, props: Deployment.NormalProps) {
|
|
104
104
|
const builder = this
|
|
105
105
|
const traceHere = new Trace(new StackTracey().slice(2))
|
|
106
106
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { manifest, Origin, Refable, relations } from "@k8ts/instruments"
|
|
1
|
+
import { manifest, Origin, Refable, relations, WritableDeep } 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 { MakeError } from "../../error"
|
|
5
6
|
import { k8ts } from "../../kind-map"
|
|
6
7
|
import { api } from "../../kinds"
|
|
7
8
|
import { equiv_cdk8s } from "../../node/equiv-cdk8s"
|
|
@@ -10,9 +11,17 @@ import { PodTemplate } from "../pod/pod-template"
|
|
|
10
11
|
|
|
11
12
|
export type Deployment<Ports extends string> = Deployment.Deployment<Ports>
|
|
12
13
|
export namespace Deployment {
|
|
13
|
-
export type
|
|
14
|
-
|
|
14
|
+
export type DeploymentStrategy =
|
|
15
|
+
| { type: "Recreate" }
|
|
16
|
+
| ({
|
|
17
|
+
type: "RollingUpdate"
|
|
18
|
+
} & CDK.RollingUpdateDeployment)
|
|
19
|
+
export type NormalProps = WritableDeep<
|
|
20
|
+
Omit<CDK.DeploymentSpec, "selector" | "template" | "strategy">
|
|
21
|
+
>
|
|
22
|
+
export type Props<Ports extends string> = NormalProps & {
|
|
15
23
|
template: PodTemplate.Props<Ports>
|
|
24
|
+
strategy?: DeploymentStrategy
|
|
16
25
|
}
|
|
17
26
|
export type AbsDeployment<Ports extends string> = Refable<api.apps_.v1_.Deployment> & {
|
|
18
27
|
__PORTS__: Ports
|
|
@@ -35,7 +44,8 @@ export namespace Deployment {
|
|
|
35
44
|
app: self.name
|
|
36
45
|
}
|
|
37
46
|
},
|
|
38
|
-
template: noKindFields
|
|
47
|
+
template: noKindFields,
|
|
48
|
+
strategy: self._strategy
|
|
39
49
|
}
|
|
40
50
|
}
|
|
41
51
|
}
|
|
@@ -45,6 +55,22 @@ export namespace Deployment {
|
|
|
45
55
|
kind = api.apps_.v1_.Deployment
|
|
46
56
|
template: PodTemplate<Ports>
|
|
47
57
|
|
|
58
|
+
private get _strategy() {
|
|
59
|
+
const strat = this.props.strategy
|
|
60
|
+
if (!strat) {
|
|
61
|
+
return undefined
|
|
62
|
+
}
|
|
63
|
+
if (strat.type === "Recreate") {
|
|
64
|
+
return strat
|
|
65
|
+
}
|
|
66
|
+
if (strat.type === "RollingUpdate") {
|
|
67
|
+
return {
|
|
68
|
+
type: "RollingUpdate",
|
|
69
|
+
rollingUpdate: omit(strat, "type")
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
throw new MakeError(`Invalid strategy type: ${strat}`)
|
|
73
|
+
}
|
|
48
74
|
constructor(origin: Origin, meta: Meta | MutableMeta, props: Props<Ports>) {
|
|
49
75
|
super(origin, meta, props)
|
|
50
76
|
this.template = new PodTemplate.PodTemplate(
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
relations,
|
|
6
6
|
ResourcesSpec,
|
|
7
7
|
Unit,
|
|
8
|
+
WritableDeep,
|
|
8
9
|
type CmdBuilder,
|
|
9
10
|
type InputEnvMapping,
|
|
10
11
|
type InputPortSetRecord,
|
|
@@ -45,7 +46,7 @@ export namespace Container {
|
|
|
45
46
|
resources?: Resources
|
|
46
47
|
}
|
|
47
48
|
export type Props<Ports extends string = never> = K8tsProps<Ports> &
|
|
48
|
-
Omit<CDK.Container, keyof K8tsProps | "name"
|
|
49
|
+
WritableDeep<Omit<CDK.Container, keyof K8tsProps | "name">>
|
|
49
50
|
|
|
50
51
|
@k8ts(api.v1_.Pod_.Container)
|
|
51
52
|
@relations({
|
|
@@ -7,7 +7,7 @@ import type { File } from "../../file"
|
|
|
7
7
|
import { ResourceLoader, type ResourceLoaderEventsTable } from "./loader"
|
|
8
8
|
import { Manifester, NodeManifest, type ManifesterEventsTable } from "./manifester"
|
|
9
9
|
import { ManifestSaver, type ManifestSaverEventsTable } from "./saver"
|
|
10
|
-
import { YamlSerializer, type
|
|
10
|
+
import { YamlSerializer, type SerializerEventsTable } from "./serializer"
|
|
11
11
|
import { NodeGraphValidator, ValidatorEventsTable } from "./validator"
|
|
12
12
|
|
|
13
13
|
export class Assembler extends Emittery<AssemblerEventsTable> {
|
|
@@ -166,7 +166,7 @@ export type AssemblyStage =
|
|
|
166
166
|
| "gathering"
|
|
167
167
|
export interface AssemblerEventsTable
|
|
168
168
|
extends ManifestSaverEventsTable,
|
|
169
|
-
|
|
169
|
+
SerializerEventsTable,
|
|
170
170
|
ManifesterEventsTable,
|
|
171
171
|
ResourceLoaderEventsTable,
|
|
172
172
|
ValidatorEventsTable {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseManifest, ManifestSourceEmbedder } from "@k8ts/instruments"
|
|
1
|
+
import { BaseManifest, ManifestSourceEmbedder, type ResourceNode } from "@k8ts/instruments"
|
|
2
2
|
import Emittery from "emittery"
|
|
3
3
|
import { dump, type DumpOptions } from "js-yaml"
|
|
4
4
|
import { CDK } from "../../_imports"
|
|
@@ -9,17 +9,21 @@ export interface YamlSerializerOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export interface SerializingEvent {
|
|
11
11
|
manifest: BaseManifest
|
|
12
|
+
resource: ResourceNode
|
|
12
13
|
}
|
|
13
|
-
export interface
|
|
14
|
+
export interface SerializerEventsTable {
|
|
14
15
|
serialize: SerializingEvent
|
|
15
16
|
}
|
|
16
|
-
export class YamlSerializer extends Emittery<
|
|
17
|
+
export class YamlSerializer extends Emittery<SerializerEventsTable> {
|
|
17
18
|
constructor(private readonly _options: Partial<YamlSerializerOptions>) {
|
|
18
19
|
super()
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
async serialize(input: BaseManifest) {
|
|
22
|
-
await this.emit("serialize", {
|
|
23
|
+
await this.emit("serialize", {
|
|
24
|
+
manifest: input,
|
|
25
|
+
resource: ManifestSourceEmbedder.get(input).node
|
|
26
|
+
})
|
|
23
27
|
|
|
24
28
|
try {
|
|
25
29
|
const result = dump(input, {
|
package/src/runner/runner.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { GitTrace, Trace } from "@k8ts/instruments"
|
|
2
2
|
import { Meta } from "@k8ts/metadata"
|
|
3
3
|
import chalk from "chalk"
|
|
4
|
+
import Emittery from "emittery"
|
|
4
5
|
import StackTracey from "stacktracey"
|
|
5
6
|
import { File } from "../file"
|
|
6
7
|
import { proverbsPath } from "../paths"
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
Assembler,
|
|
10
|
+
AssemblerEventsTable,
|
|
11
|
+
AssemblerOptions,
|
|
12
|
+
ProgressOptions,
|
|
13
|
+
ProgressShower
|
|
14
|
+
} from "./exporter"
|
|
8
15
|
import { k8ts_namespace } from "./exporter/meta"
|
|
9
16
|
import { Proverbs } from "./silly/proverbs"
|
|
10
17
|
import { Summarizer } from "./summarizer"
|
|
@@ -15,8 +22,10 @@ export interface RunnerOptions extends AssemblerOptions {
|
|
|
15
22
|
progress: ProgressOptions
|
|
16
23
|
}
|
|
17
24
|
|
|
18
|
-
export class Runner {
|
|
19
|
-
constructor(private readonly _options: RunnerOptions) {
|
|
25
|
+
export class Runner extends Emittery<AssemblerEventsTable> {
|
|
26
|
+
constructor(private readonly _options: RunnerOptions) {
|
|
27
|
+
super()
|
|
28
|
+
}
|
|
20
29
|
|
|
21
30
|
async run(input: Iterable<File.Input>) {
|
|
22
31
|
const gitInfo = await GitTrace.make({
|
|
@@ -36,6 +45,9 @@ export class Runner {
|
|
|
36
45
|
|
|
37
46
|
const progressShower = new ProgressShower(options.progress)
|
|
38
47
|
const assembler = new Assembler(options)
|
|
48
|
+
assembler.onAny(async (name, data) => {
|
|
49
|
+
await this.emit(name, data)
|
|
50
|
+
})
|
|
39
51
|
const summarizer = new Summarizer({
|
|
40
52
|
printOptions: this._options.printOptions
|
|
41
53
|
})
|