Skip to content

Conversation

@cbarbian-sap
Copy link
Contributor

@cbarbian-sap cbarbian-sap commented Nov 3, 2025

This PR adds new template functions:

  • lookupList <apiVersion> <kind> <namespace> <labelSelector>
  • localLookupList <apiVersion> <kind> <namespace> <labelSelector>
  • lookupListWithKubeConfig <apiVersion> <kind> <namespace> <labelSelector> <kubeConfig>

To be called like this:

{{- $objects := lookupList "v1" "Secret" "kube-system" "mylabel=myvalue }}

The 'local' variant uses the effective local (controller-side) kubeconfig (in case of remotely deployed components).
The 'WithKubeConfig' variant takes an arbitrary kubeconfig (as string) as last argument.

All three methods return an array of map[string]any, representing the found resources.

For namespaced objects, if the given namespace is empty, objects are selected from all namespaces. For non-namespaced objects, the namespace should be specified empty. An empty selector means: 'select everything'.

@cbarbian-sap cbarbian-sap merged commit e35b078 into main Nov 4, 2025
9 checks passed
@cbarbian-sap cbarbian-sap deleted the lookuplist branch November 4, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants