@@ -376,63 +376,6 @@ async def daskcluster_create_components(
376376
377377 patch .status ["phase" ] = "Pending"
378378
379-
380- @kopf .on .update ("daskcluster.kubernetes.dask.org" )
381- async def daskcluster_update (
382- spec : kopf .Spec , status : kopf .Status , namespace : str | None , logger : kopf .Logger ,path , meta : kopf .Meta , ** __ : Any
383- ):
384- """When the DaskCluster resource is updated update all the components."""
385- assert namespace
386- # Update scheduler deployment
387- scheduler_deployment = await Deployment (
388- SCHEDULER_NAME_TEMPLATE .format (cluster_name = status ["clusterName" ]), namespace = namespace
389- )
390-
391- scheduler_spec = spec .get ("scheduler" , {})
392- annotations = _get_annotations (meta )
393- labels = _get_labels (meta )
394- if "metadata" in scheduler_spec :
395- if "annotations" in scheduler_spec ["metadata" ]:
396- annotations .update (** scheduler_spec ["metadata" ]["annotations" ])
397- if "labels" in scheduler_spec ["metadata" ]:
398- labels .update (** scheduler_spec ["metadata" ]["labels" ])
399-
400- data = build_scheduler_deployment_spec (status ["clusterName" ], scheduler_spec .get ("spec" ), annotations , labels )
401- if await scheduler_deployment .exists ():
402- await scheduler_deployment .patch (data )
403- else :
404- kopf .adopt (data )
405- await scheduler_deployment .create ()
406-
407- # Update scheduler service
408- scheduler_service = await Service (
409- SCHEDULER_NAME_TEMPLATE .format (cluster_name = status ["clusterName" ]), namespace = namespace
410- )
411- data = build_scheduler_service_spec (status ["clusterName" ], scheduler_spec .get ("service" ), annotations , labels )
412- if await scheduler_service .exists ():
413- await scheduler_service .patch (data )
414- else :
415- kopf .adopt (data )
416- await scheduler_service .create ()
417-
418- # Update default worker group
419- worker_group = await DaskWorkerGroup .get (f"{ status ['clusterName' ]} -default" , namespace = namespace )
420- worker_spec = spec .get ("worker" , {})
421- annotations = _get_annotations (cluster .meta )
422- labels = _get_labels (cluster .meta )
423- if "metadata" in worker_spec :
424- if "annotations" in worker_spec ["metadata" ]:
425- annotations .update (** worker_spec ["metadata" ]["annotations" ])
426- if "labels" in worker_spec ["metadata" ]:
427- labels .update (** worker_spec ["metadata" ]["labels" ])
428-
429- data = build_default_worker_group_spec (status ["clusterName" ], worker_spec , annotations , labels )
430- if await worker_group .exists ():
431- await worker_group .patch (data )
432- else :
433- kopf .adopt (data )
434- await worker_group .create ()
435-
436379@kopf .on .update ("daskcluster.kubernetes.dask.org" )
437380async def daskcluster_update (
438381 spec : kopf .Spec ,
0 commit comments