qbec show - use output for kubectl patch
Rom888 opened this issue · comments
Rom888 commented
I have a Daemonset installed and configured in a cluster by other tool, and I need to patch it using qbec show output.
I created components/patch.jsonnet, however
qbec show stage -c patch
gives an error:
✘ extract objects: non-kubernetes object found while evaluating path "$[0].op"
It would be valuable to have a way to process jsonnet json patch files and use them for patches, something like this:
qbec show stage --patch=patch.jsonnet | kubectl patch daemonset ds1 --type='json' --patch="$(cat)"
This is simplified json patch example:
local p = import '../../params.libsonnet';
local params = p.components.nginxIngress;
[
{
op: 'add',
path: '/spec/template/spec/volumes/0/name',
value: 'modsec-logs',
},
{
op: 'add',
path: '/spec/template/spec/containers/0/volumeMounts/0/name',
value: 'modsec-logs',
},
]
Krishnan Anantheswaran commented
you can use qbec eval
for this which doesn't make any assumptions about output and is equivalent to jsonnet eval