Closed flavio closed 5 months ago
I had the following configuration:
variables: - name: knownIngresses expression: | kw.k8s.apiVersion("networking.k8s.io/v1").kind("Ingress").list() - name: knownHosts expression: | variables.knownIngresses.map(i, i.spec.rules.map(r, r.host))
which failed with this message: failed to evaluate variables: no such key: spec
failed to evaluate variables: no such key: spec
That happens because the list function returns a kubernetes ObjectList, meaning the ingress objects are inside of the .items variable.
list
ObjectList
.items
The code from above has to be changed to be like that:
variables: - name: knownIngresses expression: | kw.k8s.apiVersion("networking.k8s.io/v1").kind("Ingress").list() - name: knownHosts expression: | variables.knownIngresses.items.map(i, i.spec.rules.map(r, r.host))
We should update our inline docs to make clear the list() function returns an object that holds all the desired resources inside of a CEL list called .items
list()
I had the following configuration:
which failed with this message:
failed to evaluate variables: no such key: spec
That happens because the
list
function returns a kubernetesObjectList
, meaning the ingress objects are inside of the.items
variable.The code from above has to be changed to be like that:
Desired changed
We should update our inline docs to make clear the
list()
function returns an object that holds all the desired resources inside of a CEL list called.items