Class VirtctlPortForwardLauncher

java.lang.Object
hudson.slaves.ComputerLauncher
io.jenkins.plugins.kubevirt.VirtctlPortForwardLauncher
All Implemented Interfaces:
ExtensionPoint, Describable<ComputerLauncher>

public class VirtctlPortForwardLauncher extends ComputerLauncher
A ComputerLauncher that establishes SSH connection through a KubeVirt WebSocket tunnel.

This launcher uses the KubeVirt-native portforward subresource API to tunnel SSH traffic through the Kubernetes API server, without requiring direct network access to the VM or discovery of virt-launcher pods.

The data flow is:

 SSHLauncher ──► 127.0.0.1:localPort ──► WebSocket ──► virt-api ──► VM:22
 

The API endpoint used is:

 wss://<api>/apis/subresources.kubevirt.io/v1/namespaces/{ns}/virtualmachineinstances/{name}/portforward/22/tcp
 

This approach:

  • Eliminates the need to find virt-launcher pods (no pod list/get RBAC needed)
  • Uses the KubeVirt-native subresource API (same mechanism as virtctl ssh)
  • Only requires virtualmachineinstances/portforward RBAC permission
  • virt-api connects directly to the VM's IP via net.Dial on the server side
See Also: