Package io.jenkins.plugins.kubevirt
Class VirtctlPortForwardLauncher
java.lang.Object
hudson.slaves.ComputerLauncher
io.jenkins.plugins.kubevirt.VirtctlPortForwardLauncher
- All Implemented Interfaces:
ExtensionPoint,Describable<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/portforwardRBAC permission - virt-api connects directly to the VM's IP via
net.Dialon the server side
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class hudson.slaves.ComputerLauncher
LIST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterDisconnect(SlaveComputer computer, TaskListener listener) voidbeforeDisconnect(SlaveComputer computer, TaskListener listener) voidlaunch(SlaveComputer computer, TaskListener listener) Methods inherited from class hudson.slaves.ComputerLauncher
afterDisconnect, beforeDisconnect, checkJavaVersion, isLaunchSupported, launchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.Describable
getDescriptor
-
Constructor Details
-
VirtctlPortForwardLauncher
-
-
Method Details
-
launch
public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException - Overrides:
launchin classComputerLauncher- Throws:
IOExceptionInterruptedException
-
afterDisconnect
- Overrides:
afterDisconnectin classComputerLauncher
-
beforeDisconnect
- Overrides:
beforeDisconnectin classComputerLauncher
-