diff --git a/go.mod b/go.mod index 2369883c6..329798847 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/stretchr/testify v1.7.0 golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.0.0-20210805120319-7a35d40d43ac + k8s.io/api v0.0.0-20210806000319-499b6f90564c k8s.io/apimachinery v0.0.0-20210805051055-f7769293e6f1 k8s.io/cli-runtime v0.0.0-20210730024628-6149e6a4cfd2 k8s.io/client-go v0.0.0-20210805080552-fa98c048508e @@ -47,7 +47,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210805120319-7a35d40d43ac + k8s.io/api => k8s.io/api v0.0.0-20210806000319-499b6f90564c k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210805051055-f7769293e6f1 k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20210730024628-6149e6a4cfd2 k8s.io/client-go => k8s.io/client-go v0.0.0-20210805080552-fa98c048508e diff --git a/go.sum b/go.sum index 43f6bd39d..4c0960274 100644 --- a/go.sum +++ b/go.sum @@ -737,8 +737,8 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.0.0-20210805120319-7a35d40d43ac h1:Wu1nE5Lz+WstOMn+yT1unlEh/w2eXTQ+cWeD8m/YQYE= -k8s.io/api v0.0.0-20210805120319-7a35d40d43ac/go.mod h1:9J6nkHavSazyXmPeuA4f1YO9Ztdjw7nDibPjT4P+wsY= +k8s.io/api v0.0.0-20210806000319-499b6f90564c h1:/TwdwBIiHSFv2VnETc8qgoi/skGGBo1qlXszp8N/BMo= +k8s.io/api v0.0.0-20210806000319-499b6f90564c/go.mod h1:9J6nkHavSazyXmPeuA4f1YO9Ztdjw7nDibPjT4P+wsY= k8s.io/apimachinery v0.0.0-20210805051055-f7769293e6f1 h1:cVpwhaGeh/tNPBeYbFff3tjx5AxwG5zwImhz+eusG3k= k8s.io/apimachinery v0.0.0-20210805051055-f7769293e6f1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= k8s.io/cli-runtime v0.0.0-20210730024628-6149e6a4cfd2 h1:QALxbHPQ2sJBgghE+LGMtnt2tcNsMCmwXEDAbkHeE9o= diff --git a/pkg/describe/describe.go b/pkg/describe/describe.go index 94c7ddd9d..038a7d37b 100644 --- a/pkg/describe/describe.go +++ b/pkg/describe/describe.go @@ -2605,6 +2605,7 @@ func (i *IngressDescriber) describeIngressV1(ing *networkingv1.Ingress, events * return tabbedString(func(out io.Writer) error { w := NewPrefixWriter(out) w.Write(LEVEL_0, "Name:\t%v\n", ing.Name) + printLabelsMultiline(w, "Labels", ing.Labels) w.Write(LEVEL_0, "Namespace:\t%v\n", ing.Namespace) w.Write(LEVEL_0, "Address:\t%v\n", loadBalancerStatusStringer(ing.Status.LoadBalancer, true)) def := ing.Spec.DefaultBackend @@ -2660,6 +2661,7 @@ func (i *IngressDescriber) describeIngressV1beta1(ing *networkingv1beta1.Ingress return tabbedString(func(out io.Writer) error { w := NewPrefixWriter(out) w.Write(LEVEL_0, "Name:\t%v\n", ing.Name) + printLabelsMultiline(w, "Labels", ing.Labels) w.Write(LEVEL_0, "Namespace:\t%v\n", ing.Namespace) w.Write(LEVEL_0, "Address:\t%v\n", loadBalancerStatusStringer(ing.Status.LoadBalancer, true)) def := ing.Spec.Backend diff --git a/pkg/describe/describe_test.go b/pkg/describe/describe_test.go index c990cc96e..468bdc512 100644 --- a/pkg/describe/describe_test.go +++ b/pkg/describe/describe_test.go @@ -2162,7 +2162,11 @@ func TestDescribeIngress(t *testing.T) { } v1beta1 := fake.NewSimpleClientset(&networkingv1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ - Name: "bar", + Name: "bar", + Labels: map[string]string{ + "id1": "app1", + "id2": "app2", + }, Namespace: "foo", }, Spec: networkingv1beta1.IngressSpec{ @@ -2237,6 +2241,8 @@ func TestDescribeIngress(t *testing.T) { "IngressRule.HTTP.Paths.Backend.Service v1beta1": { input: v1beta1, output: `Name: bar +Labels: id1=app1 + id2=app2 Namespace: foo Address: Default backend: default-http-backend:80 () @@ -2251,6 +2257,7 @@ Events: ` + "\n", "IngressRule.HTTP.Paths.Backend.Service v1": { input: netv1, output: `Name: bar +Labels: Namespace: foo Address: Default backend: default-http-backend:80 () @@ -2287,6 +2294,7 @@ Events: ` + "\n", }, }), output: `Name: bar +Labels: Namespace: foo Address: Default backend: default-http-backend:80 () @@ -2323,6 +2331,7 @@ Events: ` + "\n", }, }), output: `Name: bar +Labels: Namespace: foo Address: Default backend: default-http-backend:80 () @@ -2360,6 +2369,7 @@ Events: ` + "\n", }, }), output: `Name: bar +Labels: Namespace: foo Address: Default backend: default-backend:80 () @@ -2397,6 +2407,7 @@ Events: ` + "\n", }, }), output: `Name: bar +Labels: Namespace: foo Address: Default backend: APIGroup: example.com, Kind: foo, Name: bar @@ -2434,6 +2445,7 @@ Events: ` + "\n", }, }), output: `Name: bar +Labels: Namespace: foo Address: Default backend: APIGroup: example.com, Kind: foo, Name: bar @@ -2456,6 +2468,7 @@ Events: ` + "\n", }, }), output: `Name: bar +Labels: Namespace: foo Address: Default backend: default-backend:80 () @@ -2498,7 +2511,11 @@ func TestDescribeIngressV1(t *testing.T) { fakeClient := fake.NewSimpleClientset(&networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ - Name: "bar", + Name: "bar", + Labels: map[string]string{ + "id1": "app1", + "id2": "app2", + }, Namespace: "foo", }, Spec: networkingv1.IngressSpec{ @@ -2524,7 +2541,12 @@ func TestDescribeIngressV1(t *testing.T) { if err != nil { t.Errorf("unexpected error: %v", err) } - if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") || !strings.Contains(out, "foo.bar.com") || !strings.Contains(out, "/foo") { + 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") { t.Errorf("unexpected out: %s", out) } }