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

✨🚨Autoscaling: Prepare Warmed EBS-backed volumes to use as buffer for machines (⚠️ Devops) 🚨 #5923

Conversation

sanderegg
Copy link
Member

@sanderegg sanderegg commented Jun 6, 2024

What do these changes do?

This PR brings in the first step towards using stopped machines as a buffer instead of running machines. This PR brings in the background task that should create the buffer machines. The next PR will bring in using these.

NOTE: To use this new feature, it relies on new AMIs that always include a EBS volume, otherwise this cannot work! see https://git.speag.com/oSparc/osparc-infra/-/merge_requests/232

NOTE2: The new EBS-based buffering system is until now compatible with the old one.

Details

  • driving test: services/autoscaling/tests/unit/test_modules_buffer_machine_core.py
  • In a separate background task:
    1. Based on EC2_INSTANCES_ALLOWED_TYPES newly added field buffer_count,
    2. create buffer_count EC2 instances,
    3. via AWS SSM service, wait for EC2 to complete cloud-init by calling cloud-init --wait,
    4. via AWS SSM service, pre-pull images until completion,
    5. stop the machines,
    6. stopped machines are considered ready to use as buffer
  • this is stateless, at each iteration the task checks for the current state directly via AWS EC2 API
  • autoscaling (dynamic services only) newly need access to SSM acount: via AUTOSCALING_SSM_ACCESS
  • autoscaling (dynamic services only) newly needs dedicated IAM role via EC2_INSTANCES_ATTACHED_IAM_PROFILE, such that it can create SSM enabled EC2 instances (AWS reference)

Bonus:

  • now assert located in pytest-simcore helpers will nicely print reference

Next steps (next PR) shall be:

2nd step:

  • if a dynamic service demands it,
  • start a "stopped buffer machine" if available, changin its tags,
  • use SSM to make the machine join the swarm,
  • and let it live as usual...

possible improvements once all is in if necessary:

Related issue/s

How to test

Dev-ops checklist

  • new ENVs:
SSM_ACCESS_KEY_ID
SSM_ENDPOINT
SSM_REGION_NAME
SSM_SECRET_ACCESS_KEY
EC2_INSTANCES_ATTACHED_IAM_PROFILE

@sanderegg sanderegg added the a:autoscaling autoscaling service in simcore's stack label Jun 6, 2024
@sanderegg sanderegg added this to the South Island Iced Tea milestone Jun 6, 2024
@sanderegg sanderegg self-assigned this Jun 6, 2024
@sanderegg sanderegg force-pushed the autoscaling/use-only-ebs-storage-as-buffers branch from bd95cb1 to b8fdb63 Compare June 7, 2024 06:54
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 95.18900% with 14 lines in your changes missing coverage. Please review.

Project coverage is 87.9%. Comparing base (cafbf96) to head (268a547).
Report is 339 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5923      +/-   ##
=========================================
+ Coverage    84.5%   87.9%    +3.3%     
=========================================
  Files          10    1437    +1427     
  Lines         214   59071   +58857     
  Branches       25    1404    +1379     
=========================================
+ Hits          181   51937   +51756     
- Misses         23    6840    +6817     
- Partials       10     294     +284     
Flag Coverage Δ
integrationtests 64.8% <ø> (?)
unittests 85.9% <95.1%> (+1.4%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
packages/aws-library/src/aws_library/ec2/models.py 88.8% <100.0%> (ø)
...ling/src/simcore_service_autoscaling/api/health.py 100.0% <100.0%> (ø)
...rc/simcore_service_autoscaling/core/application.py 100.0% <100.0%> (ø)
...ing/src/simcore_service_autoscaling/core/errors.py 100.0% <100.0%> (ø)
...g/src/simcore_service_autoscaling/core/settings.py 100.0% <100.0%> (ø)
...oscaling/src/simcore_service_autoscaling/models.py 100.0% <100.0%> (ø)
...e_service_autoscaling/modules/auto_scaling_core.py 94.3% <100.0%> (ø)
...e_service_autoscaling/modules/auto_scaling_task.py 100.0% <100.0%> (ø)
...e_autoscaling/modules/buffer_machines_pool_task.py 100.0% <100.0%> (ø)
...ore_service_autoscaling/utils/auto_scaling_core.py 93.8% <100.0%> (ø)
... and 6 more

... and 1384 files with indirect coverage changes

@sanderegg sanderegg force-pushed the autoscaling/use-only-ebs-storage-as-buffers branch 5 times, most recently from 6e7b1f2 to 0f6c2d7 Compare June 14, 2024 08:45
@sanderegg sanderegg force-pushed the autoscaling/use-only-ebs-storage-as-buffers branch from 0f6c2d7 to 912c2a4 Compare June 14, 2024 14:09

This comment was marked as outdated.

@sanderegg sanderegg force-pushed the autoscaling/use-only-ebs-storage-as-buffers branch 8 times, most recently from 62413a2 to 0d7ea4b Compare July 5, 2024 15:10
@sanderegg sanderegg force-pushed the autoscaling/use-only-ebs-storage-as-buffers branch 2 times, most recently from 078b423 to 8902c55 Compare July 8, 2024 13:23
@sanderegg sanderegg modified the milestones: South Island Iced Tea, Tom Bombadil Jul 8, 2024
@sanderegg sanderegg changed the title ✨Autoscaling: Prepare Warmed EBS-backed volumes to use as buffer for machines ✨Autoscaling: Prepare Warmed EBS-backed volumes to use as buffer for machines (⚠️ Devops) Jul 8, 2024
@sanderegg sanderegg force-pushed the autoscaling/use-only-ebs-storage-as-buffers branch from c249ef9 to 1fe04d2 Compare July 9, 2024 11:07
@sanderegg sanderegg marked this pull request as ready for review July 9, 2024 11:23
@sanderegg sanderegg requested a review from mrnicegyu11 as a code owner July 9, 2024 11:23
@sanderegg sanderegg force-pushed the autoscaling/use-only-ebs-storage-as-buffers branch from f1af39f to 268a547 Compare July 11, 2024 12:59
@sanderegg sanderegg merged commit d080407 into ITISFoundation:master Jul 11, 2024
56 checks passed
@sanderegg sanderegg deleted the autoscaling/use-only-ebs-storage-as-buffers branch July 11, 2024 14:04
mrnicegyu11 pushed a commit to mrnicegyu11/osparc-simcore that referenced this pull request Jul 17, 2024
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 15, 2024
67 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:autoscaling autoscaling service in simcore's stack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants