Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/event based instance replacement - Merged all "new" commit from master #433

Commits on Aug 20, 2019

  1. Allow flavor to be customised (LeanerCloud#359)

    Chris authored and cristim committed Aug 20, 2019
    Configuration menu
    Copy the full SHA
    719ad73 View commit details
    Browse the repository at this point in the history
  2. fix typo (LeanerCloud#360)

    codenoid authored and cristim committed Aug 20, 2019
    Configuration menu
    Copy the full SHA
    2ad0e99 View commit details
    Browse the repository at this point in the history
  3. Fix typo (LeanerCloud#361)

    Chris authored and cristim committed Aug 20, 2019
    3 Configuration menu
    Copy the full SHA
    89a188c View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2019

  1. UserData wrappers for CloudFormation helper scripts when using Beanst…

    …alk (LeanerCloud#366)
    
    * Support custom role for cfn-init in Beanstalk UserData
    
    * Wrappers & refactoring
    
    * Docs
    
    * Docs fixes
    
    * More docs fixes
    
    * Docs fixes
    
    * Yet more docs fixes
    
    * Lambda & Kubernetes config
    
    * AutoSpottingElasticBeanstalk managed policy + Rename beanstalk_cfn_init_role to beanstalk_cfn_wrappers
    
    * Update param description
    
    * Kubernetes config fix
    
    * Rename Beanstalk variable + Move test data
    
    * Add missing permission for AutoSpottingBeanstalk role
    jawadst authored and cristim committed Oct 11, 2019
    Configuration menu
    Copy the full SHA
    4382e90 View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2019

  1. Bring Go to 1.13 (LeanerCloud#367)

    gliptak authored and cristim committed Nov 7, 2019
    Configuration menu
    Copy the full SHA
    d078902 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2019

  1. merge with master

    mello7tre committed Nov 19, 2019
    Configuration menu
    Copy the full SHA
    b6e040e View commit details
    Browse the repository at this point in the history
  2. merge fixes

    mello7tre committed Nov 19, 2019
    Configuration menu
    Copy the full SHA
    a33cc2c View commit details
    Browse the repository at this point in the history
  3. Begin - port regional CloudFormation stack changes to the main templa…

    …te so it can also run from a StackSet
    mello7tre committed Nov 19, 2019
    Configuration menu
    Copy the full SHA
    900568a View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2019

  1. Merge fix

    mello7tre committed Nov 20, 2019
    Configuration menu
    Copy the full SHA
    1c854e0 View commit details
    Browse the repository at this point in the history
  2. Fix to template

    mello7tre committed Nov 20, 2019
    Configuration menu
    Copy the full SHA
    2784995 View commit details
    Browse the repository at this point in the history

Commits on Nov 26, 2019

  1. Multiple fixes to handle lambda concurrency

    As instaces can be launched in concurrency/overlapping we have the
    problems related to multiple lambdas acting on the same ASG
    mello7tre committed Nov 26, 2019
    Configuration menu
    Copy the full SHA
    168e97a View commit details
    Browse the repository at this point in the history
  2. Removed commented code

    mello7tre committed Nov 26, 2019
    Configuration menu
    Copy the full SHA
    0cc82a1 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2019

  1. Configuration menu
    Copy the full SHA
    a1350fc View commit details
    Browse the repository at this point in the history
  2. Progress LeanerCloud#354

    Created Queue in CF template
    Begin sending message
    mello7tre committed Nov 27, 2019
    Configuration menu
    Copy the full SHA
    a0ae84b View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2019

  1. Progress LeanerCloud#354

    mello7tre committed Nov 28, 2019
    Configuration menu
    Copy the full SHA
    d8261a2 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2019

  1. Progress LeanerCloud#354

    mello7tre committed Nov 29, 2019
    Configuration menu
    Copy the full SHA
    3a6fd0a View commit details
    Browse the repository at this point in the history
  2. Progress LeanerCloud#354

    mello7tre committed Nov 29, 2019
    Configuration menu
    Copy the full SHA
    1a53041 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2019

  1. Progress LeanerCloud#354

    mello7tre committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    68b8338 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2019

  1. Progress LeanerCloud#354

    mello7tre committed Dec 3, 2019
    Configuration menu
    Copy the full SHA
    40224d7 View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2019

  1. * Use inline python lambda to increase ASG

    Use it only if AttachInstances method fails for wrong ASG max size.
    mello7tre committed Dec 6, 2019
    Configuration menu
    Copy the full SHA
    1899417 View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2019

  1. * Use inline python lambda to increase ASG

    progress
    mello7tre committed Dec 8, 2019
    Configuration menu
    Copy the full SHA
    f102241 View commit details
    Browse the repository at this point in the history

Commits on Dec 9, 2019

  1. * Use inline python lambda to increase ASG

    progress
    mello7tre committed Dec 9, 2019
    Configuration menu
    Copy the full SHA
    1d395bc View commit details
    Browse the repository at this point in the history

Commits on Dec 10, 2019

  1. * Improvements on event based instance replacement

    - Ported to StackSet deploy mode.
    
    - Fix to "ScalingActivityInProgress" if launched ondemand instance is
    terminated before going "inservice":
    
    	Created method "waitForInstanceStatus", that wait, until a max
    	retry (5), that an instance belonging to an ASG is in the desired
    	status (InService).
    	(Sleep time is 5*retry)
    
    - Fix to multiple problems caused by lambda concurrency changing ASG
    MaxSize:
    	Created another Lambda (LambdaManageASG) in the same region of
    	the main one; code python3.7, inline in template.
    	Lambda concurrency is set to one.
    	Is function is to change ASG MaxSize by the ammount specified.
    
    	Used a "try-catch approach":
    	if AttachInstances return error code "ValidationError" and
    	string "update the AutoScalingGroup sizes" is present in error
    	message, means that we need to increase ASG MaxSize.
    	So we execute method changeAutoScalingMaxSize that invoke
    	LambdaManageASG.
    
    	If invoke return error "ErrCodeTooManyRequestsException", means
    	that multiple Main lambdas are executing LambdaManageASG, we
    	sleep for a random interval part of seconds and retry.
    
    	Method attachSpotInstance now return an int that represent the
    	ammount of change to the ASG MaxSize, so that in
    	swapWithGroupMember we can defer the call to
    	changeAutoScalingMaxSize to decrease the ASG MaxSize of the
    	previously increased ammount.
    
    	We use "waitForInstanceStatus" in attachSpotInstance before
    	returning to be sure that spot instance has been attached and
    	are InService before beginning to terminate ondemand one.
    mello7tre committed Dec 10, 2019
    Configuration menu
    Copy the full SHA
    36e82a8 View commit details
    Browse the repository at this point in the history

Commits on Dec 30, 2019

  1. * Improvements on event based instance replacement

    - Add logPrefix to better identify lambda actions in case of concurent
    executions.
    	TE = Spot terminate event
    	ST = Instance start event
    	SC = Schedule event
    
    TE and ST are followed by instanceID, SC is followed by activation time.
    mello7tre committed Dec 30, 2019
    Configuration menu
    Copy the full SHA
    63ba2b2 View commit details
    Browse the repository at this point in the history
  2. * Improvements on event based instance replacement

    - fix/improvement on Suspending/Resuming Termination process:
    suspend/resume is now handled by LambdaManageASG too.
    
    When i successfully suspend termination, i add a tag
    "autospotting_suspend_process_by" with value equals to the instanceId
     event that triggered the main lambda.
    When i try to resume termination first check if the value of the tag
    above equals the current one.
    If not, means that another main lambda, different from the one who suspended
    it, is trying to resume the process; in that case i do not resume it.
    
    Considered that LambdaManageASG has a concurrent execution limit set to
    1 we can have the following cases:
    
    1)
      *) A main lambda suspend the process.
      *) No other lambda suspend it.
      *) Main lambda resume the process.
      *) Another main lambda suspend the process
      *) ....and so on
    
    2)
      *) A main lambda suspend the process.
      *) Before the first one resume the process another one suspend it (so
      replacing the tag value)
      *) First lambda do not resume the process (tag value differ)
      *) Second lambda resume the process
    
    In the wrost scenario of a Lambda dying before resuming the process, it
    will be resumed after another one will suspend it.
    mello7tre committed Dec 30, 2019
    Configuration menu
    Copy the full SHA
    d49a0d3 View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2019

  1. * Improvements on event based instance replacement

    code cosmetic fix
    mello7tre committed Dec 31, 2019
    Configuration menu
    Copy the full SHA
    476ba58 View commit details
    Browse the repository at this point in the history

Commits on Jan 2, 2020

  1. * Improvements on event based instance replacement

    - for rand seed instead of using time.Now().UnixNano() we build a seed
    based on the instanceId that triggered the event.
    
    The seed is build this way:
    for every char of instanceId (starting from third char) we get his rune
     "representation" and sum it to previous one.
    We use it as a temporary seed and get a random number between 0 and 9.
    
    The final seed is the concatenation of the generated random numbers.
    
    This way we have a seed number (int64) that depend from the instanceId and
    of the same lenght.
    mello7tre committed Jan 2, 2020
    Configuration menu
    Copy the full SHA
    1f358a6 View commit details
    Browse the repository at this point in the history
  2. * Improvements on event based instance replacement

    - no more need to "revert attach/detach order when running on minimum
    capacity".
    Defer changeAutoScalingMaxSize and use same logic of
    swapWithGroupMember.
    mello7tre committed Jan 2, 2020
    Configuration menu
    Copy the full SHA
    621bb79 View commit details
    Browse the repository at this point in the history
  3. * Improvements on event based instance replacement

    - Use suspendResumeProcess for schedule replaceOnDemandInstanceWithSpot
    too.
    
    We use it as a trick to avoid rare cases of concurrency between
    scheduled and event lambdas.
    As lambda that handle "suspendResumeProcess" have a concurrency limit of
    one, scheduled and event lambdas, if concurrent, will be "time shifted"
    by a random value.
    This way they will not execute attachSpotInstance at the same time.
    
    In case of scheduled lambda we add the "S" char to the instanceId used for
    the randSeed to avoid that it resume process suspended by event lambda.
    
    - Fix in swapWithGroupMember:
    defer asg.suspendResumeProcess for resume so that it will be executed
    even if function swapWithGroupMember return error.
    mello7tre committed Jan 2, 2020
    Configuration menu
    Copy the full SHA
    2edb1a1 View commit details
    Browse the repository at this point in the history
  4. * gofmt cosmetic changes

    mello7tre committed Jan 2, 2020
    Configuration menu
    Copy the full SHA
    6a137cc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    83c474c View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2020

  1. fix terminateRandomSpotInstanceIfHavingEnough

    need another condition to avoid terminating valid spot instance in case ASG have minOnDemand > 0
    
    if all ASG instances are in state running and
      Min OnDemand instance equals total ondemand running and
      all instances running equals desired capacity
    means that i do not need to terminate a spot instance
    
    need some testing
    mello7tre committed Mar 31, 2020
    Configuration menu
    Copy the full SHA
    a00efde View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c93bffd View commit details
    Browse the repository at this point in the history
  3. fix terminateRandomSpotInstanceIfHavingEnough

    changed allInstancesRunning to return ondemand instances running too
    mello7tre committed Mar 31, 2020
    Configuration menu
    Copy the full SHA
    1c26c6c View commit details
    Browse the repository at this point in the history

Commits on Apr 1, 2020

  1. Specify/override multiplier for the on-demand price on a group

    level
    
    As i.price already have been multiplied by the global value, if
    specified, i need first to divide it by the same value and then multiply
    it by the multiplier specific to the ASG.
    
    We need to do this for both scheduled and event actions.
    For event we act in function belongsToEnabledASG.
    For schedule we act in launchSpotReplacement.
    
    Need deep testing...
    mello7tre committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    073c636 View commit details
    Browse the repository at this point in the history
  2. Specify/override multiplier for the on-demand price on a group

        level - fix
    
    in loadConfOnDemandPriceMultiplier need to use
    a.config.OnDemandPriceMultiplier in place of
    a.region.conf.OnDemandPriceMultiplier
    
    this way a.region.conf.OnDemandPriceMultiplier will conserve the
    original global value
    mello7tre committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    b8a4a1e View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2020

  1. Merge remote-tracking branch 'upstream/feat/event-based-instance-repl…

    …acement' into feat/event-based-instance-replacement
    
    upstream merge
    mello7tre committed Apr 2, 2020
    Configuration menu
    Copy the full SHA
    56e03d7 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2020

  1. Configuration menu
    Copy the full SHA
    ae8f29b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b3d0daa View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2fbf9e0 View commit details
    Browse the repository at this point in the history
  4. For Test_autoScalingGroup_terminateRandomSpotInstanceIfHavingEnough

    added contion:
    "spot capacity is correct, skip termination"
    mello7tre committed Apr 3, 2020
    Configuration menu
    Copy the full SHA
    582c525 View commit details
    Browse the repository at this point in the history

Commits on Jul 8, 2020

  1. Configuration menu
    Copy the full SHA
    647337e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e771de7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8d83a91 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7a57534 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a0778fa View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2ef762d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    036b91e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8ff296e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3fdab5b View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    a641137 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    56f05f0 View commit details
    Browse the repository at this point in the history
  12. Merge Ignore terminating spot instances that don't belong to

    AutoSpotting (master) and Enable Spot Termination ASG Checking (event) [33a444c]
    mello7tre committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    9135a45 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    f20ad02 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    71820f8 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    5bae2d5 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    a086398 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    83e4396 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    3f849fb View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    13eba5b View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2020

  1. Configuration menu
    Copy the full SHA
    b83f6fd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    acfa8ad View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b5ade8b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    80cfa8b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    eefe516 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    42d3c71 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6de9c2e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8cc90f7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    bcdf509 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    165ce0e View commit details
    Browse the repository at this point in the history
  11. Merge Spleling [a37aafc]

    mello7tre committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    cb05c6f View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    8907710 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    c9c3ff1 View commit details
    Browse the repository at this point in the history
  14. gofmt changes

    mello7tre committed Jul 9, 2020
    Configuration menu
    Copy the full SHA
    742e011 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2020

  1. cronEventAction - fix to logic

    need to invert test for needReplaceOnDemandInstances and
    onDemandInstance == nil
    
    currently if onDemandInstance == nil methods return and execution stop.
    This way the check to terminate a spotInstace if their number is more
    than required is never done.
    
    Assume that ASG scale down and terminate the onDemand instances that
    autospotting is not terminating [autospotting_min_on_demand_number].
    On the next runs onDemandInstance will be nil and spot instances in
    excess will not be terminated.
    mello7tre committed Jul 28, 2020
    Configuration menu
    Copy the full SHA
    af6ccfc View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2020

  1. Merge branch 'feat/event-based-instance-replacement' into feat/event-…

    …based-instance-replacement
    mello7tre committed Jul 29, 2020
    Configuration menu
    Copy the full SHA
    a6e9bbb View commit details
    Browse the repository at this point in the history