From 3629a66ac352f3a83112f0b058d5ca03cb4a30b2 Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Fri, 14 Jun 2024 16:05:37 +0200 Subject: [PATCH] docs(kubernetes): clarify that list() returns an object list (e.g. listing Pods returns a PodList) Signed-off-by: Fabrizio Sestito --- internal/cel/library/kubernetes.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/cel/library/kubernetes.go b/internal/cel/library/kubernetes.go index 06b2b80..8e795e7 100644 --- a/internal/cel/library/kubernetes.go +++ b/internal/cel/library/kubernetes.go @@ -70,15 +70,17 @@ import ( // list // // Returns a list of Kubernetes resources matching the client configuration. +// The list of resources is returned as the corresponding object list type, for instance listing of `Pods` will return a [`PodList`](https://pkg.go.dev/k8s.io/api/core/v1#PodList). +// The resources can be accessed using the 'items' field. // // .list() // // Examples: // -// kw.k8s.apiVersion('v1').kind('Pod').namespace('default').list() // returns a list of 'Pod' resources in the 'default' namespace -// kw.k8s.apiVersion('v1').kind('Pod').list() // returns a list of 'Pod' resources in all namespaces -// kw.k8s.apiVersion('v1').kind('Pod').labelSelector('app=nginx').list() // returns a list of 'Pod' resources in all namespaces with the label selector 'app=nginx' -// kw.k8s.apiVersion('v1').kind('Pod').fieldSelector('status.phase=Running').namespace('default').list() // returns a list of running 'Pod' resources in the default namespace with the field selector 'status.phase=Running' +// kw.k8s.apiVersion('v1').kind('Pod').namespace('default').list().items // returns a list of 'Pod' resources in the 'default' namespace +// kw.k8s.apiVersion('v1').kind('Pod').list().items // returns a list of 'Pod' resources in all namespaces +// kw.k8s.apiVersion('v1').kind('Pod').labelSelector('app=nginx').list().items // returns a list of 'Pod' resources in all namespaces with the label selector 'app=nginx' +// kw.k8s.apiVersion('v1').kind('Pod').fieldSelector('status.phase=Running').namespace('default').list().items // returns a list of running 'Pod' resources in the default namespace with the field selector 'status.phase=Running' // // get //