utkuozdemir / pv-migrate

CLI tool to easily migrate Kubernetes persistent volumes
Apache License 2.0
1.63k stars 82 forks source link

Rsync command overwrite #259

Closed pavlovnicola closed 1 year ago

pavlovnicola commented 1 year ago

Describe the bug Trying to use the rsync.command helm flag with the --info rsync option but migration fails.

To Reproduce

Run command

./pv-migrate migrate --source-kubeconfig prod-config --source-namespace nginx-example --dest-kubeconfig jen-config --dest-namespace nginx-example --ignore-mounted --log-level trace --helm-timeout 2m --helm-set rsync.command="rsync -azvv --info=stats2,misc1,flist0,progress2 -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5' root@x.x.x.x:/source// /dest//" nginx-logs nginx-logs

See error

{"dest":"nginx-logs","dest_ns":"nginx-example","error":"failed to install on source: failed to get merged helm values: failed to merge helm values: failed parsing --set data: key \"misc1\" has no value","id":"ecceb","level":"warning","msg":"Migration failed with this strategy, will try with the remaining strategies","source":"nginx-logs","source_ns":"nginx-example","strategy":"lbsvc","time":"2023-10-21T08:56:37+03:00"}

Error: migration failed: all strategies failed for this migration

Expected behavior Abe to overwrite the default rsync command.

Version

Additional context Do you have a full example on how to use the helm chart value rsync.command with --info rsync option?

Eroyi commented 1 year ago

They had a problems on handling coma , when takeover --helm-set and passing to actual --helm, not even works with escape \. Try use different methods, like --helm-file or something.

utkuozdemir commented 1 year ago

The helm parameter rsync.command is not supposed to be overridden by the users, as it is built dynamically by the tool as part of the core functionality. I'd recommend giving a shot to rsync.extraArgs parameter.

Still, keep in mind that it might not work, as the tool is sensitive to the rsync command and its output.

Also, passing complex values to Helm via command line is tricky, so +1 to @Eroyi , I'd recommend passing them as a file.

pavlovnicola commented 1 year ago

@utkuozdemir @Eroyi

Thank you both. I will try to pass them as a file.