utkuozdemir / pv-migrate

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

The SSHD port number is not taken into account on the destination pod #267

Open MurzNN opened 9 months ago

MurzNN commented 9 months ago

Describe the bug I have configured a custom port number in the values.yaml:

sshd:
  service:
    # -- SSHD service port
    port: 2222

But in the destination port I see that it still tries to connect to the default port:

+ rsync -azv '--info=progress2,misc0,flist0' --no-inc-recursive -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5' root@1.2.3.4:/source// /dest//
ssh: connect to host 1.2.3.4 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(228) [Receiver=3.2.3]

I think there should be root@1.2.3.4:2222, right?

To Reproduce Steps to reproduce the behavior:

  1. Set the custom port number in the values.yaml:
    sshd:
    service:
    # -- SSHD service port
    port: 2222
  2. Include this yaml to the helm chart: pv-migrate --helm-values ./values.yaml
  3. See an error:
    ❌ Error: migration failed: all strategies failed for this migration

Expected behavior All should work fine.

Console output

+ rsync -azv '--info=progress2,misc0,flist0' --no-inc-recursive -e 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5' root@1.2.3.4:/source// /dest//
ssh: connect to host 1.2.3.4 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(228) [Receiver=3.2.3]

Version

utkuozdemir commented 9 months ago

It is not well-documented, but the tool does not change any of its behavior based on the passed helm values.

Helm value passing feature is a "use-at-your-own-risk" feature for the users who know what they are doing. So it is quite possible to break the application by overriding the Helm values.

At the moment, sshd.service.port Helm value is only used internally by the local strategy, and there is no way for the user to use a different port.