-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add merge shortcut for arrays using arbitrary element key(s) #77
Comments
The challenge here is that this is a merge of two arrays with no indication of what key (or possibly even multiple keys) to use for the merge. For example, we do see that the key here is This could possibly be implemented as an extension of JSON Merge, although I don't think this would be trivial. |
Note that with KubeMod today, you can use the For example, to find an environment variable called ENV2 in any container in a Deployment and replace it with a new environment variable object, the following ...
patch:
- op: add
select: '$.spec.template.spec.containers[*].env[? @.name == "ENV2"]'
path: '/spec/template/containers/#0/env/#1'
value: |-
name: ENV2
value: true The above technique only works for replacing existing items in an array. That said, I understand that this sounds like a lot of work for something that seems quite simple and I agree that a |
Hi, would it be possible to implement a merge operation? For example if the mutated resource had
patch section had path ending with
env
and value contained:the result would be:
Currently with operation
add
theENV1
would be missing. I know I can specify multiple patches and each settingenv/-1
but this could simplify some scenarios.The text was updated successfully, but these errors were encountered: