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