@toa.io/operations 1.0.0-alpha.70 → 1.0.0-alpha.73

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/operations",
3
- "version": "1.0.0-alpha.70",
3
+ "version": "1.0.0-alpha.73",
4
4
  "description": "Toa Deployment",
5
5
  "homepage": "https://toa.io",
6
6
  "author": {
@@ -29,10 +29,10 @@
29
29
  "dependencies": {
30
30
  "@toa.io/filesystem": "1.0.0-alpha.63",
31
31
  "@toa.io/generic": "1.0.0-alpha.63",
32
- "@toa.io/norm": "1.0.0-alpha.67",
32
+ "@toa.io/norm": "1.0.0-alpha.73",
33
33
  "@toa.io/yaml": "1.0.0-alpha.63",
34
34
  "execa": "5.1.1",
35
35
  "fs-extra": "11.1.1"
36
36
  },
37
- "gitHead": "3fe12fa8b6a82fecc9205e9f6dd4b39e03184c7b"
37
+ "gitHead": "3c7d415c68324aae8f1524b2ae06b02eb5832c54"
38
38
  }
@@ -75,6 +75,17 @@ spec:
75
75
  port:
76
76
  number: 8000
77
77
  {{- end }}
78
+ {{- if .ingress.default }}
79
+ - http:
80
+ paths:
81
+ - path: /
82
+ pathType: Prefix
83
+ backend:
84
+ service:
85
+ name: extension-{{ $service }}
86
+ port:
87
+ number: 8000
88
+ {{- end }}
78
89
  {{- end }}
79
90
  ---
80
91
  {{- end }}
@@ -32,6 +32,7 @@ services:
32
32
  port: 8000
33
33
  replicas: 2
34
34
  ingress:
35
+ default: true
35
36
  hosts: [dummies.toa.io]
36
37
  class: alb
37
38
  annotations:
@@ -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])
@@ -16,4 +16,4 @@ COPY --chown=node:node . /composition
16
16
  RUN for entry in *; do if [ -f "$entry/package.json" ]; then (cd $entry && npm i --omit=dev); fi; done
17
17
 
18
18
  USER node
19
- CMD toa compose *
19
+ CMD ["toa", "compose", "*"]
@@ -11,4 +11,4 @@ COPY --chown=node:node . /service
11
11
  RUN npm i --omit=dev
12
12
 
13
13
  USER node
14
- CMD toa serve .
14
+ CMD ["toa", "serve", "."]
@@ -74,6 +74,11 @@ class Registry {
74
74
  * @returns {Promise<void>}
75
75
  */
76
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
+
77
82
  const args = ['--context=default', 'buildx', 'build']
78
83
 
79
84
  if (push) {
@@ -96,7 +101,6 @@ class Registry {
96
101
 
97
102
  args.push('--platform', platform)
98
103
  args.push('--builder', builder)
99
-
100
104
  } else {
101
105
  args.push('--builder', 'default')
102
106
  }
@@ -110,6 +114,18 @@ class Registry {
110
114
  await this.#build(image, true)
111
115
  }
112
116
 
117
+ async exists (tag) {
118
+ const args = ['inspect', tag]
119
+
120
+ try {
121
+ await this.#process.execute('docker', args, { silently: true })
122
+ } catch {
123
+ return false
124
+ }
125
+
126
+ return true
127
+ }
128
+
113
129
  async #createBuilder () {
114
130
  const name = `toa-${newid()}`
115
131
  const create = `buildx create --name ${name} --bootstrap --use`.split(' ')
@@ -4,9 +4,11 @@ declare namespace toa.deployment.images {
4
4
  readonly reference: string
5
5
  readonly context: string
6
6
 
7
- tag(): void
7
+ name: string
8
8
 
9
- prepare(root: string): Promise<string>
9
+ tag (): void
10
+
11
+ prepare (root: string): Promise<string>
10
12
  }
11
13
 
12
14
  }
@@ -40,7 +40,8 @@ export interface Dependency {
40
40
  }
41
41
 
42
42
  interface Ingress {
43
- hosts: string[]
43
+ default?: boolean
44
+ hosts?: string[]
44
45
  class?: string
45
46
  annotations?: object
46
47
  }