Skip to content

Commit 348f944

Browse files
varshaprasad96jstourac
authored andcommitted
[Add] Propagate labels from NB to StatefulSets
This commit propagates labels from Notebooks to statefulsets. This is required to enable NBs to be managed by Kueue. When a user adds the label to point a NB to the right LocalQueue where it needs to be admitted, it needs to propagate to the underlying StatefulSet, so that Kueue can manage it. Signed-off-by: Varsha Prasad Narsing <[email protected]> (cherry picked from commit f6abf13)
1 parent c9488b1 commit 348f944

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/notebook-controller/controllers/notebook_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ func generateStatefulSet(instance *v1beta1.Notebook, isGenerateName bool) *appsv
439439
ssObjectMeta := metav1.ObjectMeta{
440440
Name: instance.Name,
441441
Namespace: instance.Namespace,
442+
Labels: map[string]string{},
442443
}
443444
if isGenerateName {
444445
ssObjectMeta = metav1.ObjectMeta{
@@ -470,6 +471,11 @@ func generateStatefulSet(instance *v1beta1.Notebook, isGenerateName bool) *appsv
470471
},
471472
}
472473

474+
sl := &ss.Labels
475+
for k, v := range instance.Labels {
476+
(*sl)[k] = v
477+
}
478+
473479
// copy all of the Notebook labels to the pod including poddefault related labels
474480
l := &ss.Spec.Template.ObjectMeta.Labels
475481
for k, v := range instance.ObjectMeta.Labels {

0 commit comments

Comments
 (0)