A generic kubernetes controller based on jq. Quickly prototype your own operators using jq filters!
The controller will kubectl apply
whatever comes as a result of applying the jq
filter on the input resource(s) you specify.
To give you a general idea of what it does, below is a simplified view of jq-controller
operation flow:
kubectl get --watch ${WATCH_TARGET} -o json \
| jq <your transform filter> \
| kubectl apply -f -
So, for example, if you specify:
WATCH_TARGET=configmap/jq-input
- content of
configmap/jq-input
:
apiVersion: v1
kind: ConfigMap
metadata:
name: jq-input
data:
var: Whatever, really
- the value of your
jq
filter:
{
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"name": "jq-output"
},
"data": {
"extracted": .var
}
}
then the controller will create the following configmap
:
apiVersion: v1
kind: ConfigMap
metadata:
name: jq-output
data:
extracted: Whatever, really
And this is what the manifests under examples/privileged-insecure/ will actually do if you kubectl apply
them :)