Class AgentLaunchStrategy
java.lang.Object
hudson.model.AbstractDescribableImpl<AgentLaunchStrategy>
io.jenkins.plugins.namespacecloud.launcher.AgentLaunchStrategy
- All Implemented Interfaces:
ExtensionPoint,Describable<AgentLaunchStrategy>
- Direct Known Subclasses:
InboundLaunchStrategy,SshLaunchStrategy
public abstract class AgentLaunchStrategy
extends AbstractDescribableImpl<AgentLaunchStrategy>
implements ExtensionPoint
How a provisioned Namespace instance is connected back to Jenkins.
Two directions are possible and they need opposite network paths, which is why this is a strategy rather than a flag:
InboundLaunchStrategy— the instance dials out to the controller over HTTP(S)/WebSocket. Needs no inbound firewall rule.SshLaunchStrategy— the controller dials in to the instance. Needs egress from Jenkins to Namespace's ingress.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBase descriptor so both strategies show up in the same dropdown.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidContributes to the instance request before it is sent — typically the container that will host the agent, plus any credentials it needs.abstract ComputerLaunchercreateLauncher(NamespaceClient client, Compute.InstanceMetadata instance, LaunchContext ctx) Builds the Jenkins-side launcher.booleanWhether the Jenkins node must be registered before the instance is created.booleanWhether this strategy needs theinstance:sshandingress:accessgrants.
-
Constructor Details
-
AgentLaunchStrategy
public AgentLaunchStrategy()
-
-
Method Details
-
configureInstance
public abstract void configureInstance(@NonNull Compute.CreateInstanceRequest.Builder builder, @NonNull LaunchContext ctx) throws IOException Contributes to the instance request before it is sent — typically the container that will host the agent, plus any credentials it needs.- Throws:
IOException- if the request cannot be completed, for instance because a configured credential is missing or unreadable. Failing here is preferable to provisioning an instance the controller would then be unable to connect to.
-
createLauncher
@NonNull public abstract ComputerLauncher createLauncher(@NonNull NamespaceClient client, @NonNull Compute.InstanceMetadata instance, @NonNull LaunchContext ctx) throws IOException, InterruptedException Builds the Jenkins-side launcher. Called once the instance is RUNNING, so implementations may query the instance for connection details.- Throws:
IOExceptionInterruptedException
-
requiresNodeRegisteredFirst
public boolean requiresNodeRegisteredFirst()Whether the Jenkins node must be registered before the instance is created. True for inbound: the agent connects on its own and the controller rejects a connection from a node it does not know about yet. -
requiresSshGrants
public boolean requiresSshGrants()Whether this strategy needs theinstance:sshandingress:accessgrants. -
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<AgentLaunchStrategy>
-