@@ -130,6 +130,14 @@ def update_image(spec, image):
130
130
container ["image" ] = image
131
131
132
132
133
+ def update_image_pull_secrets (spec , image_pull_secrets ):
134
+ if image_pull_secrets :
135
+ if "imagePullSecrets" not in spec :
136
+ spec ["imagePullSecrets" ] = []
137
+ for image_pull_secret in image_pull_secrets :
138
+ spec ["imagePullSecrets" ].append ({"name" : image_pull_secret })
139
+
140
+
133
141
def update_env (spec , env ):
134
142
containers = spec .get ("containers" )
135
143
for container in containers :
@@ -167,6 +175,7 @@ def update_nodes(
167
175
image ,
168
176
instascale ,
169
177
env ,
178
+ image_pull_secrets ,
170
179
):
171
180
if "generictemplate" in item .keys ():
172
181
head = item .get ("generictemplate" ).get ("spec" ).get ("headGroupSpec" )
@@ -182,6 +191,7 @@ def update_nodes(
182
191
for comp in [head , worker ]:
183
192
spec = comp .get ("template" ).get ("spec" )
184
193
update_affinity (spec , appwrapper_name , instascale )
194
+ update_image_pull_secrets (spec , image_pull_secrets )
185
195
update_image (spec , image )
186
196
update_env (spec , env )
187
197
if comp == head :
@@ -211,6 +221,7 @@ def generate_appwrapper(
211
221
instascale : bool ,
212
222
instance_types : list ,
213
223
env ,
224
+ image_pull_secrets : list ,
214
225
):
215
226
user_yaml = read_template (template )
216
227
appwrapper_name , cluster_name = gen_names (name )
@@ -234,6 +245,7 @@ def generate_appwrapper(
234
245
image ,
235
246
instascale ,
236
247
env ,
248
+ image_pull_secrets ,
237
249
)
238
250
update_dashboard_route (route_item , cluster_name , namespace )
239
251
outfile = appwrapper_name + ".yaml"
@@ -315,6 +327,12 @@ def main(): # pragma: no cover
315
327
default = "default" ,
316
328
help = "Set the kubernetes namespace you want to deploy your cluster to. Default. If left blank, uses the 'default' namespace" ,
317
329
)
330
+ parser .add_argument (
331
+ "--image-pull-secrets" ,
332
+ required = False ,
333
+ default = [],
334
+ help = "Set image pull secrets for private registries" ,
335
+ )
318
336
319
337
args = parser .parse_args ()
320
338
name = args .name
@@ -330,6 +348,7 @@ def main(): # pragma: no cover
330
348
instance_types = args .instance_types
331
349
namespace = args .namespace
332
350
env = {}
351
+ image_pull_secrets = args .image_pull_secrets
333
352
334
353
outfile = generate_appwrapper (
335
354
name ,
@@ -345,6 +364,7 @@ def main(): # pragma: no cover
345
364
instascale ,
346
365
instance_types ,
347
366
env ,
367
+ image_pull_secrets ,
348
368
)
349
369
return outfile
350
370
0 commit comments