describer: use new ServiceCIDR API
Change-Id: Iff11c70f20bab3e55e4e569fb110ef25dd6dd97e Kubernetes-commit: 513fdb5422932e3234590d03c4b8d417e7544796
This commit is contained in:
parent
17964a895f
commit
931e867953
|
@ -2870,13 +2870,7 @@ func (c *ServiceCIDRDescriber) describeServiceCIDRV1alpha1(svc *networkingv1alph
|
|||
printLabelsMultiline(w, "Labels", svc.Labels)
|
||||
printAnnotationsMultiline(w, "Annotations", svc.Annotations)
|
||||
|
||||
if svc.Spec.IPv4 != "" {
|
||||
w.Write(LEVEL_0, "IPv4:\t%s\n", svc.Spec.IPv4)
|
||||
}
|
||||
|
||||
if svc.Spec.IPv6 != "" {
|
||||
w.Write(LEVEL_0, "IPv6:\t%s\n", svc.Spec.IPv6)
|
||||
}
|
||||
w.Write(LEVEL_0, "CIDRs:\t%v\n", strings.Join(svc.Spec.CIDRs, ", "))
|
||||
|
||||
if len(svc.Status.Conditions) > 0 {
|
||||
w.Write(LEVEL_0, "Status:\n")
|
||||
|
|
|
@ -5944,16 +5944,46 @@ func TestDescribeServiceCIDR(t *testing.T) {
|
|||
Name: "foo.123",
|
||||
},
|
||||
Spec: networkingv1alpha1.ServiceCIDRSpec{
|
||||
IPv4: "10.1.0.0/16",
|
||||
IPv6: "fd00:1:1::/64",
|
||||
CIDRs: []string{"10.1.0.0/16", "fd00:1:1::/64"},
|
||||
},
|
||||
}),
|
||||
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
IPv4: 10.1.0.0/16
|
||||
IPv6: fd00:1:1::/64
|
||||
CIDRs: 10.1.0.0/16, fd00:1:1::/64
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"ServiceCIDR v1alpha1 IPv4": {
|
||||
input: fake.NewSimpleClientset(&networkingv1alpha1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo.123",
|
||||
},
|
||||
Spec: networkingv1alpha1.ServiceCIDRSpec{
|
||||
CIDRs: []string{"10.1.0.0/16"},
|
||||
},
|
||||
}),
|
||||
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CIDRs: 10.1.0.0/16
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
"ServiceCIDR v1alpha1 IPv6": {
|
||||
input: fake.NewSimpleClientset(&networkingv1alpha1.ServiceCIDR{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo.123",
|
||||
},
|
||||
Spec: networkingv1alpha1.ServiceCIDRSpec{
|
||||
CIDRs: []string{"fd00:1:1::/64"},
|
||||
},
|
||||
}),
|
||||
|
||||
output: `Name: foo.123
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CIDRs: fd00:1:1::/64
|
||||
Events: <none>` + "\n",
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue