@@ -287,15 +287,18 @@ func (n ingressNetworkingV1Strategy) ConvertIngress() *Ingress {
287287					if  k8sPath .PathType  !=  nil  {
288288						pathType  =  string (* k8sPath .PathType )
289289					}
290- 					paths [pathType + "-" + k8sPath .Path ] =  & IngressPath {
290+ 					pathKey  :=  pathType  +  "-"  +  k8sPath .Path 
291+ 					paths [pathKey ] =  & IngressPath {
291292						Path :          k8sPath .Path ,
292293						PathTypeMatch : pathType ,
293294						SvcNamespace :  n .ig .GetNamespace (),
294- 						SvcName :       k8sPath .Backend .Service .Name ,
295- 						SvcPortInt :    int64 (k8sPath .Backend .Service .Port .Number ),
296- 						SvcPortString : k8sPath .Backend .Service .Port .Name ,
297295						Status :        "" ,
298296					}
297+ 					if  k8sPath .Backend .Service  !=  nil  {
298+ 						paths [pathKey ].SvcName  =  k8sPath .Backend .Service .Name 
299+ 						paths [pathKey ].SvcPortInt  =  int64 (k8sPath .Backend .Service .Port .Number )
300+ 						paths [pathKey ].SvcPortString  =  k8sPath .Backend .Service .Port .Name 
301+ 					}
299302				}
300303				if  rule , ok  :=  rules [k8sRule .Host ]; ok  {
301304					for  path , ingressPath  :=  range  paths  {
@@ -315,14 +318,17 @@ func (n ingressNetworkingV1Strategy) ConvertIngress() *Ingress {
315318			if  ingressBackend  ==  nil  {
316319				return  nil 
317320			}
318- 			return  & IngressPath {
321+ 			ingPath   :=  & IngressPath {
319322				SvcNamespace :     n .ig .GetNamespace (),
320- 				SvcName :          ingressBackend .Service .Name ,
321- 				SvcPortInt :       int64 (ingressBackend .Service .Port .Number ),
322- 				SvcPortString :    ingressBackend .Service .Port .Name ,
323323				IsDefaultBackend : true ,
324324				Status :           "" ,
325325			}
326+ 			if  ingressBackend .Service  !=  nil  {
327+ 				ingPath .SvcName  =  ingressBackend .Service .Name 
328+ 				ingPath .SvcPortInt  =  int64 (ingressBackend .Service .Port .Number )
329+ 				ingPath .SvcPortString  =  ingressBackend .Service .Port .Name 
330+ 			}
331+ 			return  ingPath 
326332		}(n .ig .Spec .DefaultBackend ),
327333		TLS : func (ingressTLS  []networkingv1.IngressTLS ) map [string ]* IngressTLS  {
328334			tls  :=  make (map [string ]* IngressTLS )
0 commit comments