@@ -161,6 +161,13 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
161
161
container["image"] = image
162
162
163
163
164
+ def update_pull_secret(spec, pull_secret):
165
+ if pull_secret:
166
+ if "imagePullSecrets" not in spec:
167
+ spec["imagePullSecrets"] = []
168
+ spec["imagePullSecrets"].append(pull_secret)
169
+
170
+
164
171
def update_env(spec, env):
165
172
containers = spec.get("containers")
166
173
for container in containers:
@@ -198,6 +205,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
198
205
image,
199
206
instascale,
200
207
env,
208
+ pull_secret,
201
209
):
202
210
if "generictemplate" in item.keys():
203
211
head = item.get("generictemplate").get("spec").get("headGroupSpec")
@@ -213,6 +221,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
213
221
for comp in [head, worker]:
214
222
spec = comp.get("template").get("spec")
215
223
update_affinity(spec, appwrapper_name, instascale)
224
+ update_pull_secret(spec, pull_secret)
216
225
update_image(spec, image)
217
226
update_env(spec, env)
218
227
if comp == head:
@@ -241,6 +250,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
241
250
instascale: bool,
242
251
instance_types: list,
243
252
env,
253
+ pull_secret: str,
244
254
):
245
255
user_yaml = read_template(template)
246
256
appwrapper_name, cluster_name = gen_names(name)
@@ -264,6 +274,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
264
274
image,
265
275
instascale,
266
276
env,
277
+ pull_secret,
267
278
)
268
279
update_dashboard_route(route_item, cluster_name, namespace)
269
280
outfile = appwrapper_name + ".yaml"
@@ -345,6 +356,12 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
345
356
default="default",
346
357
help="Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the 'default' namespace",
347
358
)
359
+ parser.add_argument(
360
+ "--pull-secret",
361
+ required=False,
362
+ default="",
363
+ help="Set pull secret for a private registry",
364
+ )
348
365
349
366
args = parser.parse_args()
350
367
name = args.name
@@ -360,6 +377,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
360
377
instance_types = args.instance_types
361
378
namespace = args.namespace
362
379
env = {}
380
+ pull_secret = args.pull_secret
363
381
364
382
outfile = generate_appwrapper(
365
383
name,
@@ -375,6 +393,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
375
393
instascale,
376
394
instance_types,
377
395
env,
396
+ pull_secret,
378
397
)
379
398
return outfile
380
399
@@ -410,7 +429,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
410
429
</ details >
411
430
</ dd >
412
431
< dt id ="codeflare_sdk.utils.generate_yaml.generate_appwrapper "> < code class ="name flex ">
413
- < span > def < span class ="ident "> generate_appwrapper</ span > </ span > (< span > name: str, namespace: str, min_cpu: int, max_cpu: int, min_memory: int, max_memory: int, gpu: int, workers: int, template: str, image: str, instascale: bool, instance_types: list, env)</ span >
432
+ < span > def < span class ="ident "> generate_appwrapper</ span > </ span > (< span > name: str, namespace: str, min_cpu: int, max_cpu: int, min_memory: int, max_memory: int, gpu: int, workers: int, template: str, image: str, instascale: bool, instance_types: list, env, pull_secret: str )</ span >
414
433
</ code > </ dt >
415
434
< dd >
416
435
< div class ="desc "> </ div >
@@ -432,6 +451,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
432
451
instascale: bool,
433
452
instance_types: list,
434
453
env,
454
+ pull_secret: str,
435
455
):
436
456
user_yaml = read_template(template)
437
457
appwrapper_name, cluster_name = gen_names(name)
@@ -455,6 +475,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
455
475
image,
456
476
instascale,
457
477
env,
478
+ pull_secret,
458
479
)
459
480
update_dashboard_route(route_item, cluster_name, namespace)
460
481
outfile = appwrapper_name + ".yaml"
@@ -545,6 +566,12 @@ <h2 class="section-title" id="header-functions">Functions</h2>
545
566
default="default",
546
567
help="Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the 'default' namespace",
547
568
)
569
+ parser.add_argument(
570
+ "--pull-secret",
571
+ required=False,
572
+ default="",
573
+ help="Set pull secret for a private registry",
574
+ )
548
575
549
576
args = parser.parse_args()
550
577
name = args.name
@@ -560,6 +587,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
560
587
instance_types = args.instance_types
561
588
namespace = args.namespace
562
589
env = {}
590
+ pull_secret = args.pull_secret
563
591
564
592
outfile = generate_appwrapper(
565
593
name,
@@ -575,6 +603,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
575
603
instascale,
576
604
instance_types,
577
605
env,
606
+ pull_secret,
578
607
)
579
608
return outfile</ code > </ pre >
580
609
</ details >
@@ -759,7 +788,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
759
788
</ details >
760
789
</ dd >
761
790
< dt id ="codeflare_sdk.utils.generate_yaml.update_nodes "> < code class ="name flex ">
762
- < span > def < span class ="ident "> update_nodes</ span > </ span > (< span > item, appwrapper_name, min_cpu, max_cpu, min_memory, max_memory, gpu, workers, image, instascale, env)</ span >
791
+ < span > def < span class ="ident "> update_nodes</ span > </ span > (< span > item, appwrapper_name, min_cpu, max_cpu, min_memory, max_memory, gpu, workers, image, instascale, env, pull_secret )</ span >
763
792
</ code > </ dt >
764
793
< dd >
765
794
< div class ="desc "> </ div >
@@ -779,6 +808,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
779
808
image,
780
809
instascale,
781
810
env,
811
+ pull_secret,
782
812
):
783
813
if "generictemplate" in item.keys():
784
814
head = item.get("generictemplate").get("spec").get("headGroupSpec")
@@ -794,6 +824,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
794
824
for comp in [head, worker]:
795
825
spec = comp.get("template").get("spec")
796
826
update_affinity(spec, appwrapper_name, instascale)
827
+ update_pull_secret(spec, pull_secret)
797
828
update_image(spec, image)
798
829
update_env(spec, env)
799
830
if comp == head:
@@ -802,6 +833,22 @@ <h2 class="section-title" id="header-functions">Functions</h2>
802
833
update_resources(spec, min_cpu, max_cpu, min_memory, max_memory, gpu)</ code > </ pre >
803
834
</ details >
804
835
</ dd >
836
+ < dt id ="codeflare_sdk.utils.generate_yaml.update_pull_secret "> < code class ="name flex ">
837
+ < span > def < span class ="ident "> update_pull_secret</ span > </ span > (< span > spec, pull_secret)</ span >
838
+ </ code > </ dt >
839
+ < dd >
840
+ < div class ="desc "> </ div >
841
+ < details class ="source ">
842
+ < summary >
843
+ < span > Expand source code</ span >
844
+ </ summary >
845
+ < pre > < code class ="python "> def update_pull_secret(spec, pull_secret):
846
+ if pull_secret:
847
+ if "imagePullSecrets" not in spec:
848
+ spec["imagePullSecrets"] = []
849
+ spec["imagePullSecrets"].append(pull_secret)</ code > </ pre >
850
+ </ details >
851
+ </ dd >
805
852
< dt id ="codeflare_sdk.utils.generate_yaml.update_resources "> < code class ="name flex ">
806
853
< span > def < span class ="ident "> update_resources</ span > </ span > (< span > spec, min_cpu, max_cpu, min_memory, max_memory, gpu)</ span >
807
854
</ code > </ dt >
@@ -871,6 +918,7 @@ <h1>Index</h1>
871
918
< li > < code > < a title ="codeflare_sdk.utils.generate_yaml.update_labels " href ="#codeflare_sdk.utils.generate_yaml.update_labels "> update_labels</ a > </ code > </ li >
872
919
< li > < code > < a title ="codeflare_sdk.utils.generate_yaml.update_names " href ="#codeflare_sdk.utils.generate_yaml.update_names "> update_names</ a > </ code > </ li >
873
920
< li > < code > < a title ="codeflare_sdk.utils.generate_yaml.update_nodes " href ="#codeflare_sdk.utils.generate_yaml.update_nodes "> update_nodes</ a > </ code > </ li >
921
+ < li > < code > < a title ="codeflare_sdk.utils.generate_yaml.update_pull_secret " href ="#codeflare_sdk.utils.generate_yaml.update_pull_secret "> update_pull_secret</ a > </ code > </ li >
874
922
< li > < code > < a title ="codeflare_sdk.utils.generate_yaml.update_resources " href ="#codeflare_sdk.utils.generate_yaml.update_resources "> update_resources</ a > </ code > </ li >
875
923
< li > < code > < a title ="codeflare_sdk.utils.generate_yaml.write_user_appwrapper " href ="#codeflare_sdk.utils.generate_yaml.write_user_appwrapper "> write_user_appwrapper</ a > </ code > </ li >
876
924
</ ul >
0 commit comments