-
Notifications
You must be signed in to change notification settings - Fork 980
Description
What happened:
I was using the kubectl module in my project and noticed that if server-side flattening and printing isn't used, the CustomColumnsPrinter printer prints the address for object fields that are pointer types instead of the actual value. For example, .spec.terminationGracePeriodSeconds in v1.Pod has the type *int64, and it's value gets printed as 0x140009abc30 instead of an integer such as42.
What you expected to happen:
I expect the CustomColumnsPrinter to handle pointer types correctly. If the value is nil, then <none> should be printed. Otherwise, the value of the dereferenced type should be printed.
How to reproduce it (as minimally and precisely as possible):
Write a program or test to generate fake Pod objects and print those objects with the CustomColumnsPrinter using the JSONPath for the .spec.terminationGracePeriodSeconds field.
Anything else we need to know?:
Bug is here:
kubectl/pkg/cmd/get/customcolumn.go
Line 253 in f9b1363
| valueStrings = append(valueStrings, fmt.Sprintf("%v", values[arrIx][valIx].Interface())) |
Environment:
-
Kubernetes client and server versions (use
kubectl version): I'm using these modules: k8s.io/api, k8s.io/apimachinery, k8s.io/cli-runtime, k8s.io/client-go, and k8s.io/kubectl, all at version 0.23.3. -
Cloud provider or hardware configuration:
-
OS (e.g:
cat /etc/os-release):