From 4f29d67b197530fc94d5214ed80721319595108c Mon Sep 17 00:00:00 2001 From: rkpattnaik780 Date: Tue, 9 Apr 2024 15:41:44 +0530 Subject: [PATCH] fix: add nil checks to prevent unit tests from failing --- .../notebook-controller/controllers/notebook_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/notebook-controller/controllers/notebook_controller.go b/components/notebook-controller/controllers/notebook_controller.go index 9f8c4b62f47..09ecff5dd2e 100644 --- a/components/notebook-controller/controllers/notebook_controller.go +++ b/components/notebook-controller/controllers/notebook_controller.go @@ -162,7 +162,7 @@ func (r *NotebookReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c // Copy the pod template labels, but reconcilation is not required // exclusively based on ths pod template labels - if *ss.Spec.Replicas != *foundStateful.Spec.Replicas { + if ss.Spec.Replicas != nil && foundStateful.Spec.Replicas != nil && *ss.Spec.Replicas != *foundStateful.Spec.Replicas { if !reflect.DeepEqual(foundStateful.Spec.Template.ObjectMeta.Labels, ss.Spec.Template.ObjectMeta.Labels) { foundStateful.Spec.Template.ObjectMeta.Labels = ss.Spec.Template.ObjectMeta.Labels }