Skip to content

Commit 734d001

Browse files
Bump kr8s to 0.17 and Kubernetes supported versions (#897)
* Bump kr8s to 0.17 and use new_class for Dask resource classes * Remove unecessary class attributes * Bump supported Kubernetes versions * Bump README badges
1 parent 6d3d9b2 commit 734d001

File tree

5 files changed

+18
-53
lines changed

5 files changed

+18
-53
lines changed

.github/workflows/operator.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
python-version: ["3.9", "3.10", "3.11", "3.12"]
29-
kubernetes-version: ["1.29.2"]
29+
kubernetes-version: ["1.30.2"]
3030
include:
3131
- python-version: '3.10'
32-
kubernetes-version: 1.28.7
32+
kubernetes-version: 1.29.4
3333
- python-version: '3.10'
34-
kubernetes-version: 1.27.11
35-
- python-version: '3.10'
36-
kubernetes-version: 1.26.14
34+
kubernetes-version: 1.28.9
3735

3836
env:
3937
KUBECONFIG: .pytest-kind/pytest-kind/kubeconfig

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Dask Kubernetes
3434
:target: https://kubernetes.dask.org/en/latest/installing.html#supported-versions
3535
:alt: Python Support
3636

37-
.. image:: https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.27%7C1.28%7C1.29-blue
37+
.. image:: https://img.shields.io/badge/Kubernetes%20support-1.28%7C1.29%7C1.30-blue
3838
:target: https://kubernetes.dask.org/en/latest/installing.html#supported-versions
3939
:alt: Kubernetes Support
4040

dask_kubernetes/operator/_objects.py

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,23 @@
22

33
from typing import List
44

5-
from kr8s.asyncio.objects import APIObject, Deployment, Pod, Service
5+
from kr8s.asyncio.objects import Deployment, Pod, Service, new_class
66

77

8-
class DaskCluster(APIObject):
9-
version = "kubernetes.dask.org/v1"
10-
endpoint = "daskclusters"
11-
kind = "DaskCluster"
12-
plural = "daskclusters"
13-
singular = "daskcluster"
14-
namespaced = True
8+
class DaskCluster(new_class("DaskCluster", "kubernetes.dask.org/v1")):
159
scalable = True
1610
scalable_spec = "worker.replicas"
1711

1812
async def worker_groups(self) -> List[DaskWorkerGroup]:
19-
return await self.api.get(
20-
DaskWorkerGroup.endpoint,
13+
return await DaskWorkerGroup.list(
2114
label_selector=f"dask.org/cluster-name={self.name}",
2215
namespace=self.namespace,
2316
)
2417

2518
async def scheduler_pod(self) -> Pod:
2619
pods = []
2720
while not pods:
28-
pods = await self.api.get(
29-
Pod.endpoint,
21+
pods = await Pod.list(
3022
label_selector=",".join(
3123
[
3224
f"dask.org/cluster-name={self.name}",
@@ -41,8 +33,7 @@ async def scheduler_pod(self) -> Pod:
4133
async def scheduler_deployment(self) -> Deployment:
4234
deployments = []
4335
while not deployments:
44-
deployments = await self.api.get(
45-
Deployment.endpoint,
36+
deployments = await Deployment.list(
4637
label_selector=",".join(
4738
[
4839
f"dask.org/cluster-name={self.name}",
@@ -57,8 +48,7 @@ async def scheduler_deployment(self) -> Deployment:
5748
async def scheduler_service(self) -> Service:
5849
services = []
5950
while not services:
60-
services = await self.api.get(
61-
Service.endpoint,
51+
services = await Service.list(
6252
label_selector=",".join(
6353
[
6454
f"dask.org/cluster-name={self.name}",
@@ -79,19 +69,12 @@ async def ready(self) -> bool:
7969
)
8070

8171

82-
class DaskWorkerGroup(APIObject):
83-
version = "kubernetes.dask.org/v1"
84-
endpoint = "daskworkergroups"
85-
kind = "DaskWorkerGroup"
86-
plural = "daskworkergroups"
87-
singular = "daskworkergroup"
88-
namespaced = True
72+
class DaskWorkerGroup(new_class("DaskWorkerGroup", "kubernetes.dask.org/v1")):
8973
scalable = True
9074
scalable_spec = "worker.replicas"
9175

9276
async def pods(self) -> List[Pod]:
93-
return await self.api.get(
94-
Pod.endpoint,
77+
return await Pod.list(
9578
label_selector=",".join(
9679
[
9780
f"dask.org/cluster-name={self.spec.cluster}",
@@ -103,8 +86,7 @@ async def pods(self) -> List[Pod]:
10386
)
10487

10588
async def deployments(self) -> List[Deployment]:
106-
return await self.api.get(
107-
Deployment.endpoint,
89+
return await Deployment.list(
10890
label_selector=",".join(
10991
[
11092
f"dask.org/cluster-name={self.spec.cluster}",
@@ -119,34 +101,19 @@ async def cluster(self) -> DaskCluster:
119101
return await DaskCluster.get(self.spec.cluster, namespace=self.namespace)
120102

121103

122-
class DaskAutoscaler(APIObject):
123-
version = "kubernetes.dask.org/v1"
124-
endpoint = "daskautoscalers"
125-
kind = "DaskAutoscaler"
126-
plural = "daskautoscalers"
127-
singular = "daskautoscaler"
128-
namespaced = True
129-
104+
class DaskAutoscaler(new_class("DaskAutoscaler", "kubernetes.dask.org/v1")):
130105
async def cluster(self) -> DaskCluster:
131106
return await DaskCluster.get(self.spec.cluster, namespace=self.namespace)
132107

133108

134-
class DaskJob(APIObject):
135-
version = "kubernetes.dask.org/v1"
136-
endpoint = "daskjobs"
137-
kind = "DaskJob"
138-
plural = "daskjobs"
139-
singular = "daskjob"
140-
namespaced = True
141-
109+
class DaskJob(new_class("DaskJob", "kubernetes.dask.org/v1")):
142110
async def cluster(self) -> DaskCluster:
143111
return await DaskCluster.get(self.name, namespace=self.namespace)
144112

145113
async def pod(self) -> Pod:
146114
pods = []
147115
while not pods:
148-
pods = await self.api.get(
149-
Pod.endpoint,
116+
pods = await Pod.list(
150117
label_selector=",".join(
151118
[
152119
f"dask.org/cluster-name={self.name}",

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Dask Kubernetes Operator
1313
:target: https://kubernetes.dask.org/en/latest/installing.html#supported-versions
1414
:alt: Python Support
1515

16-
.. image:: https://img.shields.io/badge/Kubernetes%20support-1.26%7C1.27%7C1.28%7C1.29-blue
16+
.. image:: https://img.shields.io/badge/Kubernetes%20support-1.28%7C1.29%7C1.30-blue
1717
:target: https://kubernetes.dask.org/en/latest/installing.html#supported-versions
1818
:alt: Kubernetes Support
1919

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies = [
1515
"dask>=2022.08.1",
1616
"distributed>=2022.08.1",
1717
"kopf>=1.35.3",
18-
"kr8s==0.14.*",
18+
"kr8s==0.17.*",
1919
"kubernetes-asyncio>=12.0.1",
2020
"kubernetes>=12.0.1",
2121
"pykube-ng>=22.9.0",

0 commit comments

Comments
 (0)