diff --git a/notebooks/api/0.8/11-container-images-k8s.ipynb b/notebooks/api/0.8/11-container-images-k8s.ipynb index 762911592c3..af715192027 100644 --- a/notebooks/api/0.8/11-container-images-k8s.ipynb +++ b/notebooks/api/0.8/11-container-images-k8s.ipynb @@ -570,8 +570,8 @@ " pool_name=worker_pool_name,\n", " image_uid=workerimage.id,\n", " num_workers=3,\n", - " reg_username=external_registry_username,\n", - " reg_password=external_registry_password,\n", + " registry_username=external_registry_username,\n", + " registry_password=external_registry_password,\n", ")" ] }, @@ -1097,7 +1097,8 @@ "source": [ "# get the pending request and approve it\n", "req_result = pool_create_request.approve(\n", - " reg_username=external_registry_username, reg_password=external_registry_password\n", + " registry_username=external_registry_username,\n", + " registry_password=external_registry_password,\n", ")\n", "req_result" ] @@ -1243,7 +1244,8 @@ "outputs": [], "source": [ "req_result = pool_image_create_request.approve(\n", - " reg_username=external_registry_username, reg_password=external_registry_password\n", + " registry_username=external_registry_username,\n", + " registry_password=external_registry_password,\n", ")\n", "req_result" ] diff --git a/packages/syft/src/syft/custom_worker/runner_k8s.py b/packages/syft/src/syft/custom_worker/runner_k8s.py index f9c48c6e394..949311338b9 100644 --- a/packages/syft/src/syft/custom_worker/runner_k8s.py +++ b/packages/syft/src/syft/custom_worker/runner_k8s.py @@ -28,19 +28,19 @@ def create_pool( replicas: int = 1, env_vars: list[dict] | None = None, mount_secrets: dict | None = None, - reg_username: str | None = None, - reg_password: str | None = None, + registry_username: str | None = None, + registry_password: str | None = None, reg_url: str | None = None, **kwargs: Any, ) -> StatefulSet: try: # create pull secret if registry credentials are passed pull_secret = None - if reg_username and reg_password and reg_url: + if registry_username and registry_password and reg_url: pull_secret = self._create_image_pull_secret( pool_name, - reg_username, - reg_password, + registry_username, + registry_password, reg_url, ) @@ -126,8 +126,8 @@ def get_pod_env_vars(self, pod: str | Pod) -> list[dict] | None: def _create_image_pull_secret( self, pool_name: str, - reg_username: str, - reg_password: str, + registry_username: str, + registry_password: str, reg_url: str, **kwargs: Any, ) -> Secret: @@ -135,7 +135,7 @@ def _create_image_pull_secret( secret_name=f"pull-secret-{pool_name}", component=pool_name, registries=[ - (reg_url, reg_username, reg_password), + (reg_url, registry_username, registry_password), ], ) diff --git a/packages/syft/src/syft/service/request/request.py b/packages/syft/src/syft/service/request/request.py index 12f4f0621ca..758671f84ca 100644 --- a/packages/syft/src/syft/service/request/request.py +++ b/packages/syft/src/syft/service/request/request.py @@ -267,8 +267,8 @@ def _run( push_result = worker_image_service.push( service_context, image_uid=worker_image.id, - username=context.extra_kwargs.get("reg_username", None), - password=context.extra_kwargs.get("reg_password", None), + username=context.extra_kwargs.get("registry_username", None), + password=context.extra_kwargs.get("registry_password", None), ) if isinstance(push_result, SyftError): @@ -335,8 +335,8 @@ def _run( pool_name=self.pool_name, image_uid=self.image_uid, num_workers=self.num_workers, - reg_username=context.extra_kwargs.get("reg_username", None), - reg_password=context.extra_kwargs.get("reg_password", None), + registry_username=context.extra_kwargs.get("registry_username", None), + registry_password=context.extra_kwargs.get("registry_password", None), ) if isinstance(result, SyftError): return Err(result) diff --git a/packages/syft/src/syft/service/worker/utils.py b/packages/syft/src/syft/service/worker/utils.py index 181774da837..18895f2cb02 100644 --- a/packages/syft/src/syft/service/worker/utils.py +++ b/packages/syft/src/syft/service/worker/utils.py @@ -325,8 +325,8 @@ def create_kubernetes_pool( replicas: int, queue_port: int, debug: bool, - reg_username: str | None = None, - reg_password: str | None = None, + registry_username: str | None = None, + registry_password: str | None = None, reg_url: str | None = None, **kwargs: Any, ) -> list[Pod] | SyftError: @@ -360,8 +360,8 @@ def create_kubernetes_pool( replicas=replicas, env_vars=env_vars, mount_secrets=mount_secrets, - reg_username=reg_username, - reg_password=reg_password, + registry_username=registry_username, + registry_password=registry_password, reg_url=reg_url, ) except Exception as e: @@ -402,8 +402,8 @@ def run_workers_in_kubernetes( queue_port: int, start_idx: int = 0, debug: bool = False, - reg_username: str | None = None, - reg_password: str | None = None, + registry_username: str | None = None, + registry_password: str | None = None, reg_url: str | None = None, **kwargs: Any, ) -> list[ContainerSpawnStatus] | SyftError: @@ -419,8 +419,8 @@ def run_workers_in_kubernetes( replicas=worker_count, queue_port=queue_port, debug=debug, - reg_username=reg_username, - reg_password=reg_password, + registry_username=registry_username, + registry_password=registry_password, reg_url=reg_url, ) else: @@ -501,8 +501,8 @@ def run_containers( queue_port: int, dev_mode: bool = False, start_idx: int = 0, - reg_username: str | None = None, - reg_password: str | None = None, + registry_username: str | None = None, + registry_password: str | None = None, reg_url: str | None = None, ) -> list[ContainerSpawnStatus] | SyftError: results = [] @@ -524,8 +524,8 @@ def run_containers( pool_name=pool_name, queue_port=queue_port, debug=dev_mode, - username=reg_username, - password=reg_password, + username=registry_username, + password=registry_password, registry_url=reg_url, ) results.append(spawn_result) @@ -537,8 +537,8 @@ def run_containers( queue_port=queue_port, debug=dev_mode, start_idx=start_idx, - reg_username=reg_username, - reg_password=reg_password, + registry_username=registry_username, + registry_password=registry_password, reg_url=reg_url, ) diff --git a/packages/syft/src/syft/service/worker/worker_pool_service.py b/packages/syft/src/syft/service/worker/worker_pool_service.py index 28b239e6602..7f648b7c8e5 100644 --- a/packages/syft/src/syft/service/worker/worker_pool_service.py +++ b/packages/syft/src/syft/service/worker/worker_pool_service.py @@ -67,8 +67,8 @@ def launch( pool_name: str, image_uid: UID | None, num_workers: int, - reg_username: str | None = None, - reg_password: str | None = None, + registry_username: str | None = None, + registry_password: str | None = None, ) -> list[ContainerSpawnStatus] | SyftError: """Creates a pool of workers from the given SyftWorkerImage. @@ -126,8 +126,8 @@ def launch( worker_cnt=num_workers, worker_image=worker_image, worker_stash=worker_stash, - reg_username=reg_username, - reg_password=reg_password, + registry_username=registry_username, + registry_password=registry_password, ) if isinstance(result, SyftError): @@ -366,8 +366,8 @@ def add_workers( number: int, pool_id: UID | None = None, pool_name: str | None = None, - reg_username: str | None = None, - reg_password: str | None = None, + registry_username: str | None = None, + registry_password: str | None = None, ) -> list[ContainerSpawnStatus] | SyftError: """Add workers to existing worker pool. @@ -425,8 +425,8 @@ def add_workers( worker_cnt=number, worker_image=worker_image, worker_stash=worker_stash, - reg_username=reg_username, - reg_password=reg_password, + registry_username=registry_username, + registry_password=registry_password, ) if isinstance(result, SyftError): @@ -487,8 +487,8 @@ def scale( pool_id=pool_id, pool_name=pool_name, # kube scaling doesn't require password as it replicates an existing deployment - reg_username=None, - reg_password=None, + registry_username=None, + registry_password=None, ) if isinstance(result, SyftError): return result @@ -656,8 +656,8 @@ def _create_workers_in_pool( worker_cnt: int, worker_image: SyftWorkerImage, worker_stash: WorkerStash, - reg_username: str | None = None, - reg_password: str | None = None, + registry_username: str | None = None, + registry_password: str | None = None, ) -> tuple[list[LinkedObject], list[ContainerSpawnStatus]] | SyftError: queue_port = context.node.queue_config.client_config.queue_port @@ -686,8 +686,8 @@ def _create_workers_in_pool( orchestration=get_orchestration_type(), queue_port=queue_port, dev_mode=context.node.dev_mode, - reg_username=reg_username, - reg_password=reg_password, + registry_username=registry_username, + registry_password=registry_password, reg_url=registry_host, ) if isinstance(result, SyftError):