Change:
When command 'kubectl describe ing' Name: test-ing Namespace: practice Address: 10.10.01.10 Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found) TLS: test terminates Rules: Host Path Backends ---- ---- -------- / test-svc:80 (<none) Annotations: nginx Events: <noneResult has no information about labels. But Pod, Deployment, Service resources has label information like below. Name: test-room-test-mjsbz Namespace: test Priority: 0 Node: aks-test-test-test/22.22.222. Start Time: Fri, 09 Jul 2021 05:45:26 +0000 Labels: app=test pod-template-hash=test role=mediatest Why ingress has no information about labels? Actually when delete ingresss with labels is working correctly. Kubernetes version (use ): 1.18.14 Cloud provider or hardware configuration: AKS (Azure) OS (e.g: ): Kernel (e.g. ): Install tools: Network plugin and version (if this is a network-related bug): Others: /sig
/sig
/sig cli
/assign
/assign
/triage accepted /remove-kind bug /kind feature

Discussion:
return tabbedString(func(out io.Writer) error { w := NewPrefixWriter(out) w.Write(LEVEL_0, "Name:t%vn", ing.Name) <ins> printLabelsMultiline(w, "Labels", ing.Labels) </ins> w.Write(LEVEL_0, "Namespace:t%vn", ing.Namespace) w.Write(LEVEL_0, "Address:t%vn", loadBalancerStatusStringer(ing.Status.LoadBalancer, true)) def := ing.Spec.DefaultBackend

return tabbedString(func(out io.Writer) error { w := NewPrefixWriter(out) w.Write(LEVEL_0, "Name:t%vn", ing.Name) <ins> printLabelsMultiline(w, "Labels", ing.Labels) </ins> w.Write(LEVEL_0, "Namespace:t%vn", ing.Namespace) w.Write(LEVEL_0, "Address:t%vn", loadBalancerStatusStringer(ing.Status.LoadBalancer, true)) def := ing.Spec.Backend

} v1beta1 := fake.NewSimpleClientset(&networkingv1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ <del> Name:      "bar", </del> <ins> Name: "bar", Labels: map[string]string{ "id1": "app1", "id2": "app2", }, </ins> Namespace: "foo", }, Spec: networkingv1beta1.IngressSpec{

"IngressRule.HTTP.Paths.Backend.Service v1beta1": { input: v1beta1, output: `Name:             bar <ins> Labels:           id1=app1 id2=app2 </ins> Namespace:        foo Address: Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)

"IngressRule.HTTP.Paths.Backend.Service v1": { input: netv1, output: `Name:             bar <ins> Labels:           <none> </ins> Namespace:        foo Address: Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)

}, }), output: `Name:             bar <ins> Labels:           <none> </ins> Namespace:        foo Address: Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)

}, }), output: `Name:             bar <ins> Labels:           <none> </ins> Namespace:        foo Address: Default backend:  APIGroup: example.com, Kind: foo, Name: bar

}, }), output: `Name:             bar <ins> Labels:           <none> </ins> Namespace:        foo Address: Default backend:  default-backend:80 (<error: endpoints "default-backend" not found>)

fakeClient := fake.NewSimpleClientset(&networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ <del> Name:      "bar", </del> <ins> Name: "bar", Labels: map[string]string{ "id1": "app1", "id2": "app2", }, </ins> Namespace: "foo", }, Spec: networkingv1.IngressSpec{

if err != nil { t.Errorf("unexpected error: %v", err) } <del> if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") || !strings.Contains(out, "foo.bar.com") || !strings.Contains(out, "/foo") { </del> <ins> if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") || !strings.Contains(out, "foo.bar.com") || !strings.Contains(out, "/foo") || !strings.Contains(out, "app1") || !strings.Contains(out, "app2") { </ins> t.Errorf("unexpected out: %s", out) } }