@@ -234,7 +234,7 @@ func (s *server) GetNotebooks(w http.ResponseWriter, r *http.Request) {
234
234
func (s * server ) handleVolume (ctx context.Context , req volumerequest , notebook * kubeflowv1.Notebook ) error {
235
235
var pvc = corev1.PersistentVolumeClaim {}
236
236
if req .Type == VolumeTypeNew {
237
- if notebook .GetObjectMeta ().GetLabels ()["notebook.statcan.gc.ca/protected-b" ] == "true" {
237
+ if _ , ok := notebook .GetObjectMeta ().GetLabels ()["notebook.statcan.gc.ca/protected-b" ]; ok {
238
238
pvc = corev1.PersistentVolumeClaim {
239
239
ObjectMeta : v1.ObjectMeta {
240
240
Name : req .Name ,
@@ -380,6 +380,17 @@ func (s *server) NewNotebook(w http.ResponseWriter, r *http.Request) {
380
380
notebook .Spec .Template .Spec .Containers [0 ].Resources .Limits [corev1 .ResourceMemory ] = req .Memory
381
381
}
382
382
383
+ // Add configuration items
384
+ if s .Config .SpawnerFormDefaults .Configurations .ReadOnly {
385
+ for _ , config := range s .Config .SpawnerFormDefaults .Configurations .Value {
386
+ notebook .ObjectMeta .Labels [config ] = "true"
387
+ }
388
+ } else {
389
+ for _ , config := range req .Configurations {
390
+ notebook .ObjectMeta .Labels [config ] = "true"
391
+ }
392
+ }
393
+
383
394
// Add workspace volume
384
395
if s .Config .SpawnerFormDefaults .WorkspaceVolume .ReadOnly {
385
396
size , err := resource .ParseQuantity (s .Config .SpawnerFormDefaults .WorkspaceVolume .Value .Size .Value )
@@ -482,17 +493,6 @@ func (s *server) NewNotebook(w http.ResponseWriter, r *http.Request) {
482
493
}
483
494
}
484
495
485
- // Add configuration items
486
- if s .Config .SpawnerFormDefaults .Configurations .ReadOnly {
487
- for _ , config := range s .Config .SpawnerFormDefaults .Configurations .Value {
488
- notebook .ObjectMeta .Labels [config ] = "true"
489
- }
490
- } else {
491
- for _ , config := range req .Configurations {
492
- notebook .ObjectMeta .Labels [config ] = "true"
493
- }
494
- }
495
-
496
496
//Add Language
497
497
//Validate that the language format is valid (language[_territory])
498
498
match , err := regexp .MatchString ("^[[:alpha:]]{2}(_[[:alpha:]]{2})?$" , req .Language )
0 commit comments