Skip to content

feat: add autoscaler runner instance ready command option #1190

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

Conversation

maxvandermeij
Copy link
Contributor

@maxvandermeij maxvandermeij commented Oct 3, 2024

Description

This adds the optional instance_ready_command parameter for the docker_autoscaler.

This feature was added in Gitlab 16.11. See gitlab documentation for the [runners.autoscaler]: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersautoscaler-section.

Example value:
instance_ready_command = "cloud-init status --wait"

Migrations required

No

Verification

Updated the runner_worker_docker_autoscaler by including the instance_ready_command

runner_worker_docker_autoscaler = {
    fleeting_plugin_version = "1.0.0"
    connector_config_user = "ec2-user"
    key_pair_name = "runner-worker-key"
    max_use_count = 100
    update_interval = "1m"
    update_interval_when_expecting = "2s"
    capacity_per_instance = var.job_capacity_per_instance
    instance_ready_command = "\"cloud-init status --wait || test $? -eq 2\""
  }

Confirmed this gets added correctly to the config.toml by enabling the var.debug_write_runner_config_to_file.

Result on the local_file.config_toml[0]:

...
[runners.autoscaler]
      plugin = "fleeting-plugin-aws"
  
      capacity_per_instance = 1
      update_interval = "1m"
      update_interval_when_expecting = "2s"
  
      max_use_count = 100
      max_instances = 1
  
      instance_ready_command = "cloud-init status --wait || test $? -eq 2"
 ....

If no value is given for the instance_ready_command the config.toml will default to

...
[runners.autoscaler]
    plugin = "fleeting-plugin-aws"

    capacity_per_instance = 1
    update_interval = "1m"
    update_interval_when_expecting = "2s"

    max_use_count = 100
    max_instances = 1
    
    instance_ready_command=""
 ...

Copy link
Contributor

github-actions bot commented Oct 3, 2024

Hey @maxvandermeij! 👋

Thank you for your contribution to the project. Please refer to the contribution rules for a quick overview of the process.

Make sure that this PR clearly explains:

  • the problem being solved
  • the best way a reviewer and you can test your changes

With submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this LICENSE.

The following ChatOps commands are supported:

  • /help: notifies a maintainer to help you out

Simply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command.

This message was generated automatically. You are welcome to improve it.

@maxvandermeij maxvandermeij marked this pull request as ready for review October 3, 2024 18:53
@maxvandermeij
Copy link
Contributor Author

Anything I can do additionally to help with the review? @npalm @kayman-mk

@kayman-mk
Copy link
Collaborator

Thanks for improving the module.

Did you try to start an Agent with the variable unset? Just to make sure that it works with the default value.

@maxvandermeij
Copy link
Contributor Author

Thanks for improving the module.

Did you try to start an Agent with the variable unset? Just to make sure that it works with the default value.

Yes did indeed confirm with the new "" default workers spin up perfectly.

@kayman-mk kayman-mk merged commit a6fccc1 into cattle-ops:main Oct 9, 2024
19 checks passed
kayman-mk pushed a commit that referenced this pull request Oct 9, 2024
🤖 I have created a release *beep* *boop*
---


##
[7.15.0](7.14.0...7.15.0)
(2024-10-09)


### Features

* add autoscaler runner instance ready command option
([#1190](#1190))
([a6fccc1](a6fccc1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: cattle-ops-releaser-2[bot] <134548870+cattle-ops-releaser-2[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants