Class KubeVirtPlannedNode

java.lang.Object
hudson.slaves.NodeProvisioner.PlannedNode
io.jenkins.plugins.kubevirt.KubeVirtPlannedNode
All Implemented Interfaces:
org.jenkinsci.plugins.cloudstats.TrackedItem

public class KubeVirtPlannedNode extends NodeProvisioner.PlannedNode implements org.jenkinsci.plugins.cloudstats.TrackedItem
A PlannedNode implementation that integrates with the cloud-stats plugin.

With the provisioning-launcher approach, the Future is typically pre-resolved (CompletableFuture.completedFuture(agent)), so the agent node is registered by Jenkins core almost immediately. VM lifecycle (creation, waiting, SSH) is handled inside KubeVirtProvisioningLauncher.launch(hudson.slaves.SlaveComputer, hudson.model.TaskListener), not in the future.

This class still handles the edge case where agent construction itself fails (the future completes exceptionally) — there is no VM to clean up in that case since provisioning hasn't started yet.

  • Constructor Details

    • KubeVirtPlannedNode

      public KubeVirtPlannedNode(String displayName, Future<Node> future, int numExecutors, org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id provisioningId, String templateName)
      Creates a new tracked planned node.
      Parameters:
      displayName - The display name for this node
      future - The future that will provide the node
      numExecutors - The number of executors this node will provide
      provisioningId - The cloud-stats provisioning activity ID
      templateName - The name of the template being used for provisioning
  • Method Details

    • getCloudName

      public String getCloudName()
      Gets the name of the cloud that is provisioning this node.
      Returns:
      The cloud name
    • getTemplateName

      public String getTemplateName()
      Gets the name of the template being used to provision this node.
      Returns:
      The template name
    • getId

      public org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id getId()
      Specified by:
      getId in interface org.jenkinsci.plugins.cloudstats.TrackedItem
    • spent

      public void spent()
      Called when this planned node is being consumed by Jenkins.

      With the pre-resolved future approach, this is called shortly after provision() returns. In the success case (the normal path), the node was already created and Jenkins will add it — no cleanup needed. The only case requiring action is when the future completed exceptionally (agent construction failed), but since no VM was created at that point, there is nothing to clean up.

      Overrides:
      spent in class NodeProvisioner.PlannedNode