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 <maisem@tailscale.com>
pull/8124/head
Maisem Ali 2 years ago committed by Maisem Ali
parent b69059334b
commit 85215ed58a

@ -567,6 +567,9 @@ func (a *ServiceReconciler) getDeviceInfo(ctx context.Context, svc *corev1.Servi
if err != nil { if err != nil {
return "", "", err return "", "", err
} }
if sec == nil {
return "", "", nil
}
id = string(sec.Data["device_id"]) id = string(sec.Data["device_id"])
if id == "" { if id == "" {
return "", "", nil return "", "", nil

Loading…
Cancel
Save