@toa.io/operations 1.0.0-alpha.26 → 1.0.0-alpha.261

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/image/runtime.Dockerfile +4 -0
  3. package/package.json +8 -8
  4. package/readme.md +16 -0
  5. package/src/deployment/.deployment/.describe/compositions.js +7 -2
  6. package/src/deployment/.deployment/.describe/mounts.js +24 -0
  7. package/src/deployment/.deployment/.describe/services.js +6 -1
  8. package/src/deployment/.deployment/.describe/variables.js +6 -5
  9. package/src/deployment/.deployment/describe.js +60 -5
  10. package/src/deployment/.deployment/merge.js +8 -1
  11. package/src/deployment/chart/templates/compositions.yaml +70 -0
  12. package/src/deployment/chart/templates/mono.yaml +168 -0
  13. package/src/deployment/chart/templates/services.yaml +67 -2
  14. package/src/deployment/chart/values.yaml +11 -1
  15. package/src/deployment/composition.js +1 -0
  16. package/src/deployment/deployment.js +6 -2
  17. package/src/deployment/factory.js +26 -8
  18. package/src/deployment/images/composition.Dockerfile +2 -2
  19. package/src/deployment/images/composition.js +16 -6
  20. package/src/deployment/images/factory.js +12 -3
  21. package/src/deployment/images/image.js +16 -7
  22. package/src/deployment/images/mono.Dockerfile +18 -0
  23. package/src/deployment/images/mono.js +82 -0
  24. package/src/deployment/images/runtime-base.test.js +90 -0
  25. package/src/deployment/images/service.Dockerfile +3 -3
  26. package/src/deployment/operator.js +4 -0
  27. package/src/deployment/registry.js +64 -16
  28. package/src/deployment/registry.test.js +175 -0
  29. package/types/_deployment/images/image.d.ts +4 -2
  30. package/types/_deployment/registry.d.ts +9 -7
  31. package/types/dependency.ts +67 -0
  32. package/types/dependency.d.ts +0 -39
  33. /package/types/{index.d.ts → index.ts} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [1.0.0-alpha.261](https://github.com/toa-io/toa/compare/v1.0.0-alpha.260...v1.0.0-alpha.261) (2026-08-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **operations:** include extension pointer variables in --mono ([f8be23d](https://github.com/toa-io/toa/commit/f8be23d2aaf7bbe1b0580101c8bf4d32c3cab99f))
12
+
13
+
14
+
15
+
16
+
17
+ # [1.0.0-alpha.259](https://github.com/toa-io/toa/compare/v1.0.0-alpha.258...v1.0.0-alpha.259) (2026-08-24)
18
+
19
+ **Note:** Version bump only for package @toa.io/operations
20
+
21
+
22
+
23
+
24
+
25
+ # [1.0.0-alpha.257](https://github.com/toa-io/toa/compare/v1.0.0-alpha.256...v1.0.0-alpha.257) (2026-08-24)
26
+
27
+ **Note:** Version bump only for package @toa.io/operations
28
+
29
+
30
+
31
+
32
+
33
+ # [1.0.0-alpha.256](https://github.com/toa-io/toa/compare/v1.0.0-alpha.255...v1.0.0-alpha.256) (2026-08-23)
34
+
35
+
36
+ ### Features
37
+
38
+ * deploy a single mono image with toa deploy --mono ([a7f14f9](https://github.com/toa-io/toa/commit/a7f14f9877a280e9c74d16c195028b35d74fb15a))
@@ -0,0 +1,4 @@
1
+ FROM node:24.14.0-alpine3.22
2
+
3
+ ARG VERSION
4
+ RUN npm i -g @toa.io/runtime@${VERSION} --omit=dev
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/operations",
3
- "version": "1.0.0-alpha.26",
3
+ "version": "1.0.0-alpha.261",
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": ">= 18.0.0"
19
+ "node": ">= 24.0.0"
20
20
  },
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
24
  "main": "src/index.js",
25
- "types": "types/index.d.ts",
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.26",
31
- "@toa.io/generic": "1.0.0-alpha.26",
32
- "@toa.io/norm": "1.0.0-alpha.26",
33
- "@toa.io/yaml": "1.0.0-alpha.26",
30
+ "@toa.io/filesystem": "1.0.0-alpha.254",
31
+ "@toa.io/generic": "1.0.0-alpha.254",
32
+ "@toa.io/norm": "1.0.0-alpha.259",
33
+ "@toa.io/yaml": "1.0.0-alpha.254",
34
34
  "execa": "5.1.1",
35
35
  "fs-extra": "11.1.1"
36
36
  },
37
- "gitHead": "0ddd9260762d1fe2b8be88eb7b9725e3f7838299"
37
+ "gitHead": "0351da80ae8f1757c950a6787521941931d400c4"
38
38
  }
package/readme.md CHANGED
@@ -4,6 +4,22 @@
4
4
 
5
5
  ### Container Registry
6
6
 
7
+ Deploy images default to `FROM ghcr.io/toa-io/runtime:<runtime.version>`
8
+ (published with each Toa release). The base image already has `@toa.io/runtime`
9
+ installed; composition/service Dockerfiles only install component dependencies.
10
+
11
+ To use a custom base image, set `registry.build.image` (or `composition.image`).
12
+ That image must provide the `toa` CLI, or install it via `registry.build.run`:
13
+
14
+ ```yaml
15
+ # context.toa.yaml
16
+
17
+ registry:
18
+ build:
19
+ image: node:24.14.0-alpine3.22
20
+ run: npm i -g @toa.io/runtime --omit=dev
21
+ ```
22
+
7
23
  #### Build Options
8
24
 
9
25
  ```yaml
@@ -1,10 +1,15 @@
1
1
  'use strict'
2
2
 
3
3
  const { addVariables } = require('./variables')
4
+ const { addMounts } = require('./mounts')
4
5
 
5
- function compositions (compositions, variables) {
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)
10
+
11
+ if (dependency.probe !== undefined && dependency.probe !== false)
12
+ composition.probe ??= dependency.probe
8
13
  }
9
14
  }
10
15
 
@@ -0,0 +1,24 @@
1
+ 'use strict'
2
+
3
+ function addMounts (composition, mounts, keys = composition.components) {
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' && !keys?.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
@@ -2,9 +2,14 @@
2
2
 
3
3
  const { addVariables } = require('./variables')
4
4
 
5
- function services (services, variables) {
5
+ function services (services, variables, probe) {
6
6
  for (const service of services) {
7
7
  addVariables(service, variables)
8
+
9
+ if (service.probe === false)
10
+ delete service.probe
11
+ else if (service.probe === undefined && probe !== undefined && probe !== false)
12
+ service.probe = probe
8
13
  }
9
14
  }
10
15
 
@@ -1,17 +1,18 @@
1
1
  'use strict'
2
2
 
3
- function addVariables (deployment, variables) {
4
- const used = new Set()
3
+ function addVariables (composition, variables, keys = composition.components) {
4
+ composition.variables ??= []
5
5
 
6
- deployment.variables ??= []
6
+ const used = new Set(composition.variables.map((variable) => variable.name))
7
7
 
8
8
  for (const [key, set] of Object.entries(variables)) {
9
- if (key !== 'global' && !deployment.components?.includes(key)) continue
9
+ if (key !== 'global' && !keys?.includes(key))
10
+ continue
10
11
 
11
12
  for (const variable of set) {
12
13
  if (used.has(variable.name)) continue
13
14
 
14
- deployment.variables.push(variable)
15
+ composition.variables.push(variable)
15
16
  used.add(variable.name)
16
17
  }
17
18
  }
@@ -1,8 +1,10 @@
1
1
  'use strict'
2
2
 
3
- const get = require('./.describe')
3
+ const desc = require('./.describe')
4
+ const { addVariables } = require('./.describe/variables')
5
+ const { addMounts } = require('./.describe/mounts')
4
6
 
5
- const describe = (context, compositions, dependency) => {
7
+ const describe = (context, compositions, dependency, image) => {
6
8
  const { services } = dependency
7
9
 
8
10
  dependency.variables.global ??= []
@@ -17,11 +19,26 @@ const describe = (context, compositions, dependency) => {
17
19
  }
18
20
  )
19
21
 
20
- const components = get.components(compositions)
21
22
  const credentials = context.registry?.credentials
22
23
 
23
- get.compositions(compositions, dependency.variables, context.environment)
24
- get.services(services, dependency.variables)
24
+ if (image !== undefined) {
25
+ const mono = unit(context, dependency)
26
+
27
+ mono.image = image.reference
28
+
29
+ return {
30
+ compositions: [],
31
+ components: mono.components,
32
+ services: [],
33
+ credentials,
34
+ mono
35
+ }
36
+ }
37
+
38
+ const components = desc.components(compositions)
39
+
40
+ desc.compositions(compositions, dependency)
41
+ desc.services(services, dependency.variables, dependency.probe)
25
42
 
26
43
  return {
27
44
  compositions,
@@ -31,4 +48,42 @@ const describe = (context, compositions, dependency) => {
31
48
  }
32
49
  }
33
50
 
51
+ function unit (context, dependency) {
52
+ const components = (context.components ?? []).map((component) => component.locator.label)
53
+
54
+ const variables = dependency.variables ?? {}
55
+ const mounts = dependency.mounts ?? {}
56
+
57
+ const mono = {
58
+ replicas: context.mono?.replicas,
59
+ resources: context.mono?.resources,
60
+ components,
61
+ variables: []
62
+ }
63
+
64
+ addVariables(mono, variables, Object.keys(variables))
65
+ addMounts(mono, dependency.mounts, Object.keys(mounts))
66
+
67
+ for (const service of dependency.services ?? []) {
68
+ if (service.variables !== undefined)
69
+ for (const variable of service.variables)
70
+ if (!mono.variables.some((item) => item.name === variable.name))
71
+ mono.variables.push(variable)
72
+
73
+ if (service.port !== undefined)
74
+ mono.port = service.port
75
+
76
+ if (service.ingress !== undefined)
77
+ mono.ingress = service.ingress
78
+
79
+ if (service.probe !== undefined && service.probe !== false)
80
+ mono.probe = service.probe
81
+ }
82
+
83
+ if (mono.probe === undefined && dependency.probe !== undefined && dependency.probe !== false)
84
+ mono.probe = dependency.probe
85
+
86
+ return mono
87
+ }
88
+
34
89
  exports.describe = describe
@@ -13,14 +13,21 @@ const merge = (dependencies) => {
13
13
  /** @type {toa.deployment.dependency.Variables} */
14
14
  const variables = {}
15
15
 
16
+ const mounts = {}
17
+
18
+ /** @type {toa.deployment.dependency.Probe | false | undefined} */
19
+ let probe
20
+
16
21
  for (const dependency of dependencies) {
17
22
  if (dependency.references !== undefined) references.push(...dependency.references)
18
23
  if (dependency.services !== undefined) services.push(...dependency.services)
19
24
  if (dependency.proxies !== undefined) proxies.push(...dependency.proxies)
20
25
  if (dependency.variables !== undefined) append(variables, dependency.variables)
26
+ if (dependency.mounts !== undefined) append(mounts, dependency.mounts)
27
+ if (dependency.probe !== undefined) probe = dependency.probe
21
28
  }
22
29
 
23
- return { references, services, proxies, variables }
30
+ return { references, services, proxies, variables, mounts, probe }
24
31
  }
25
32
 
26
33
  const append = (merged, variables) => {
@@ -5,6 +5,9 @@ metadata:
5
5
  name: composition-{{ required "composition name is required" .name }}
6
6
  spec:
7
7
  replicas: {{ .replicas | default 2 }}
8
+ # A backstop for stuck rollouts only. Must stay above the `helm upgrade --timeout`
9
+ # the deploy runs with, so a slow but progressing rollout is not marked failed.
10
+ progressDeadlineSeconds: 900
8
11
  selector:
9
12
  matchLabels:
10
13
  toa.io/composition: {{ .name }}
@@ -19,15 +22,82 @@ spec:
19
22
  containers:
20
23
  - name: {{ .name }}
21
24
  image: {{ .image }}
25
+ {{- if .resources }}
26
+ resources:
27
+ {{- if or .resources.cpu .resources.memory }}
28
+ requests:
29
+ {{- if .resources.cpu }}
30
+ cpu: {{ index .resources.cpu 0 }}
31
+ {{- end }}
32
+ {{- if .resources.memory }}
33
+ memory: {{ index .resources.memory 0 }}
34
+ {{- end }}
35
+ limits:
36
+ {{- if .resources.cpu }}
37
+ cpu: {{ index .resources.cpu 1 }}
38
+ {{- end }}
39
+ {{- if .resources.memory }}
40
+ memory: {{ index .resources.memory 1 }}
41
+ {{- end }}
42
+ {{- end }}
43
+ {{- end }}
22
44
  {{- if .variables }}
23
45
  env:
24
46
  {{- range .variables }}
25
47
  {{- include "env.var" . | indent 12 }}
26
48
  {{- end }}
27
49
  {{- end }}
50
+ {{- if .probe }}
51
+ ports:
52
+ - containerPort: {{ .probe.port }}
53
+ startupProbe:
54
+ httpGet:
55
+ path: {{ .probe.path }}
56
+ port: {{ .probe.port }}
57
+ {{- if .probe.delay }}
58
+ initialDelaySeconds: {{ .probe.delay }}
59
+ {{- end }}
60
+ periodSeconds: 2
61
+ timeoutSeconds: 3
62
+ failureThreshold: 150
63
+ readinessProbe:
64
+ httpGet:
65
+ path: {{ .probe.path }}
66
+ port: {{ .probe.port }}
67
+ periodSeconds: 10
68
+ timeoutSeconds: 3
69
+ failureThreshold: 3
70
+ {{- end }}
71
+ {{- if .mounts }}
72
+ volumeMounts:
73
+ {{- range .mounts }}
74
+ - name: {{ .name }}
75
+ mountPath: {{ .path }}
76
+ {{- end }}
77
+ {{- end }}
78
+ lifecycle:
79
+ preStop:
80
+ exec:
81
+ command: [sleep, "5"]
82
+ terminationGracePeriodSeconds: 45
28
83
  {{- if $.Values.credentials }}
29
84
  imagePullSecrets:
30
85
  - name: {{ $.Values.credentials }}
31
86
  {{- end }}
87
+ {{- if .mounts }}
88
+ volumes:
89
+ {{- range .mounts }}
90
+ - name: {{ .name }}
91
+ persistentVolumeClaim:
92
+ claimName: {{ .claim }}
93
+ {{- end }}
94
+ {{- end }}
95
+ topologySpreadConstraints:
96
+ - maxSkew: 1
97
+ topologyKey: kubernetes.io/hostname
98
+ whenUnsatisfiable: ScheduleAnyway
99
+ labelSelector:
100
+ matchLabels:
101
+ toa.io/composition: {{ .name }}
32
102
  ---
33
103
  {{- end }}
@@ -0,0 +1,168 @@
1
+ {{- if .Values.mono }}
2
+ {{- with .Values.mono }}
3
+ apiVersion: apps/v1
4
+ kind: Deployment
5
+ metadata:
6
+ name: mono
7
+ spec:
8
+ replicas: {{ .replicas | default 2 }}
9
+ progressDeadlineSeconds: 900
10
+ strategy:
11
+ type: RollingUpdate
12
+ rollingUpdate:
13
+ maxUnavailable: 0
14
+ maxSurge: 50%
15
+ selector:
16
+ matchLabels:
17
+ toa.io/composition: mono
18
+ template:
19
+ metadata:
20
+ labels:
21
+ toa.io/composition: mono
22
+ {{- range .components }}
23
+ {{ . }}: "1"
24
+ {{- end }}
25
+ spec:
26
+ containers:
27
+ - name: mono
28
+ image: {{ .image }}
29
+ {{- if .port }}
30
+ ports:
31
+ - containerPort: {{ .port }}
32
+ {{- else if .probe }}
33
+ ports:
34
+ - containerPort: {{ .probe.port }}
35
+ {{- end }}
36
+ {{- if .resources }}
37
+ resources:
38
+ {{- if or .resources.cpu .resources.memory }}
39
+ requests:
40
+ {{- if .resources.cpu }}
41
+ cpu: {{ index .resources.cpu 0 }}
42
+ {{- end }}
43
+ {{- if .resources.memory }}
44
+ memory: {{ index .resources.memory 0 }}
45
+ {{- end }}
46
+ limits:
47
+ {{- if .resources.cpu }}
48
+ cpu: {{ index .resources.cpu 1 }}
49
+ {{- end }}
50
+ {{- if .resources.memory }}
51
+ memory: {{ index .resources.memory 1 }}
52
+ {{- end }}
53
+ {{- end }}
54
+ {{- end }}
55
+ {{- if .variables }}
56
+ env:
57
+ {{- range .variables }}
58
+ {{- include "env.var" . | indent 12 }}
59
+ {{- end }}
60
+ {{- end }}
61
+ {{- if .probe }}
62
+ startupProbe:
63
+ httpGet:
64
+ path: {{ .probe.path }}
65
+ port: {{ .probe.port }}
66
+ {{- if .probe.delay }}
67
+ initialDelaySeconds: {{ .probe.delay }}
68
+ {{- end }}
69
+ periodSeconds: 2
70
+ timeoutSeconds: 3
71
+ failureThreshold: 150
72
+ readinessProbe:
73
+ httpGet:
74
+ path: {{ .probe.path }}
75
+ port: {{ .probe.port }}
76
+ periodSeconds: 10
77
+ timeoutSeconds: 3
78
+ failureThreshold: 3
79
+ {{- end }}
80
+ {{- if .mounts }}
81
+ volumeMounts:
82
+ {{- range .mounts }}
83
+ - name: {{ .name }}
84
+ mountPath: {{ .path }}
85
+ {{- end }}
86
+ {{- end }}
87
+ lifecycle:
88
+ preStop:
89
+ exec:
90
+ command: [sleep, "5"]
91
+ terminationGracePeriodSeconds: 45
92
+ {{- if $.Values.credentials }}
93
+ imagePullSecrets:
94
+ - name: {{ $.Values.credentials }}
95
+ {{- end }}
96
+ {{- if .mounts }}
97
+ volumes:
98
+ {{- range .mounts }}
99
+ - name: {{ .name }}
100
+ persistentVolumeClaim:
101
+ claimName: {{ .claim }}
102
+ {{- end }}
103
+ {{- end }}
104
+ topologySpreadConstraints:
105
+ - maxSkew: 1
106
+ topologyKey: kubernetes.io/hostname
107
+ whenUnsatisfiable: ScheduleAnyway
108
+ labelSelector:
109
+ matchLabels:
110
+ toa.io/composition: mono
111
+ {{- if .port }}
112
+ ---
113
+ apiVersion: v1
114
+ kind: Service
115
+ metadata:
116
+ name: mono
117
+ spec:
118
+ type: ClusterIP
119
+ selector:
120
+ toa.io/composition: mono
121
+ ports:
122
+ - name: port-{{ .port }}
123
+ protocol: TCP
124
+ port: {{ .port }}
125
+ targetPort: {{ .port }}
126
+ {{- end }}
127
+ {{- if .ingress }}
128
+ ---
129
+ apiVersion: networking.k8s.io/v1
130
+ kind: Ingress
131
+ metadata:
132
+ name: mono
133
+ {{- if .ingress.annotations }}
134
+ annotations:
135
+ {{ toYaml .ingress.annotations | indent 4 }}
136
+ {{- end }}
137
+ spec:
138
+ {{- if .ingress.class }}
139
+ ingressClassName: {{ .ingress.class }}
140
+ {{- end }}
141
+ rules:
142
+ {{- range .ingress.hosts }}
143
+ - host: {{ . }}
144
+ http:
145
+ paths:
146
+ - path: /
147
+ pathType: Prefix
148
+ backend:
149
+ service:
150
+ name: mono
151
+ port:
152
+ number: {{ $.Values.mono.port | default 8000 }}
153
+ {{- end }}
154
+ {{- if .ingress.default }}
155
+ - http:
156
+ paths:
157
+ - path: /
158
+ pathType: Prefix
159
+ backend:
160
+ service:
161
+ name: mono
162
+ port:
163
+ number: {{ $.Values.mono.port | default 8000 }}
164
+ {{- end }}
165
+ {{- end }}
166
+ ---
167
+ {{- end }}
168
+ {{- end }}
@@ -5,6 +5,16 @@ metadata:
5
5
  name: extension-{{ required "deployment name is required" .name }}
6
6
  spec:
7
7
  replicas: {{ .replicas | default 2 }}
8
+ # A backstop for stuck rollouts only. Must stay above the `helm upgrade --timeout`
9
+ # the deploy runs with, so a slow but progressing rollout is not marked failed.
10
+ progressDeadlineSeconds: 900
11
+ strategy:
12
+ type: RollingUpdate
13
+ rollingUpdate:
14
+ # a replacement must pass readiness before a running replica is taken out,
15
+ # otherwise a single pod serves all traffic while the others start up
16
+ maxUnavailable: 0
17
+ maxSurge: 50%
8
18
  selector:
9
19
  matchLabels:
10
20
  toa.io/service: extension-{{ .name }}
@@ -16,6 +26,25 @@ spec:
16
26
  containers:
17
27
  - name: extension-{{ .name }}
18
28
  image: {{ .image }}
29
+ {{- if .resources }}
30
+ resources:
31
+ {{- if or .resources.cpu .resources.memory }}
32
+ requests:
33
+ {{- if .resources.cpu }}
34
+ cpu: {{ index .resources.cpu 0 }}
35
+ {{- end }}
36
+ {{- if .resources.memory }}
37
+ memory: {{ index .resources.memory 0 }}
38
+ {{- end }}
39
+ limits:
40
+ {{- if .resources.cpu }}
41
+ cpu: {{ index .resources.cpu 1 }}
42
+ {{- end }}
43
+ {{- if .resources.memory }}
44
+ memory: {{ index .resources.memory 1 }}
45
+ {{- end }}
46
+ {{- end }}
47
+ {{- end }}
19
48
  {{- if .variables }}
20
49
  env:
21
50
  {{- range .variables }}
@@ -23,14 +52,37 @@ spec:
23
52
  {{- end }}
24
53
  {{- end }}
25
54
  {{- if .probe }}
26
- readinessProbe:
55
+ startupProbe:
27
56
  httpGet:
28
57
  path: {{ .probe.path }}
29
58
  port: {{ .probe.port }}
30
59
  {{- if .probe.delay }}
31
60
  initialDelaySeconds: {{ .probe.delay }}
32
61
  {{- end }}
62
+ periodSeconds: 2
63
+ timeoutSeconds: 3
64
+ failureThreshold: 150
65
+ readinessProbe:
66
+ httpGet:
67
+ path: {{ .probe.path }}
68
+ port: {{ .probe.port }}
69
+ periodSeconds: 10
70
+ timeoutSeconds: 3
71
+ failureThreshold: 3
33
72
  {{- end }}
73
+ lifecycle:
74
+ preStop:
75
+ exec:
76
+ command: [sleep, "5"]
77
+ terminationGracePeriodSeconds: 45
78
+ topologySpreadConstraints:
79
+ - maxSkew: 1
80
+ topologyKey: kubernetes.io/hostname
81
+ whenUnsatisfiable: ScheduleAnyway
82
+ labelSelector:
83
+ matchLabels:
84
+ toa.io/service: extension-{{ .name }}
85
+ {{- if .port }}
34
86
  ---
35
87
  apiVersion: v1
36
88
  kind: Service
@@ -45,9 +97,10 @@ spec:
45
97
  protocol: TCP
46
98
  port: {{ .port }}
47
99
  targetPort: {{ .port }}
48
- ---
100
+ {{- end }}
49
101
  {{- if .ingress }}
50
102
  {{- $service := .name }}
103
+ ---
51
104
  apiVersion: networking.k8s.io/v1
52
105
  kind: Ingress
53
106
  metadata:
@@ -73,5 +126,17 @@ spec:
73
126
  port:
74
127
  number: 8000
75
128
  {{- end }}
129
+ {{- if .ingress.default }}
130
+ - http:
131
+ paths:
132
+ - path: /
133
+ pathType: Prefix
134
+ backend:
135
+ service:
136
+ name: extension-{{ $service }}
137
+ port:
138
+ number: 8000
139
+ {{- end }}
76
140
  {{- end }}
141
+ ---
77
142
  {{- end }}