devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.28k stars 359 forks source link

patches.op.add functions unexpectedly #994

Closed chasebolt closed 2 years ago

chasebolt commented 4 years ago

Is your feature request related to a problem?
I am trying to add additional helm values but when doing so it wipes out previously set values

      - op: add
        path: deployments[2].helm.values
        value:
          customSecretName: mysql
          backupSecretName: cloud-credentials

Which solution do you suggest?
Allow the yaml patching for add to append instead of actually replace.

Which alternative solutions exist?
This works, just not as clean when dealing with a lot of values.

      - op: add
        path: deployments[2].helm.values.customSecretName
        value: mysql
      - op: add
        path: deployments[2].helm.values.backupSecretName
        value: cloud-credentials

Additional context

/kind feature

FabianKramm commented 4 years ago

@chasebolt thanks for opening this issue! While I agree that it behaves sometimes quite confusing, we are internally just using a library that is based on a RFC standard for JavaScript Object Notation Patch.

In general, I'm not against adding more features to this library to make it easier to understand, like we did already with supporting the dot json path notation alongside RFC 6901 JSON Pointers, however this proposed change would require a change in the inner workings of the library (which basically requires us to do a fork) and furthermore conflict with the standard the library implements and could be as well unexpected for people who expect that we support the aforementioned standard.

carlmontanari commented 2 years ago

I think this can be closed out after the doc updates, as well as the work done in #1647 as well as the doc additions in that PR and #1032 ! Feel free to reopen if there is still some work to do here!