From 85215ed58aa8c25ca2bdb9a9201a3f84fd85315b Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Thu, 11 May 2023 18:21:23 -0700 Subject: [PATCH] cmd/k8s-operator: handle NotFound secrets getSingleObject can return `nil, nil`, getDeviceInfo was not handling that case which resulted in panics. Fixes #7303 Signed-off-by: Maisem Ali --- cmd/k8s-operator/operator.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/k8s-operator/operator.go b/cmd/k8s-operator/operator.go index 2d7a8c793..4398c21cc 100644 --- a/cmd/k8s-operator/operator.go +++ b/cmd/k8s-operator/operator.go @@ -567,6 +567,9 @@ func (a *ServiceReconciler) getDeviceInfo(ctx context.Context, svc *corev1.Servi if err != nil { return "", "", err } + if sec == nil { + return "", "", nil + } id = string(sec.Data["device_id"]) if id == "" { return "", "", nil