@toa.io/operations 1.0.0-alpha.19 → 1.0.0-alpha.190
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/package.json +8 -8
- package/src/deployment/.deployment/.describe/compositions.js +4 -2
- package/src/deployment/.deployment/.describe/mounts.js +24 -0
- package/src/deployment/.deployment/.describe/variables.js +5 -4
- package/src/deployment/.deployment/describe.js +4 -4
- package/src/deployment/.deployment/merge.js +4 -1
- package/src/deployment/chart/templates/compositions.yaml +34 -0
- package/src/deployment/chart/templates/services.yaml +48 -3
- package/src/deployment/chart/values.yaml +17 -2
- package/src/deployment/composition.js +1 -0
- package/src/deployment/deployment.js +1 -0
- package/src/deployment/factory.js +0 -1
- package/src/deployment/images/composition.js +16 -6
- package/src/deployment/images/factory.js +0 -3
- package/src/deployment/images/image.js +10 -4
- package/src/deployment/images/service.Dockerfile +1 -1
- package/src/deployment/operator.js +4 -0
- package/src/deployment/registry.js +23 -1
- package/types/_deployment/images/image.d.ts +4 -2
- package/types/_deployment/registry.d.ts +9 -7
- package/types/dependency.ts +65 -0
- package/types/dependency.d.ts +0 -30
- /package/types/{index.d.ts → index.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/operations",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.190",
|
|
4
4
|
"description": "Toa Deployment",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"url": "https://github.com/toa-io/toa/issues"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">= 20.0.0"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"main": "src/index.js",
|
|
25
|
-
"types": "types/index.
|
|
25
|
+
"types": "types/index.ts",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@toa.io/filesystem": "1.0.0-alpha.
|
|
31
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
32
|
-
"@toa.io/norm": "1.0.0-alpha.
|
|
33
|
-
"@toa.io/yaml": "1.0.0-alpha.
|
|
30
|
+
"@toa.io/filesystem": "1.0.0-alpha.173",
|
|
31
|
+
"@toa.io/generic": "1.0.0-alpha.173",
|
|
32
|
+
"@toa.io/norm": "1.0.0-alpha.190",
|
|
33
|
+
"@toa.io/yaml": "1.0.0-alpha.182",
|
|
34
34
|
"execa": "5.1.1",
|
|
35
35
|
"fs-extra": "11.1.1"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "494b1c8f05c21f377f1152a9d89df5cbbd1001de"
|
|
38
38
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { addVariables } = require('./variables')
|
|
4
|
+
const { addMounts } = require('./mounts')
|
|
4
5
|
|
|
5
|
-
function compositions (compositions,
|
|
6
|
+
function compositions (compositions, dependency) {
|
|
6
7
|
for (const composition of compositions) {
|
|
7
|
-
addVariables(composition, variables)
|
|
8
|
+
addVariables(composition, dependency.variables)
|
|
9
|
+
addMounts(composition, dependency.mounts)
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function addMounts (composition, mounts) {
|
|
4
|
+
if (mounts === undefined)
|
|
5
|
+
return
|
|
6
|
+
|
|
7
|
+
const used = new Set()
|
|
8
|
+
|
|
9
|
+
for (const [key, mount] of Object.entries(mounts)) {
|
|
10
|
+
if (key !== 'global' && !composition.components?.includes(key))
|
|
11
|
+
continue
|
|
12
|
+
|
|
13
|
+
for (const { name, path, claim } of mount) {
|
|
14
|
+
if (used.has(name))
|
|
15
|
+
continue
|
|
16
|
+
|
|
17
|
+
composition.mounts ??= []
|
|
18
|
+
composition.mounts.push({ name, path, claim })
|
|
19
|
+
used.add(name)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.addMounts = addMounts
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
function addVariables (
|
|
3
|
+
function addVariables (composition, variables) {
|
|
4
4
|
const used = new Set()
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
composition.variables ??= []
|
|
7
7
|
|
|
8
8
|
for (const [key, set] of Object.entries(variables)) {
|
|
9
|
-
if (key !== 'global' && !
|
|
9
|
+
if (key !== 'global' && !composition.components?.includes(key))
|
|
10
|
+
continue
|
|
10
11
|
|
|
11
12
|
for (const variable of set) {
|
|
12
13
|
if (used.has(variable.name)) continue
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
composition.variables.push(variable)
|
|
15
16
|
used.add(variable.name)
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const desc = require('./.describe')
|
|
4
4
|
|
|
5
5
|
const describe = (context, compositions, dependency) => {
|
|
6
6
|
const { services } = dependency
|
|
@@ -17,11 +17,11 @@ const describe = (context, compositions, dependency) => {
|
|
|
17
17
|
}
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
-
const components =
|
|
20
|
+
const components = desc.components(compositions)
|
|
21
21
|
const credentials = context.registry?.credentials
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
desc.compositions(compositions, dependency)
|
|
24
|
+
desc.services(services, dependency.variables)
|
|
25
25
|
|
|
26
26
|
return {
|
|
27
27
|
compositions,
|
|
@@ -13,14 +13,17 @@ const merge = (dependencies) => {
|
|
|
13
13
|
/** @type {toa.deployment.dependency.Variables} */
|
|
14
14
|
const variables = {}
|
|
15
15
|
|
|
16
|
+
const mounts = {}
|
|
17
|
+
|
|
16
18
|
for (const dependency of dependencies) {
|
|
17
19
|
if (dependency.references !== undefined) references.push(...dependency.references)
|
|
18
20
|
if (dependency.services !== undefined) services.push(...dependency.services)
|
|
19
21
|
if (dependency.proxies !== undefined) proxies.push(...dependency.proxies)
|
|
20
22
|
if (dependency.variables !== undefined) append(variables, dependency.variables)
|
|
23
|
+
if (dependency.mounts !== undefined) append(mounts, dependency.mounts)
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
return { references, services, proxies, variables }
|
|
26
|
+
return { references, services, proxies, variables, mounts }
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const append = (merged, variables) => {
|
|
@@ -19,15 +19,49 @@ spec:
|
|
|
19
19
|
containers:
|
|
20
20
|
- name: {{ .name }}
|
|
21
21
|
image: {{ .image }}
|
|
22
|
+
{{- if .resources }}
|
|
23
|
+
resources:
|
|
24
|
+
{{- if or .resources.cpu .resources.memory }}
|
|
25
|
+
requests:
|
|
26
|
+
{{- if .resources.cpu }}
|
|
27
|
+
cpu: {{ index .resources.cpu 0 }}
|
|
28
|
+
{{- end }}
|
|
29
|
+
{{- if .resources.memory }}
|
|
30
|
+
memory: {{ index .resources.memory 0 }}
|
|
31
|
+
{{- end }}
|
|
32
|
+
limits:
|
|
33
|
+
{{- if .resources.cpu }}
|
|
34
|
+
cpu: {{ index .resources.cpu 1 }}
|
|
35
|
+
{{- end }}
|
|
36
|
+
{{- if .resources.memory }}
|
|
37
|
+
memory: {{ index .resources.memory 1 }}
|
|
38
|
+
{{- end }}
|
|
39
|
+
{{- end }}
|
|
40
|
+
{{- end }}
|
|
22
41
|
{{- if .variables }}
|
|
23
42
|
env:
|
|
24
43
|
{{- range .variables }}
|
|
25
44
|
{{- include "env.var" . | indent 12 }}
|
|
26
45
|
{{- end }}
|
|
27
46
|
{{- end }}
|
|
47
|
+
{{- if .mounts }}
|
|
48
|
+
volumeMounts:
|
|
49
|
+
{{- range .mounts }}
|
|
50
|
+
- name: {{ .name }}
|
|
51
|
+
mountPath: {{ .path }}
|
|
52
|
+
{{- end }}
|
|
53
|
+
{{- end }}
|
|
28
54
|
{{- if $.Values.credentials }}
|
|
29
55
|
imagePullSecrets:
|
|
30
56
|
- name: {{ $.Values.credentials }}
|
|
31
57
|
{{- end }}
|
|
58
|
+
{{- if .mounts }}
|
|
59
|
+
volumes:
|
|
60
|
+
{{- range .mounts }}
|
|
61
|
+
- name: {{ .name }}
|
|
62
|
+
persistentVolumeClaim:
|
|
63
|
+
claimName: {{ .claim }}
|
|
64
|
+
{{- end }}
|
|
65
|
+
{{- end }}
|
|
32
66
|
---
|
|
33
67
|
{{- end }}
|
|
@@ -16,12 +16,41 @@ spec:
|
|
|
16
16
|
containers:
|
|
17
17
|
- name: extension-{{ .name }}
|
|
18
18
|
image: {{ .image }}
|
|
19
|
+
{{- if .resources }}
|
|
20
|
+
resources:
|
|
21
|
+
{{- if or .resources.cpu .resources.memory }}
|
|
22
|
+
requests:
|
|
23
|
+
{{- if .resources.cpu }}
|
|
24
|
+
cpu: {{ index .resources.cpu 0 }}
|
|
25
|
+
{{- end }}
|
|
26
|
+
{{- if .resources.memory }}
|
|
27
|
+
memory: {{ index .resources.memory 0 }}
|
|
28
|
+
{{- end }}
|
|
29
|
+
limits:
|
|
30
|
+
{{- if .resources.cpu }}
|
|
31
|
+
cpu: {{ index .resources.cpu 1 }}
|
|
32
|
+
{{- end }}
|
|
33
|
+
{{- if .resources.memory }}
|
|
34
|
+
memory: {{ index .resources.memory 1 }}
|
|
35
|
+
{{- end }}
|
|
36
|
+
{{- end }}
|
|
37
|
+
{{- end }}
|
|
19
38
|
{{- if .variables }}
|
|
20
39
|
env:
|
|
21
40
|
{{- range .variables }}
|
|
22
41
|
{{- include "env.var" . | indent 12 }}
|
|
23
42
|
{{- end }}
|
|
24
43
|
{{- end }}
|
|
44
|
+
{{- if .probe }}
|
|
45
|
+
readinessProbe:
|
|
46
|
+
httpGet:
|
|
47
|
+
path: {{ .probe.path }}
|
|
48
|
+
port: {{ .probe.port }}
|
|
49
|
+
{{- if .probe.delay }}
|
|
50
|
+
initialDelaySeconds: {{ .probe.delay }}
|
|
51
|
+
{{- end }}
|
|
52
|
+
{{- end }}
|
|
53
|
+
{{- if .port }}
|
|
25
54
|
---
|
|
26
55
|
apiVersion: v1
|
|
27
56
|
kind: Service
|
|
@@ -36,8 +65,10 @@ spec:
|
|
|
36
65
|
protocol: TCP
|
|
37
66
|
port: {{ .port }}
|
|
38
67
|
targetPort: {{ .port }}
|
|
39
|
-
|
|
68
|
+
{{- end }}
|
|
40
69
|
{{- if .ingress }}
|
|
70
|
+
{{- $service := .name }}
|
|
71
|
+
---
|
|
41
72
|
apiVersion: networking.k8s.io/v1
|
|
42
73
|
kind: Ingress
|
|
43
74
|
metadata:
|
|
@@ -51,15 +82,29 @@ spec:
|
|
|
51
82
|
ingressClassName: {{ .ingress.class }}
|
|
52
83
|
{{- end }}
|
|
53
84
|
rules:
|
|
54
|
-
|
|
85
|
+
{{- range .ingress.hosts }}
|
|
86
|
+
- host: {{ . }}
|
|
55
87
|
http:
|
|
56
88
|
paths:
|
|
57
89
|
- path: /
|
|
58
90
|
pathType: Prefix
|
|
59
91
|
backend:
|
|
60
92
|
service:
|
|
61
|
-
name: extension-{{
|
|
93
|
+
name: extension-{{ $service }}
|
|
62
94
|
port:
|
|
63
95
|
number: 8000
|
|
96
|
+
{{- end }}
|
|
97
|
+
{{- if .ingress.default }}
|
|
98
|
+
- http:
|
|
99
|
+
paths:
|
|
100
|
+
- path: /
|
|
101
|
+
pathType: Prefix
|
|
102
|
+
backend:
|
|
103
|
+
service:
|
|
104
|
+
name: extension-{{ $service }}
|
|
105
|
+
port:
|
|
106
|
+
number: 8000
|
|
107
|
+
{{- end }}
|
|
64
108
|
{{- end }}
|
|
109
|
+
---
|
|
65
110
|
{{- end }}
|
|
@@ -3,9 +3,16 @@ compositions:
|
|
|
3
3
|
- name: todos
|
|
4
4
|
image: localhost:5000/composition-todos:0.0.0
|
|
5
5
|
replicas: 2
|
|
6
|
+
mounts:
|
|
7
|
+
- name: mount-name
|
|
8
|
+
path: /storage
|
|
9
|
+
claim: storage-pvc
|
|
6
10
|
components:
|
|
7
11
|
- todos-tasks
|
|
8
12
|
- todos-stats
|
|
13
|
+
resources:
|
|
14
|
+
cpu: [100m, 1]
|
|
15
|
+
memory: [100Mi, 1Gi]
|
|
9
16
|
variables:
|
|
10
17
|
- name: TOA_CONFIGURATION_TODOS_TASKS
|
|
11
18
|
value: foo
|
|
@@ -18,7 +25,6 @@ compositions:
|
|
|
18
25
|
replicas: 3
|
|
19
26
|
components:
|
|
20
27
|
- users-users
|
|
21
|
-
# TODO: create component services only if sync binding is being used
|
|
22
28
|
components:
|
|
23
29
|
- todos-tasks
|
|
24
30
|
- todos-stats
|
|
@@ -28,8 +34,12 @@ services:
|
|
|
28
34
|
image: localhost:5000/resources-gateway:0.0.0
|
|
29
35
|
port: 8000
|
|
30
36
|
replicas: 2
|
|
37
|
+
resources:
|
|
38
|
+
cpu: [100m, 1]
|
|
39
|
+
memory: [100Mi, 1Gi]
|
|
31
40
|
ingress:
|
|
32
|
-
|
|
41
|
+
default: true
|
|
42
|
+
hosts: [dummies.toa.io]
|
|
33
43
|
class: alb
|
|
34
44
|
annotations:
|
|
35
45
|
alb.ingress.kubernetes.io/scheme: internet-facing
|
|
@@ -41,6 +51,11 @@ services:
|
|
|
41
51
|
secret:
|
|
42
52
|
name: secret-name
|
|
43
53
|
key: secret-key
|
|
54
|
+
probe:
|
|
55
|
+
port: 8000
|
|
56
|
+
path: /.ready
|
|
57
|
+
delay: 1
|
|
58
|
+
|
|
44
59
|
proxies:
|
|
45
60
|
- name: storage-proxy
|
|
46
61
|
target: host.docker.internal
|
|
@@ -42,6 +42,7 @@ class Deployment {
|
|
|
42
42
|
|
|
43
43
|
if (options.namespace !== undefined) args.push('-n', options.namespace)
|
|
44
44
|
if (options.wait === true) args.push('--wait')
|
|
45
|
+
if (options.timeout !== undefined) args.push('--timeout', options.timeout)
|
|
45
46
|
|
|
46
47
|
await this.#process.execute('helm', ['dependency', 'update', this.#target])
|
|
47
48
|
await this.#process.execute('helm', ['upgrade', this.#chart.name, '-i', ...args, this.#target])
|
|
@@ -5,6 +5,7 @@ const fs = require('fs-extra')
|
|
|
5
5
|
const { createHash } = require('node:crypto')
|
|
6
6
|
|
|
7
7
|
const { Image } = require('./image')
|
|
8
|
+
const { undef } = require('@toa.io/concise/source/expressions/undefined')
|
|
8
9
|
|
|
9
10
|
class Composition extends Image {
|
|
10
11
|
dockerfile = join(__dirname, 'composition.Dockerfile')
|
|
@@ -37,11 +38,7 @@ class Composition extends Image {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
get base () {
|
|
40
|
-
|
|
41
|
-
return this.#image
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let image = null
|
|
41
|
+
let image = this.#image
|
|
45
42
|
|
|
46
43
|
for (const component of this.#components) {
|
|
47
44
|
const value = component.build?.image
|
|
@@ -53,7 +50,20 @@ class Composition extends Image {
|
|
|
53
50
|
image = value
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
return image
|
|
53
|
+
return image
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get run () {
|
|
57
|
+
const commands = []
|
|
58
|
+
|
|
59
|
+
for (const component of this.#components) {
|
|
60
|
+
const run = component.build?.run
|
|
61
|
+
|
|
62
|
+
if (run !== undefined)
|
|
63
|
+
commands.push(run)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return commands.join('\n')
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
async prepare (root) {
|
|
@@ -27,7 +27,7 @@ class Image {
|
|
|
27
27
|
#runtime
|
|
28
28
|
#values = {
|
|
29
29
|
build: {
|
|
30
|
-
image: 'node:
|
|
30
|
+
image: 'node:24.12.0-alpine3.22'
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -54,6 +54,8 @@ class Image {
|
|
|
54
54
|
|
|
55
55
|
get base () {}
|
|
56
56
|
|
|
57
|
+
get run () {}
|
|
58
|
+
|
|
57
59
|
async prepare (root) {
|
|
58
60
|
if (this.dockerfile === undefined) throw new Error('Dockerfile isn\'t specified')
|
|
59
61
|
|
|
@@ -65,7 +67,7 @@ class Image {
|
|
|
65
67
|
|
|
66
68
|
const template = await read(this.dockerfile, 'utf-8')
|
|
67
69
|
const contents = template.replace(/{{(\S{1,32})}}/g, (_, key) => this.#value(key))
|
|
68
|
-
const ignore = 'Dockerfile'
|
|
70
|
+
const ignore = ['Dockerfile', '**/node_modules'].join('\r\n')
|
|
69
71
|
|
|
70
72
|
await write(join(path, 'Dockerfile'), contents)
|
|
71
73
|
await write(join(path, '.dockerignore'), ignore)
|
|
@@ -81,9 +83,13 @@ class Image {
|
|
|
81
83
|
|
|
82
84
|
const image = this.base
|
|
83
85
|
|
|
84
|
-
if (image !== undefined)
|
|
86
|
+
if (image !== undefined)
|
|
85
87
|
this.#values.build.image = image
|
|
86
|
-
|
|
88
|
+
|
|
89
|
+
const run = this.run
|
|
90
|
+
|
|
91
|
+
if (run !== undefined)
|
|
92
|
+
this.#values.build.run = (this.#values.build.run === undefined ? '' : this.#values.build.run + '\n') + run
|
|
87
93
|
|
|
88
94
|
if (this.#values.build.arguments !== undefined) this.#values.build.arguments = createArguments(this.#values.build.arguments)
|
|
89
95
|
if (this.#values.build.run !== undefined) this.#values.build.run = createRunCommands(this.#values.build.run)
|
|
@@ -51,6 +51,10 @@ class Registry {
|
|
|
51
51
|
for (const image of this.#images) await this.#push(image)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
tags () {
|
|
55
|
+
return this.#images.map((image) => image.reference)
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
/**
|
|
55
59
|
* @param {'composition' | 'service'} type
|
|
56
60
|
* @param {...any} args
|
|
@@ -70,6 +74,11 @@ class Registry {
|
|
|
70
74
|
* @returns {Promise<void>}
|
|
71
75
|
*/
|
|
72
76
|
async #build (image, push = false) {
|
|
77
|
+
if (await this.exists(image.reference)) {
|
|
78
|
+
console.log('Image already exists, skipping:', image.reference)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
73
82
|
const args = ['--context=default', 'buildx', 'build']
|
|
74
83
|
|
|
75
84
|
if (push) {
|
|
@@ -92,7 +101,6 @@ class Registry {
|
|
|
92
101
|
|
|
93
102
|
args.push('--platform', platform)
|
|
94
103
|
args.push('--builder', builder)
|
|
95
|
-
|
|
96
104
|
} else {
|
|
97
105
|
args.push('--builder', 'default')
|
|
98
106
|
}
|
|
@@ -106,6 +114,20 @@ class Registry {
|
|
|
106
114
|
await this.#build(image, true)
|
|
107
115
|
}
|
|
108
116
|
|
|
117
|
+
async exists (tag) {
|
|
118
|
+
const args = ['manifest', 'inspect', tag]
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
await this.#process.execute('docker', args, { silently: true })
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.log(error.message)
|
|
124
|
+
|
|
125
|
+
return false
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return true
|
|
129
|
+
}
|
|
130
|
+
|
|
109
131
|
async #createBuilder () {
|
|
110
132
|
const name = `toa-${newid()}`
|
|
111
133
|
const create = `buildx create --name ${name} --bootstrap --use`.split(' ')
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import type * as _norm from '@toa.io/norm/types'
|
|
2
2
|
import type * as _dependency from './dependency'
|
|
3
|
-
import type * as _image from
|
|
3
|
+
import type * as _image from './images/image'
|
|
4
4
|
|
|
5
5
|
declare namespace toa.deployment {
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
interface Registry {
|
|
8
|
-
composition(composition: _norm.Composition): _image.Image
|
|
8
|
+
composition (composition: _norm.Composition): _image.Image
|
|
9
|
+
|
|
10
|
+
service (path: string, service: _dependency.Service): _image.Image
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
prepare (path: string): Promise<string>
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
build (): Promise<void>
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
push (): Promise<void>
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
tags (): string[]
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Manifest } from '@toa.io/norm'
|
|
2
|
+
import type { Locator } from '@toa.io/core'
|
|
3
|
+
|
|
4
|
+
export interface Service {
|
|
5
|
+
group: string
|
|
6
|
+
name: string
|
|
7
|
+
version: string
|
|
8
|
+
port?: number
|
|
9
|
+
ingress?: Ingress
|
|
10
|
+
resources?: Resources
|
|
11
|
+
variables?: Variable[]
|
|
12
|
+
components?: string[]
|
|
13
|
+
probe?: Probe
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Variable {
|
|
17
|
+
name: string
|
|
18
|
+
value?: string
|
|
19
|
+
secret?: {
|
|
20
|
+
name: string
|
|
21
|
+
key: string
|
|
22
|
+
optional?: boolean
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Instance<T> {
|
|
27
|
+
locator: Locator
|
|
28
|
+
manifest: T
|
|
29
|
+
component: Manifest
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type Instances<T> = Array<Instance<T>>
|
|
33
|
+
|
|
34
|
+
export type Variables = Record<'global' | string, Variable[]>
|
|
35
|
+
export type Mounts = Record<'global' | string, Mount[]>
|
|
36
|
+
|
|
37
|
+
export interface Dependency {
|
|
38
|
+
services?: Service[]
|
|
39
|
+
variables?: Variables
|
|
40
|
+
mounts?: Mounts
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface Ingress {
|
|
44
|
+
default?: boolean
|
|
45
|
+
hosts?: string[]
|
|
46
|
+
class?: string
|
|
47
|
+
annotations?: object
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface Probe {
|
|
51
|
+
port: number
|
|
52
|
+
path: string
|
|
53
|
+
delay?: number
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface Mount {
|
|
57
|
+
name: string
|
|
58
|
+
path: string
|
|
59
|
+
claim: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface Resources {
|
|
63
|
+
cpu: string[]
|
|
64
|
+
memory: string[]
|
|
65
|
+
}
|
package/types/dependency.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type Service = {
|
|
2
|
-
group: string
|
|
3
|
-
name: string
|
|
4
|
-
version: string
|
|
5
|
-
port: number
|
|
6
|
-
ingress?: {
|
|
7
|
-
host: string
|
|
8
|
-
class?: string
|
|
9
|
-
annotations?: object
|
|
10
|
-
}
|
|
11
|
-
variables: Variable[]
|
|
12
|
-
components?: string[]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type Variable = {
|
|
16
|
-
name: string
|
|
17
|
-
value?: string
|
|
18
|
-
secret?: {
|
|
19
|
-
name: string,
|
|
20
|
-
key: string
|
|
21
|
-
optional?: boolean
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type Variables = Record<'global' | string, Variable[]>
|
|
26
|
-
|
|
27
|
-
export type Dependency = {
|
|
28
|
-
services?: Service[]
|
|
29
|
-
variables?: Variables
|
|
30
|
-
}
|
|
File without changes
|