gateway-api
gateway-api copied to clipboard
Description of GatewayClass is nil gives error in gwctl describe
What happened:
I deployed Kong Ingress Controller on a Kind cluster. When I run gwctl describe gatewayclasses I get the following error
$ go run cmd/main.go describe gatewayclasses
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x13ade0e]
goroutine 1 [running]:
sigs.k8s.io/gateway-api/gwctl/pkg/printer.(*GatewayClassesPrinter).PrintDescribeView(0xc000d07980, 0xc000f0c030)
/home/devaanshk840/Code/gateway-api/gwctl/pkg/printer/gatewayclasses.go:53 +0x10e
sigs.k8s.io/gateway-api/gwctl/pkg/cmd/describe.runDescribe({0xc00100e0d0?, 0x0?, 0x0?}, 0x0?, 0x0?)
/home/devaanshk840/Code/gateway-api/gwctl/pkg/cmd/describe/describe.go:121 +0x8bc
sigs.k8s.io/gateway-api/gwctl/pkg/cmd/describe.NewDescribeCommand.func1(0xc000c8eb00?, {0xc00100e0d0?, 0x1?, 0x16781b1?})
/home/devaanshk840/Code/gateway-api/gwctl/pkg/cmd/describe/describe.go:46 +0x2c
github.com/spf13/cobra.(*Command).execute(0xc0001b1500, {0xc00100e0a0, 0x1, 0x1})
/home/devaanshk840/Code/gateway-api/gwctl/vendor/github.com/spf13/cobra/command.go:987 +0xaa3
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001b0300)
/home/devaanshk840/Code/gateway-api/gwctl/vendor/github.com/spf13/cobra/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/devaanshk840/Code/gateway-api/gwctl/vendor/github.com/spf13/cobra/command.go:1039
main.main()
/home/devaanshk840/Code/gateway-api/gwctl/cmd/main.go:68 +0x2a5
exit status 2
Anything else we need to know?:
This error is occuring at the following line of code https://github.com/kubernetes-sigs/gateway-api/blob/main/gwctl/pkg/printer/gatewayclasses.go#L53 because gatewayClassNode.GatewayClass.Spec.Description is a pointer to string and Kong does not set a description for its gateway class. So essentially *gatewayClassNode.GatewayClass.Spec.Description is trying to dereference a nil pointer.
/area gwctl /kind bug