@@ -614,7 +614,14 @@ def __init__(self):
614614
615615 @intercept_exception
616616 def create_with_ssh_key (
617- self , ip = None , ssh_key = None , ssh_key_file = None , tags = [],
617+ self ,
618+ ip = None ,
619+ ssh_key = None ,
620+ ssh_key_file = None ,
621+ tags = [],
622+ ephemeral_disks = None ,
623+ persistent_disks = None ,
624+ wait_for_operation_secs = 0 ,
618625 ):
619626 """Create a K8s Worker using SSH key authentication.
620627
@@ -630,6 +637,15 @@ def create_with_ssh_key(
630637 The SSH key file path, by default None
631638 tags : list, optional
632639 Tags to use, e.g. "{ "tag1": "foo", "tag2": "bar"}", by default []
640+ ephemeral_disks : str
641+ Comma separated string containing ephemeral disks.
642+ e.g: "/dev/nvme2n1,/dev/nvme2n2"
643+ persistent_disks : str, optional
644+ Comma separated string containing persistent disks, by default
645+ None.
646+ e.g: "/dev/nvme1n1,/dev/nvme1n2"
647+ wait_for_operation_secs: int
648+ wait for operations to complete. 0 = don't wait
633649 """
634650 if ssh_key is None and ssh_key_file is None :
635651 print (
@@ -652,6 +668,28 @@ def create_with_ssh_key(
652668 worker_id = get_client ().k8s_worker .create_with_ssh_key (
653669 ip = ip , ssh_key_data = ssh_key , tags = tags ,
654670 )
671+
672+ if wait_for_operation_secs > 0 :
673+ self .wait_for_status (
674+ id = worker_id ,
675+ status = ["storage_pending" ],
676+ timeout_secs = wait_for_operation_secs ,
677+ )
678+
679+ if ephemeral_disks is not None or persistent_disks is not None :
680+ self .set_storage (
681+ id = worker_id ,
682+ ephemeral_disks = ephemeral_disks ,
683+ persistent_disks = persistent_disks ,
684+ )
685+
686+ if wait_for_operation_secs > 0 :
687+ self .wait_for_status (
688+ id = worker_id ,
689+ status = ["ready" ],
690+ timeout_secs = wait_for_operation_secs ,
691+ )
692+
655693 print (worker_id )
656694
657695 # TODO: verify with engineering if setup_log is a valid parameter
0 commit comments