kubernetes / client-go

Go client for Kubernetes.
Apache License 2.0
8.79k stars 2.91k forks source link

Is there a way to get table response or metadata only to list k8s resource from k8sclientset? #1236

Closed Sprakhar97 closed 1 year ago

Sprakhar97 commented 1 year ago

I'm trying to fetch all the cm/secrets name/metadata in a k8s cluster, For this I'm using clientset.CoreV1().ConfigMaps("").List(context.TODO(), metav1.ListOptions{}) but the response for this call is list of configmap with data field. Issue: As configmap and secrets data size is close to half MB, the memory footprint is too high for this api-call, Expectation: I wanted to know if there is a way or plan to support light calls like fetching the metadata or get tabular response same as kubectl get command?

liggitt commented 1 year ago

The metadata client (https://github.com/kubernetes/client-go/tree/master/metadata) can be used to select just the metadata stanza of objects.