Skip to content

Commit

Permalink
Add print column for Prefixes in NetworkInterface (#960)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Alpert <benjamin.alpert@t-systems.com>
  • Loading branch information
balpert89 and balpert89 authored Jan 16, 2024
1 parent bd9fe9b commit d37a145
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var (
{Name: "Name", Type: "string", Format: "name", Description: objectMetaSwaggerDoc["name"]},
{Name: "Network", Type: "string", Description: "The network this network interface is connected to"},
{Name: "Machine", Type: "string", Description: "The machine this network interface is used by"},
{Name: "IPs", Type: "string", Description: "List of effective IPs of the network interface"},
{Name: "IPs", Type: "string", Description: "The list of effective IPs of the network interface"},
{Name: "Prefixes", Type: "string", Description: "The list of effective prefixes assigned to this network interface"},
{Name: "VirtualIP", Type: "string", Description: "The virtual IP assigned to this interface, if any"},
{Name: "State", Type: "string", Description: "The state of the network interface"},
{Name: "Age", Type: "string", Format: "date", Description: objectMetaSwaggerDoc["creationTimestamp"]},
Expand Down Expand Up @@ -68,6 +69,15 @@ func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tabl
} else {
cells = append(cells, "<none>")
}
if effectivePrefixes := networkInterface.Status.Prefixes; len(effectivePrefixes) > 0 {
var ePrefixes []string
for _, prefix := range effectivePrefixes {
ePrefixes = append(ePrefixes, prefix.String())
}
cells = append(cells, strings.Join(ePrefixes, ","))
} else {
cells = append(cells, "<none>")
}
if vip := networkInterface.Status.VirtualIP; vip != nil {
cells = append(cells, vip.String())
} else {
Expand Down

0 comments on commit d37a145

Please sign in to comment.