Skip to content

Commit f6361be

Browse files
Add DaskJob resource (#504)
* Add DaskJob resource * Remove unused completions and parallelism options for now * Remove completions from test manifest
1 parent a55083a commit f6361be

File tree

20 files changed

+18639
-418
lines changed

20 files changed

+18639
-418
lines changed

ci/pre-commit-crd.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def main(version, *args):
8282
# TODO: Not sure how to do this other than hard-code the template names
8383
run_action("daskcluster.yaml", temp_dir, crd_path, output_paths)
8484
run_action("daskworkergroup.yaml", temp_dir, crd_path, output_paths)
85+
run_action("daskjob.yaml", temp_dir, crd_path, output_paths)
8586

8687
else:
8788
run_action(changed_file, temp_dir, crd_path, output_paths)

dask_kubernetes/conftest.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,12 @@ def customresources(k8s_cluster):
6565
temp_dir = tempfile.TemporaryDirectory()
6666
crd_path = os.path.join(DIR, "operator", "customresources")
6767

68-
run_generate(
69-
os.path.join(crd_path, "daskcluster.yaml"),
70-
os.path.join(crd_path, "daskcluster.patch.yaml"),
71-
os.path.join(temp_dir.name, "daskcluster.yaml"),
72-
)
73-
run_generate(
74-
os.path.join(crd_path, "daskworkergroup.yaml"),
75-
os.path.join(crd_path, "daskworkergroup.patch.yaml"),
76-
os.path.join(temp_dir.name, "daskworkergroup.yaml"),
77-
)
68+
for crd in ["daskcluster", "daskworkergroup", "daskjob"]:
69+
run_generate(
70+
os.path.join(crd_path, f"{crd}.yaml"),
71+
os.path.join(crd_path, f"{crd}.patch.yaml"),
72+
os.path.join(temp_dir.name, f"{crd}.yaml"),
73+
)
7874

7975
k8s_cluster.kubectl("apply", "-f", temp_dir.name)
8076
yield

dask_kubernetes/operator/customresources/daskcluster.yaml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,9 @@ spec:
1818
storage: true
1919
schema:
2020
openAPIV3Schema:
21-
type: object
22-
properties:
23-
status:
24-
type: object
25-
spec:
26-
type: object
27-
required:
28-
- scheduler
29-
- worker
30-
properties:
31-
scheduler:
32-
$ref: 'python://dask_kubernetes/operator/customresources/templates.yaml#/definitions/dask.k8s.api.v1.DaskScheduler'
33-
worker:
34-
$ref: 'python://dask_kubernetes/operator/customresources/templates.yaml#/definitions/dask.k8s.api.v1.DaskWorker'
35-
21+
$ref: 'python://dask_kubernetes/operator/customresources/templates.yaml#/definitions/dask.k8s.api.v1.DaskCluster'
22+
3623
subresources:
3724
scale:
3825
specReplicasPath: .spec.worker.replicas
39-
statusReplicasPath: .status.replicas
26+
statusReplicasPath: .status.replicas
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/job/properties/spec/properties/containers/items/properties/ports/items/properties/protocol/default", "value": "TCP"},
3+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/job/properties/spec/properties/initContainers/items/properties/ports/items/properties/protocol/default", "value": "TCP"},
4+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/job/properties/spec/properties/restartPolicy/default", "value": "OnFailure"},
5+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/cluster/properties/spec/properties/worker/properties/spec/properties/initContainers/items/properties/ports/items/properties/protocol/default", "value": "TCP"},
6+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/cluster/properties/spec/properties/worker/properties/spec/properties/containers/items/properties/ports/items/properties/protocol/default", "value": "TCP"},
7+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/cluster/properties/spec/properties/scheduler/properties/service/properties/ports/items/properties/protocol/default", "value": "TCP"},
8+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/cluster/properties/spec/properties/scheduler/properties/spec/properties/containers/items/properties/ports/items/properties/protocol/default", "value": "TCP"},
9+
{"op": "add", "path": "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/cluster/properties/spec/properties/scheduler/properties/spec/properties/initContainers/items/properties/ports/items/properties/protocol/default", "value": "TCP"}
10+
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: daskjobs.kubernetes.dask.org
5+
spec:
6+
scope: Namespaced
7+
group: kubernetes.dask.org
8+
names:
9+
kind: DaskJob
10+
plural: daskjobs
11+
singular: daskjob
12+
shortNames:
13+
- djb
14+
versions:
15+
- name: v1
16+
served: true
17+
storage: true
18+
schema:
19+
openAPIV3Schema:
20+
type: object
21+
properties:
22+
status:
23+
type: object
24+
spec:
25+
type: object
26+
required:
27+
- cluster
28+
- job
29+
properties:
30+
job:
31+
type: object
32+
properties:
33+
spec:
34+
$ref: 'python://k8s_crd_resolver/schemata/k8s-1.21.1.json#/definitions/io.k8s.api.core.v1.PodSpec'
35+
cluster:
36+
$ref: 'python://dask_kubernetes/operator/customresources/templates.yaml#/definitions/dask.k8s.api.v1.DaskCluster'

dask_kubernetes/operator/customresources/templates.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ definitions:
1212
description: Number of workers to start
1313
spec:
1414
$ref: 'python://k8s_crd_resolver/schemata/k8s-1.21.1.json#/definitions/io.k8s.api.core.v1.PodSpec'
15-
15+
1616
dask.k8s.api.v1.DaskScheduler:
1717
type: object
1818
description: Dask scheduler configuration
@@ -23,4 +23,23 @@ definitions:
2323
spec:
2424
$ref: 'python://k8s_crd_resolver/schemata/k8s-1.21.1.json#/definitions/io.k8s.api.core.v1.PodSpec'
2525
service:
26-
$ref: 'python://k8s_crd_resolver/schemata/k8s-1.21.1.json#/definitions/io.k8s.api.core.v1.ServiceSpec'
26+
$ref: 'python://k8s_crd_resolver/schemata/k8s-1.21.1.json#/definitions/io.k8s.api.core.v1.ServiceSpec'
27+
28+
dask.k8s.api.v1.DaskCluster:
29+
type: object
30+
description: Dask scheduler configuration
31+
required:
32+
- spec
33+
properties:
34+
status:
35+
type: object
36+
spec:
37+
type: object
38+
required:
39+
- scheduler
40+
- worker
41+
properties:
42+
scheduler:
43+
$ref: 'python://dask_kubernetes/operator/customresources/templates.yaml#/definitions/dask.k8s.api.v1.DaskScheduler'
44+
worker:
45+
$ref: 'python://dask_kubernetes/operator/customresources/templates.yaml#/definitions/dask.k8s.api.v1.DaskWorker'

dask_kubernetes/operator/deployment/helm/dask-kubernetes-operator/crds/daskcluster.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5895,6 +5895,8 @@ spec:
58955895
type: object
58965896
status:
58975897
type: object
5898+
required:
5899+
- spec
58985900
type: object
58995901
served: true
59005902
storage: true

0 commit comments

Comments
 (0)