Class EC2FleetCloud

All Implemented Interfaces:
ExtensionPoint, Describable<Cloud>, ModelObject, SearchableModelObject, SearchItem, AccessControlled, ModelObjectWithContextMenu

public class EC2FleetCloud extends AbstractEC2FleetCloud
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
  • Field Details

  • 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

      public String getAwsCredentialsId()
      Deprecated.Use awsCredentialsId See awsCredentialsId documentation. 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:
      isDisableTaskResubmit in class AbstractEC2FleetCloud
    • getInitOnlineTimeoutSec

      public int getInitOnlineTimeoutSec()
    • getScheduledFutureTimeoutSec

      public int getScheduledFutureTimeoutSec()
    • getCloudStatusIntervalSec

      public int getCloudStatusIntervalSec()
    • getInitOnlineCheckIntervalSec

      public int getInitOnlineCheckIntervalSec()
    • getRegion

      public String getRegion()
    • getEndpoint

      public String getEndpoint()
    • getFleet

      public String getFleet()
    • getFsRoot

      public String getFsRoot()
    • isAddNodeOnlyIfRunning

      public boolean isAddNodeOnlyIfRunning()
    • getComputerConnector

      public ComputerConnector getComputerConnector()
    • isPrivateIpUsed

      public boolean isPrivateIpUsed()
    • isAlwaysReconnect

      public boolean isAlwaysReconnect()
      Specified by:
      isAlwaysReconnect in class AbstractEC2FleetCloud
    • getLabelString

      public String getLabelString()
    • getIdleMinutes

      public int getIdleMinutes()
      Specified by:
      getIdleMinutes in class AbstractEC2FleetCloud
    • 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

      public EC2FleetCloud.ExecutorScaler getExecutorScaler()
    • getJvmSettings

      public String getJvmSettings()
    • isRestrictUsage

      public boolean isRestrictUsage()
    • hasUnlimitedUsesForNodes

      public boolean hasUnlimitedUsesForNodes()
    • hasExcessCapacity

      public boolean hasExcessCapacity()
      Specified by:
      hasExcessCapacity in class AbstractEC2FleetCloud
    • provision

      public Collection<NodeProvisioner.PlannedNode> provision(@Nonnull Cloud.CloudState cloudState, int excessWorkload)
      Overrides:
      provision in class Cloud
    • update

      public FleetStateStats 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. If 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.

      Specified by:
      scheduleToTerminate in class AbstractEC2FleetCloud
      Parameters:
      instanceId - node name or instance ID
      ignoreMinConstraints - terminate instance even if it breaches min size constraint
      reason - reason for termination
      Returns:
      true if node scheduled for termination, otherwise false
    • canProvision

      public boolean canProvision(Cloud.CloudState cloudState)
      Overrides:
      canProvision in class Cloud
    • getDescriptor

      public EC2FleetCloud.DescriptorImpl getDescriptor()
      Specified by:
      getDescriptor in interface Describable<Cloud>
      Overrides:
      getDescriptor in class Cloud