@toa.io/operations 1.0.0-alpha.156 → 1.0.0-alpha.164

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.156",
3
+ "version": "1.0.0-alpha.164",
4
4
  "description": "Toa Deployment",
5
5
  "homepage": "https://toa.io",
6
6
  "author": {
@@ -34,5 +34,5 @@
34
34
  "execa": "5.1.1",
35
35
  "fs-extra": "11.1.1"
36
36
  },
37
- "gitHead": "687ebdf64b8fbc177e3a802440ecd6c96d6b068f"
37
+ "gitHead": "b5c5d885277df7db99885b84b33b8a8634c75f46"
38
38
  }
@@ -19,6 +19,25 @@ 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 }}
@@ -16,6 +16,25 @@ 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 }}
@@ -10,6 +10,9 @@ compositions:
10
10
  components:
11
11
  - todos-tasks
12
12
  - todos-stats
13
+ resources:
14
+ cpu: [100m, 1]
15
+ memory: [100Mi, 1Gi]
13
16
  variables:
14
17
  - name: TOA_CONFIGURATION_TODOS_TASKS
15
18
  value: foo
@@ -31,6 +34,9 @@ services:
31
34
  image: localhost:5000/resources-gateway:0.0.0
32
35
  port: 8000
33
36
  replicas: 2
37
+ resources:
38
+ cpu: [100m, 1]
39
+ memory: [100Mi, 1Gi]
34
40
  ingress:
35
41
  default: true
36
42
  hosts: [dummies.toa.io]
@@ -10,6 +10,7 @@ class Composition {
10
10
  this.name = composition.name
11
11
  this.image = image.reference
12
12
  this.components = composition.components.map(component)
13
+ this.resources = composition.resources
13
14
  }
14
15
  }
15
16
 
@@ -7,6 +7,7 @@ export interface Service {
7
7
  version: string
8
8
  port?: number
9
9
  ingress?: Ingress
10
+ resources?: Resources
10
11
  variables?: Variable[]
11
12
  components?: string[]
12
13
  probe?: Probe
@@ -57,3 +58,8 @@ interface Mount {
57
58
  path: string
58
59
  claim: string
59
60
  }
61
+
62
+ export interface Resources {
63
+ cpu: string[]
64
+ memory: string[]
65
+ }