@@ -148,8 +148,8 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
148
148
Kubernetes constantly calling back for a given create.
149
149
"""
150
150
151
- logging .info ("Starting create (name= %s namespace=%s)..." , name , namespace )
152
- logging .info ("spec= %s (name =%s) " , spec , name )
151
+ logging .info ("Creating %s ( namespace=%s)..." , name , namespace )
152
+ logging .info ("Incoming %s spec =%s" , name , spec )
153
153
154
154
# All Data-Manager provided material
155
155
# will be namespaced under the 'imDataManager' property
@@ -221,23 +221,30 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
221
221
except kubernetes .client .exceptions .ApiException as ex :
222
222
# We 'expect' 404, anything else is an error
223
223
if ex .status != 404 :
224
- logging .warning (
225
- "Got ApiException [%s/%s] getting CONFIG ConfigMap" ,
224
+ logging .error (
225
+ "Got ApiException [%s/%s] getting existing CONFIG ConfigMap %s " ,
226
226
ex .status ,
227
227
ex .reason ,
228
+ cm_name ,
228
229
)
229
230
raise ex
230
231
if config_cm :
231
232
# We retrieved an existing CONFIG - extract the token from it
232
233
json_data = json .loads (config_cm .data [json_data_key ])
233
234
token = json_data ["ServerApp" ]["token" ]
234
- logging .info ("Retrieved prior token from CONFIG ConfigMap (%s)" , token )
235
+ logging .debug (
236
+ "Retrieved prior token from CONFIG ConfigMap %s (%s)" ,
237
+ cm_name ,
238
+ token ,
239
+ )
235
240
else :
236
241
# No prior config - we're free to allocate a new token
237
242
characters = string .ascii_letters + string .digits
238
243
token = "" .join (random .sample (characters , 16 ))
239
- logging .info (
240
- "No prior CONFIG ConfigMap exists, assigning new token (%s)" , token
244
+ logging .debug (
245
+ "No prior CONFIG ConfigMap exists for %s, assigning new token (%s)" ,
246
+ cm_name ,
247
+ token ,
241
248
)
242
249
assert token
243
250
@@ -262,7 +269,7 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
262
269
core_api .create_namespaced_config_map (
263
270
namespace , config_cm_body , _request_timeout = _REQUEST_TIMEOUT
264
271
)
265
- logging .info ("Created CONFIG ConfigMap %s" , cm_name )
272
+ logging .debug ("Created CONFIG ConfigMap %s" , cm_name )
266
273
267
274
cm_name = f"bp-{ name } "
268
275
bp_cm_body = {
@@ -276,12 +283,12 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
276
283
core_api .create_namespaced_config_map (
277
284
namespace , bp_cm_body , _request_timeout = _REQUEST_TIMEOUT
278
285
)
279
- logging .info ("Created BP ConfigMap (%s) " , cm_name )
286
+ logging .debug ("Created BP ConfigMap %s " , cm_name )
280
287
except kubernetes .client .exceptions .ApiException as ex :
281
288
if ex .status != 409 or ex .reason != "Conflict" :
282
289
raise ex
283
290
# Warn, but ignore and return a valid 'create' response now.
284
- logging .info (
291
+ logging .debug (
285
292
"Got 409/Conflict creating BP ConfigMap %s. Ignoring - object already present" ,
286
293
cm_name ,
287
294
)
@@ -298,12 +305,12 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
298
305
core_api .create_namespaced_config_map (
299
306
namespace , startup_cm_body , _request_timeout = _REQUEST_TIMEOUT
300
307
)
301
- logging .info ("Created STARTUP ConfigMap (%s) " , cm_name )
308
+ logging .debug ("Created STARTUP ConfigMap %s " , cm_name )
302
309
except kubernetes .client .exceptions .ApiException as ex :
303
310
if ex .status != 409 or ex .reason != "Conflict" :
304
311
raise ex
305
312
# Warn, but ignore and return a valid 'create' response now.
306
- logging .info (
313
+ logging .debug (
307
314
"Got 409/Conflict creating STARTUP ConfigMap %s. Ignoring - object already present" ,
308
315
cm_name ,
309
316
)
@@ -425,12 +432,12 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
425
432
apps_api .create_namespaced_deployment (
426
433
namespace , deployment_body , _request_timeout = _REQUEST_TIMEOUT
427
434
)
428
- logging .info ("Created Deployment %s" , name )
435
+ logging .debug ("Created Deployment %s" , name )
429
436
except kubernetes .client .exceptions .ApiException as ex :
430
437
if ex .status != 409 or ex .reason != "Conflict" :
431
438
raise ex
432
439
# Warn, but ignore and return a valid 'create' response now.
433
- logging .info (
440
+ logging .debug (
434
441
"Got 409/Conflict creating Deployment %s. Ignoring - object already present" ,
435
442
name ,
436
443
)
@@ -463,12 +470,12 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
463
470
core_api .create_namespaced_service (
464
471
namespace , service_body , _request_timeout = _REQUEST_TIMEOUT
465
472
)
466
- logging .info ("Created Service %s" , name )
473
+ logging .debug ("Created Service %s" , name )
467
474
except kubernetes .client .exceptions .ApiException as ex :
468
475
if ex .status != 409 or ex .reason != "Conflict" :
469
476
raise ex
470
477
# Warn, but ignore and return a valid 'create' response now.
471
- logging .info (
478
+ logging .debug (
472
479
"Got 409/Conflict creating Service %s. Ignoring - object already present" ,
473
480
name ,
474
481
)
@@ -523,19 +530,19 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
523
530
ext_api .create_namespaced_ingress (
524
531
namespace , ingress_body , _request_timeout = _REQUEST_TIMEOUT
525
532
)
526
- logging .info ("Created Ingress %s" , name )
533
+ logging .debug ("Created Ingress %s" , name )
527
534
except kubernetes .client .exceptions .ApiException as ex :
528
535
if ex .status != 409 or ex .reason != "Conflict" :
529
536
raise ex
530
537
# Warn, but ignore and return a valid 'create' response now.
531
- logging .info (
538
+ logging .debug (
532
539
"Got 409/Conflict creating Ingress %s. Ignoring - object already present" ,
533
540
name ,
534
541
)
535
542
536
543
# Done
537
544
# ----
538
- logging .info ("Success! (name =%s namespace =%s)" , name , namespace )
545
+ logging .info ("Done %s (namespace =%s token =%s)" , name , namespace , token )
539
546
540
547
return {
541
548
"notebook" : {
0 commit comments