nmstate / kubernetes-nmstate

Declarative node network configuration driven through Kubernetes API.
GNU General Public License v2.0
188 stars 90 forks source link

complex capture filters #1256

Open alexminder opened 3 months ago

alexminder commented 3 months ago

What happened:

How to use complex capture selects based on multiple conditions? It would be great to see documetation with good portion of such examples.

What you expected to happen:

Currently I don't know how to do such selects in a NNCP.

$ oc get nns NODE -o json|jq  '.status.currentState.interfaces|.[]|select(.driver == "igb" or .driver == "tg3")|.name'
"eno8303"
"eno8403"

This select does no allow to use integer in NNCP capture, because expected string, but nns returns float64:

$ oc get nns NODE -o json|jq  '.status.currentState.interfaces|.[]|select(.ethernet.speed == 10000)|.name'
"eno12399np0"
"eno12409np1"
qinqon commented 3 months ago

@alexminder is this issue for the k-nmstate "capture" feature or to compose a proper jq expression ?

alexminder commented 3 months ago

@qinqon the issue for k-nmstate "capture" feature. jq as an example to illustrate the impossibility of using such expressions in "capture."

qinqon commented 2 months ago

@alexminder can you open an issue at github.com/nmstate/nmstate, we have move the captures "engine" there and we will integrate k-nmstate to what is there.