-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Escaping of " in values for restore modified patches doesn't work #7104
Comments
I forgot to mention the configuration with the |
I think its not possible to make this change today, because velero/internal/resourcemodifiers/json_patch.go Lines 36 to 39 in d42505d
I beleive what your operation is doing is changing @anshulahuja98 what you think? |
I think the reason is the
It should be:
Although the example has |
I think I also tried it with multiple /edit: Sorry this is my private account, but I'm the author of the bug report. |
Make it work with this ConfigMap setting. apiVersion: v1
data:
modify_deploy.yaml: |
version: v1
resourceModifierRules:
- conditions:
groupResource: configmaps
resourceNameRegex: "test"
namespaces:
- upgrade
patches:
- operation: replace
path: "/data/test"
value: "\\\"true\\\""
kind: ConfigMap
metadata:
name: modify-deploy
namespace: velero apiVersion: v1
data:
test: '"true"'
kind: ConfigMap
metadata:
creationTimestamp: "2023-11-17T01:21:32Z"
labels:
velero.io/backup-name: test-01
velero.io/restore-name: test-01-20231117092120
name: test
namespace: upgrade
resourceVersion: "130749607"
uid: 63ab5b05-041b-4bfc-912e-61315b758e98
|
So overall the ask is to support putting values where "true" / "false" is a string rather than a bool. The second scenario is where / is part of an actual user value string. A probable solution can be to leverage as called out in the issue for enhancements #7050 |
Let me try out few POCs and get back. |
I have tried that before and the service who is reading this |
func ParseBool(str string) (bool, error) { Found some more issues checkig further a proper fix for this. |
I have the following modifier:
The original configmap has this:
When executing this modifier during a restore I get this error:
This is happening with these velero versioons:
The text was updated successfully, but these errors were encountered: