Fixed describe ingress causing SEGFAULT
Kubernetes-commit: 03a5a7d51db3bf859a9b4c94394cc73ced678780
This commit is contained in:
parent
383b7bd9ef
commit
587c96fcd8
|
@ -2469,7 +2469,11 @@ func (i *IngressDescriber) describeBackendV1(ns string, backend *networkingv1.In
|
|||
}
|
||||
if backend.Resource != nil {
|
||||
ic := backend.Resource
|
||||
return fmt.Sprintf("APIGroup: %v, Kind: %v, Name: %v", *ic.APIGroup, ic.Kind, ic.Name)
|
||||
apiGroup := "<none>"
|
||||
if ic.APIGroup != nil {
|
||||
apiGroup = fmt.Sprintf("%v", *ic.APIGroup)
|
||||
}
|
||||
return fmt.Sprintf("APIGroup: %v, Kind: %v, Name: %v", apiGroup, ic.Kind, ic.Name)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
|
@ -1744,6 +1744,12 @@ func TestDescribeIngress(t *testing.T) {
|
|||
Name: "bar",
|
||||
},
|
||||
}
|
||||
backendResourceNoAPIGroup := networkingv1.IngressBackend{
|
||||
Resource: &corev1.TypedLocalObjectReference{
|
||||
Kind: "foo",
|
||||
Name: "bar",
|
||||
},
|
||||
}
|
||||
|
||||
tests := map[string]struct {
|
||||
input *fake.Clientset
|
||||
|
@ -1811,6 +1817,42 @@ Rules:
|
|||
foo.bar.com
|
||||
/foo APIGroup: example.com, Kind: foo, Name: bar
|
||||
Annotations: <none>
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"IngressRule.HTTP.Paths.Backend.Resource v1 Without APIGroup": {
|
||||
input: fake.NewSimpleClientset(&networkingv1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "bar",
|
||||
Namespace: "foo",
|
||||
},
|
||||
Spec: networkingv1.IngressSpec{
|
||||
Rules: []networkingv1.IngressRule{
|
||||
{
|
||||
Host: "foo.bar.com",
|
||||
IngressRuleValue: networkingv1.IngressRuleValue{
|
||||
HTTP: &networkingv1.HTTPIngressRuleValue{
|
||||
Paths: []networkingv1.HTTPIngressPath{
|
||||
{
|
||||
Path: "/foo",
|
||||
Backend: backendResourceNoAPIGroup,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
output: `Name: bar
|
||||
Namespace: foo
|
||||
Address:
|
||||
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
|
||||
Rules:
|
||||
Host Path Backends
|
||||
---- ---- --------
|
||||
foo.bar.com
|
||||
/foo APIGroup: <none>, Kind: foo, Name: bar
|
||||
Annotations: <none>
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"Spec.DefaultBackend.Service & IngressRule.HTTP.Paths.Backend.Service v1": {
|
||||
|
|
Loading…
Reference in New Issue