Skip to content

Commit

Permalink
improve(docs): using multiple jqFilter's (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
a0s authored Sep 19, 2023
1 parent 292de69 commit e16e2df
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/src/HOOKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,32 @@ The result of applying the filter to the event's object is passed to the hook in

You can use `JQ_LIBRARY_PATH` environment variable to set a path with `jq` modules.

In case you need to filter by multiple fields, you can use the form of an object or an array:

- `jqFilter: "{nodeName: .spec.nodeName, name: .metadata.labels}"` returns filterResult as object:
```json
"filterResult": {
"labels": {
"app": "proxy",
"pod-template-hash": "cfdbfcbb8"
},
"nodeName": "node-01"
}
```

- `jqFilter: "[.spec.nodeName, .metadata.labels]"` returns filterResult as array:
```json
"filterResult": [
"node-01",
{
"app": "proxy",
"pod-template-hash": "cfdbfcbb8"
}
]
```

##### Added != Object created

Consider that the "Added" event is not always equal to "Object created" if `labelSelector`, `fieldSelector` or `namespace.labelSelector` is specified in the `binding`. If objects and/or namespace are updated in Kubernetes, the `binding` may suddenly start matching them, with the "Added" event. The same with "Deleted", event "Deleted" is not always equal to "Object removed", the object can just move out of a scope of selectors.
Expand Down

0 comments on commit e16e2df

Please sign in to comment.