Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gwctl/pkg/printer/gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (gp *GatewaysPrinter) GetPrintableNodes(resourceModel *resourcediscovery.Re

func (gp *GatewaysPrinter) PrintTable(resourceModel *resourcediscovery.ResourceModel) {
table := &Table{
ColumnNames: []string{"NAME", "CLASS", "ADDRESSES", "PORTS", "PROGRAMMED", "AGE"},
ColumnNames: []string{"NAMESPACE", "NAME", "CLASS", "ADDRESSES", "PORTS", "PROGRAMMED", "AGE"},
UseSeparator: false,
}

Expand Down Expand Up @@ -74,6 +74,7 @@ func (gp *GatewaysPrinter) PrintTable(resourceModel *resourcediscovery.ResourceM
age := duration.HumanDuration(gp.Clock.Since(gatewayNode.Gateway.GetCreationTimestamp().Time))

row := []string{
gatewayNode.Gateway.GetNamespace(),
gatewayNode.Gateway.GetName(),
string(gatewayNode.Gateway.Spec.GatewayClassName),
addressesOutput,
Expand Down
17 changes: 10 additions & 7 deletions gwctl/pkg/printer/gateways_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func TestGatewaysPrinter_PrintTable(t *testing.T) {
},
&gatewayv1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: "abc-gateway-12345",
Name: "abc-gateway-12345",
Namespace: "default",
CreationTimestamp: metav1.Time{
Time: fakeClock.Now().Add(-20 * 24 * time.Hour),
},
Expand Down Expand Up @@ -107,7 +108,8 @@ func TestGatewaysPrinter_PrintTable(t *testing.T) {
},
&gatewayv1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: "demo-gateway-2",
Name: "demo-gateway-2",
Namespace: "default",
CreationTimestamp: metav1.Time{
Time: fakeClock.Now().Add(-5 * 24 * time.Hour),
},
Expand Down Expand Up @@ -144,7 +146,8 @@ func TestGatewaysPrinter_PrintTable(t *testing.T) {
},
&gatewayv1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Name: "random-gateway",
Name: "random-gateway",
Namespace: "default",
CreationTimestamp: metav1.Time{
Time: fakeClock.Now().Add(-3 * time.Second),
},
Expand Down Expand Up @@ -195,10 +198,10 @@ func TestGatewaysPrinter_PrintTable(t *testing.T) {

got := buff.String()
want := `
NAME CLASS ADDRESSES PORTS PROGRAMMED AGE
abc-gateway-12345 internal-class 192.168.100.5 443,8080 False 20d
demo-gateway-2 external-class 10.0.0.1,10.0.0.2 + 1 more 80 True 5d
random-gateway regional-internal-class 10.11.12.13 8443 Unknown 3s
NAMESPACE NAME CLASS ADDRESSES PORTS PROGRAMMED AGE
default abc-gateway-12345 internal-class 192.168.100.5 443,8080 False 20d
default demo-gateway-2 external-class 10.0.0.1,10.0.0.2 + 1 more 80 True 5d
default random-gateway regional-internal-class 10.11.12.13 8443 Unknown 3s
`

if diff := cmp.Diff(common.YamlString(want), common.YamlString(got), common.YamlStringTransformer); diff != "" {
Expand Down