You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use region field as comma-delimited node selector for k8s (#657)
* Use `region` field as comma-delimited node selector for k8s
* UPdate docs for k8s region/nodeSelectoR
* Apply suggestions from code review
Co-authored-by: Helio Machado <0x2b3bfa0+git@googlemail.com>
-`region` - (Optional) [Cloud region/zone](#cloud-region) to run the task on.
57
+
-`region` - (Optional) [Cloud region/zone](#cloud-region) to run the task on, or node selector labels for Kubernetes.
58
58
-`machine` - (Optional) See [Machine Types](#machine-type) below.
59
59
-`disk_size` - (Optional) Size of the ephemeral machine storage in GB. `-1`: automatic based on `image`.
60
60
-`spot` - (Optional) Spot instance price. `-1`: disabled, `0`: automatic price, any other positive number: maximum bidding price in USD per hour (above which the instance is terminated until the price drops).
@@ -257,7 +257,25 @@ In addition to generic regions, it's possible to specify any cloud region suppor
257
257
258
258
### Kubernetes
259
259
260
-
The `region` attribute is ignored.
260
+
For Kubernetes, the `region` attribute can be used to set the [`nodeSelector`](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) field of the job specification. The value of `region` should be a comma-delimited list of `key=value` nodel label pairs.
261
+
262
+
For example:
263
+
```tf
264
+
resource "iterative_task" "example" {
265
+
cloud = "k8s"
266
+
region = "foo=bar,goo=baz"
267
+
}
268
+
```
269
+
270
+
This will create a pod with a `nodeSelector` value like the following:
271
+
```yaml
272
+
apiVersion: V1
273
+
kind: Pod
274
+
spec:
275
+
nodeSelector:
276
+
foo: bar
277
+
goo: baz
278
+
```
261
279
262
280
## Permission Set
263
281
@@ -285,10 +303,6 @@ A comma-separated list of [user-assigned identity](https://docs.microsoft.com/en
285
303
286
304
### Kubernetes
287
305
288
-
#### Region attribute
289
-
290
-
Setting the `region` attribute results in undefined behaviour.
291
-
292
306
#### Directory storage
293
307
294
308
Unlike public cloud providers, Kubernetes does not offer any portable way of persisting and sharing storage between pods. When specified, the `storage.workdir` attribute will create a `PersistentVolumeClaim` of the default `StorageClass`, with the same lifecycle as the task and the specified `disk_size`.
0 commit comments