public class EC2FleetCloud extends AbstractEC2FleetCloud
EC2FleetCloud
contains the main configuration values used while creating Jenkins nodes.
EC2FleetCloud can represent either an AWS EC2 Spot Fleet or an AWS AutoScalingGroup.
Responsibilities include:
* maintain the configuration values set by user for the Cloud.
User-initiated changes to such configuration will result in a new EC2FleetCloud object. See Cloud
.
* provision new EC2 capacity along with supporting provisioning checks for EC2FleetCloud
* keep FleetStateStats
in sync with state on the AWS side via update()
* provide helper methods to extract certain state values
* provide helper methods to schedule termination of compute / nodesModifier and Type | Class and Description |
---|---|
static class |
EC2FleetCloud.DescriptorImpl |
static class |
EC2FleetCloud.ExecutorScaleDescriptor |
static class |
EC2FleetCloud.ExecutorScaler |
static class |
EC2FleetCloud.NodeHardwareScaler |
static class |
EC2FleetCloud.NoScaler |
static class |
EC2FleetCloud.WeightedScaler |
Cloud.CloudState
ExtensionPoint.LegacyInstancesAreScopedToHudson
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem
Modifier and Type | Field and Description |
---|---|
static String |
BASE_DEFAULT_FLEET_CLOUD_ID |
static int |
DEFAULT_CLOUD_STATUS_INTERVAL_SEC |
static String |
EC2_INSTANCE_CLOUD_NAME_TAG |
static String |
EC2_INSTANCE_TAG_NAMESPACE |
Constructor and Description |
---|
EC2FleetCloud(String name,
String awsCredentialsId,
String credentialsId,
String region,
String endpoint,
String fleet,
String labelString,
String fsRoot,
ComputerConnector computerConnector,
boolean privateIpUsed,
boolean alwaysReconnect,
Integer idleMinutes,
int minSize,
int maxSize,
int minSpareSize,
int numExecutors,
boolean addNodeOnlyIfRunning,
boolean restrictUsage,
String maxTotalUses,
boolean disableTaskResubmit,
Integer initOnlineTimeoutSec,
Integer initOnlineCheckIntervalSec,
Integer cloudStatusIntervalSec,
boolean noDelayProvision,
boolean scaleExecutorsByWeight,
EC2FleetCloud.ExecutorScaler executorScaler) |
all, canProvision, getACL, getDisplayName, getSearchUrl, getUrl, provision
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActions
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
public static final String EC2_INSTANCE_TAG_NAMESPACE
public static final String EC2_INSTANCE_CLOUD_NAME_TAG
public static final String BASE_DEFAULT_FLEET_CLOUD_ID
public static final int DEFAULT_CLOUD_STATUS_INTERVAL_SEC
@DataBoundConstructor public EC2FleetCloud(@Nonnull String name, String awsCredentialsId, @Deprecated String credentialsId, String region, String endpoint, String fleet, String labelString, String fsRoot, ComputerConnector computerConnector, boolean privateIpUsed, boolean alwaysReconnect, Integer idleMinutes, int minSize, int maxSize, int minSpareSize, int numExecutors, boolean addNodeOnlyIfRunning, boolean restrictUsage, String maxTotalUses, boolean disableTaskResubmit, Integer initOnlineTimeoutSec, Integer initOnlineCheckIntervalSec, Integer cloudStatusIntervalSec, boolean noDelayProvision, boolean scaleExecutorsByWeight, EC2FleetCloud.ExecutorScaler executorScaler)
public boolean isNoDelayProvision()
public String getAwsCredentialsId()
awsCredentialsId
See awsCredentialsId
documentation. Don't use fields directly to be able
get old version of plugin and for new.public boolean isDisableTaskResubmit()
isDisableTaskResubmit
in class AbstractEC2FleetCloud
public int getInitOnlineTimeoutSec()
public int getScheduledFutureTimeoutSec()
public int getCloudStatusIntervalSec()
public int getInitOnlineCheckIntervalSec()
public String getRegion()
public String getEndpoint()
public String getFleet()
public String getFsRoot()
public boolean isAddNodeOnlyIfRunning()
public ComputerConnector getComputerConnector()
public boolean isPrivateIpUsed()
public boolean isAlwaysReconnect()
isAlwaysReconnect
in class AbstractEC2FleetCloud
public String getLabelString()
public int getIdleMinutes()
getIdleMinutes
in class AbstractEC2FleetCloud
public int getMaxSize()
public int getMinSize()
public int getMinSpareSize()
public int getMaxTotalUses()
public int getNumExecutors()
public boolean isScaleExecutorsByWeight()
public EC2FleetCloud.ExecutorScaler getExecutorScaler()
public String getJvmSettings()
public boolean isRestrictUsage()
public boolean hasUnlimitedUsesForNodes()
public boolean hasExcessCapacity()
hasExcessCapacity
in class AbstractEC2FleetCloud
public Collection<NodeProvisioner.PlannedNode> provision(@Nonnull Cloud.CloudState cloudState, int excessWorkload)
public FleetStateStats update()
public boolean removePlannedNodeScheduledFutures(int numToRemove)
public boolean scheduleToTerminate(String instanceId, boolean ignoreMinConstraints, EC2AgentTerminationReason reason)
ignoreMinConstraints
is false and target capacity falls below minSize
OR minSpareSize
thresholds, then reject termination.
Else if ignoreMinConstraints
is true, schedule instance for termination even if it breaches minSize
OR minSpareSize
Real termination will happens in update()
which is periodically called by
CloudNanny
. So there could be some lag between the decision to terminate the node
and actual termination, you can find max lag size in CloudNanny.getRecurrencePeriod()
This method doesn't do real termination to reduce load for Jenkins in case when multiple nodes should be terminated in short time, without schedule process and batch termination, multiple calls should be raised to AWS EC2 API which takes some time and block cloud class.
scheduleToTerminate
in class AbstractEC2FleetCloud
instanceId
- node name or instance IDignoreMinConstraints
- terminate instance even if it breaches min size constraintreason
- reason for terminationtrue
if node scheduled for termination, otherwise false
public boolean canProvision(Cloud.CloudState cloudState)
canProvision
in class Cloud
public EC2FleetCloud.DescriptorImpl getDescriptor()
getDescriptor
in interface Describable<Cloud>
getDescriptor
in class Cloud
Copyright © 2016–2023. All rights reserved.