Skip to content

Commit 6ca2574

Browse files
committed
feat: add container_registry_auth_id to create_pod
1 parent 13e25e7 commit 6ca2574

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

runpod/api/ctl_commands.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def create_pod(
134134
min_download = None,
135135
min_upload = None,
136136
instance_id: Optional[str] = None,
137+
container_registry_auth_id: Optional[str] = None,
137138
) -> dict:
138139
"""
139140
Create a pod
@@ -155,6 +156,7 @@ def create_pod(
155156
:param min_download: minimum download speed in Mbps
156157
:param min_upload: minimum upload speed in Mbps
157158
:param instance_id: the id of a specific instance to deploy to (for CPU pods)
159+
:param container_registry_auth_id: the id of the container registry auth to use for pulling private images (GPU pods only)
158160
:example:
159161
160162
>>> # Create GPU pod
@@ -209,6 +211,7 @@ def create_pod(
209211
min_download,
210212
min_upload,
211213
instance_id,
214+
container_registry_auth_id,
212215
)
213216
)
214217

runpod/api/mutations/pods.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def generate_pod_deployment_mutation(
3131
min_download: Optional[int] = None,
3232
min_upload: Optional[int] = None,
3333
instance_id: Optional[str] = None,
34+
container_registry_auth_id: Optional[str] = None,
3435
) -> str:
3536
"""
3637
Generates a mutation to deploy a pod on demand.
@@ -93,6 +94,9 @@ def generate_pod_deployment_mutation(
9394
cuda_versions = ", ".join(f'"{v}"' for v in allowed_cuda_versions)
9495
input_fields.append(f"allowedCudaVersions: [{cuda_versions}]")
9596

97+
if container_registry_auth_id is not None:
98+
input_fields.append(f'containerRegistryAuthId: "{container_registry_auth_id}"')
99+
96100
# CPU Pod Fields
97101
else:
98102
if instance_id is not None:

tests/test_api/test_mutations_pods.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_generate_pod_deployment_mutation(self):
1515
# Test GPU pod deployment
1616
gpu_result = pods.generate_pod_deployment_mutation(
1717
name="test",
18-
image_name="test_image",
18+
image_name="test_image",
1919
gpu_type_id="1",
2020
cloud_type="cloud",
2121
data_center_id="1",
@@ -34,6 +34,15 @@ def test_generate_pod_deployment_mutation(self):
3434
allowed_cuda_versions=["11.8", "12.0"],
3535
)
3636

37+
# Test GPU pod deployment with container registry auth
38+
gpu_result_with_auth = pods.generate_pod_deployment_mutation(
39+
name="test",
40+
image_name="test_image",
41+
gpu_type_id="1",
42+
cloud_type="ALL",
43+
container_registry_auth_id="auth123",
44+
)
45+
3746
# Test CPU pod deployment
3847
cpu_result = pods.generate_pod_deployment_mutation(
3948
name="test-cpu",
@@ -55,10 +64,16 @@ def test_generate_pod_deployment_mutation(self):
5564
# Check GPU pod mutation structure
5665
self.assertIn("mutation", gpu_result)
5766
self.assertIn("podFindAndDeployOnDemand", gpu_result)
58-
59-
# Check CPU pod mutation structure
67+
self.assertNotIn("containerRegistryAuthId", gpu_result)
68+
69+
# Check containerRegistryAuthId is included when provided, absent when not
70+
self.assertIn("containerRegistryAuthId", gpu_result_with_auth)
71+
self.assertIn('"auth123"', gpu_result_with_auth)
72+
73+
# Check CPU pod mutation structure
6074
self.assertIn("mutation", cpu_result)
6175
self.assertIn("deployCpuPod", cpu_result)
76+
self.assertNotIn("containerRegistryAuthId", cpu_result)
6277

6378
def test_generate_pod_stop_mutation(self):
6479
"""

0 commit comments

Comments
 (0)