Skip to content

Commit

Permalink
describer: use new ServiceCIDR API
Browse files Browse the repository at this point in the history
Change-Id: Iff11c70f20bab3e55e4e569fb110ef25dd6dd97e

Kubernetes-commit: 513fdb5422932e3234590d03c4b8d417e7544796
  • Loading branch information
aojea authored and k8s-publishing-bot committed Oct 29, 2023
1 parent 17964a8 commit 931e867
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
8 changes: 1 addition & 7 deletions pkg/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
38 changes: 34 additions & 4 deletions pkg/describe/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
Expand Down

0 comments on commit 931e867

Please sign in to comment.