Package com.amazon.jenkins.ec2fleet
Class EC2FleetCloud
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
hudson.slaves.Cloud
com.amazon.jenkins.ec2fleet.AbstractEC2FleetCloud
com.amazon.jenkins.ec2fleet.EC2FleetCloud
- All Implemented Interfaces:
ExtensionPoint,Describable<Cloud>,ModelObject,SearchableModelObject,SearchItem,AccessControlled,ModelObjectWithContextMenu
The
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 / nodes-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classNested classes/interfaces inherited from class hudson.slaves.Cloud
Cloud.CloudStateNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEC2FleetCloud(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) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanProvision(Cloud.CloudState cloudState) Deprecated.UseawsCredentialsIdSeeawsCredentialsIddocumentation.intgetFleet()intintintintintintintintintbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanprovision(Cloud.CloudState cloudState, int excessWorkload) booleanremovePlannedNodeScheduledFutures(int numToRemove) booleanscheduleToTerminate(String instanceId, boolean ignoreMinConstraints, EC2AgentTerminationReason reason) Schedules Jenkins Node and EC2 instance for termination.update()Perform sync of plugin data with EC2 Spot Fleet state.Methods inherited from class hudson.slaves.Cloud
all, canProvision, doConfigSubmit, doDoDelete, getACL, getDisplayName, getIcon, getIconAltText, getIconClassName, getSearchUrl, getUrl, provision, reconfigure, reconfigure, registerPermissionsMethods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActionsMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.search.SearchItem
getSearchIcon
-
Field Details
-
EC2_INSTANCE_TAG_NAMESPACE
- See Also:
-
EC2_INSTANCE_CLOUD_NAME_TAG
- See Also:
-
BASE_DEFAULT_FLEET_CLOUD_ID
- See Also:
-
DEFAULT_CLOUD_STATUS_INTERVAL_SEC
public static final int DEFAULT_CLOUD_STATUS_INTERVAL_SEC- See Also:
-
-
Constructor Details
-
EC2FleetCloud
@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)
-
-
Method Details
-
isNoDelayProvision
public boolean isNoDelayProvision() -
getAwsCredentialsId
Deprecated.UseawsCredentialsIdSeeawsCredentialsIddocumentation. Don't use fields directly to be able get old version of plugin and for new.- Returns:
- credentials ID
-
isDisableTaskResubmit
public boolean isDisableTaskResubmit()- Specified by:
isDisableTaskResubmitin classAbstractEC2FleetCloud
-
getInitOnlineTimeoutSec
public int getInitOnlineTimeoutSec() -
getScheduledFutureTimeoutSec
public int getScheduledFutureTimeoutSec() -
getCloudStatusIntervalSec
public int getCloudStatusIntervalSec() -
getInitOnlineCheckIntervalSec
public int getInitOnlineCheckIntervalSec() -
getRegion
-
getEndpoint
-
getFleet
-
getFsRoot
-
isAddNodeOnlyIfRunning
public boolean isAddNodeOnlyIfRunning() -
getComputerConnector
-
isPrivateIpUsed
public boolean isPrivateIpUsed() -
isAlwaysReconnect
public boolean isAlwaysReconnect()- Specified by:
isAlwaysReconnectin classAbstractEC2FleetCloud
-
getLabelString
-
getIdleMinutes
public int getIdleMinutes()- Specified by:
getIdleMinutesin classAbstractEC2FleetCloud
-
getMaxSize
public int getMaxSize() -
getMinSize
public int getMinSize() -
getMinSpareSize
public int getMinSpareSize() -
getMaxTotalUses
public int getMaxTotalUses() -
getNumExecutors
public int getNumExecutors() -
isScaleExecutorsByWeight
public boolean isScaleExecutorsByWeight() -
getExecutorScaler
-
getJvmSettings
-
isRestrictUsage
public boolean isRestrictUsage() -
hasUnlimitedUsesForNodes
public boolean hasUnlimitedUsesForNodes() -
hasExcessCapacity
public boolean hasExcessCapacity()- Specified by:
hasExcessCapacityin classAbstractEC2FleetCloud
-
provision
public Collection<NodeProvisioner.PlannedNode> provision(@Nonnull Cloud.CloudState cloudState, int excessWorkload) -
update
Perform sync of plugin data with EC2 Spot Fleet state.- Returns:
- current state
-
removePlannedNodeScheduledFutures
public boolean removePlannedNodeScheduledFutures(int numToRemove) -
scheduleToTerminate
public boolean scheduleToTerminate(String instanceId, boolean ignoreMinConstraints, EC2AgentTerminationReason reason) Schedules Jenkins Node and EC2 instance for termination. IfignoreMinConstraintsis false and target capacity falls belowminSizeORminSpareSizethresholds, then reject termination. Else ifignoreMinConstraintsis true, schedule instance for termination even if it breachesminSizeORminSpareSizeReal termination will happens in
update()which is periodically called byCloudNanny. So there could be some lag between the decision to terminate the node and actual termination, you can find max lag size inCloudNanny.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.
- Specified by:
scheduleToTerminatein classAbstractEC2FleetCloud- Parameters:
instanceId- node name or instance IDignoreMinConstraints- terminate instance even if it breaches min size constraintreason- reason for termination- Returns:
trueif node scheduled for termination, otherwisefalse
-
canProvision
- Overrides:
canProvisionin classCloud
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Cloud>- Overrides:
getDescriptorin classCloud
-