From 29ff5df9d6fe3343156ca6e190518a71a54e8a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Krienb=C3=BChl?= Date: Wed, 14 May 2025 10:38:51 +0200 Subject: [PATCH 1/3] Add the ability to override the fleeting image used --- config-example.yml | 3 +++ templates/gitlab-runner.toml.j2 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config-example.yml b/config-example.yml index 2cd1cd9..926158a 100644 --- a/config-example.yml +++ b/config-example.yml @@ -47,6 +47,9 @@ gitlab: # GitLab runner instances settings gitlab_runner: + # The fleeting plugin image to use + fleeting_image: quay.io/cloudscalech/fleeting-plugin-cloudscale:latest + # Unique name for this group of managed runner instances group: fleeting diff --git a/templates/gitlab-runner.toml.j2 b/templates/gitlab-runner.toml.j2 index 17b64c3..bf6fc15 100644 --- a/templates/gitlab-runner.toml.j2 +++ b/templates/gitlab-runner.toml.j2 @@ -15,7 +15,7 @@ concurrent = {{ use_external_addr = true [runners.autoscaler] - plugin = "quay.io/cloudscalech/fleeting-plugin-cloudscale:latest" + plugin = "{{ config.gitlab_runner.fleeting_image | default('quay.io/cloudscalech/fleeting-plugin-cloudscale:latest') }}" capacity_per_instance = {{ config.gitlab_runner.capacity_per_instance }} max_instances = {{ config.gitlab_runner.max_instances }} From 03a1e194e725d45417ad6b78ee5f451ba8526fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Krienb=C3=BChl?= Date: Wed, 14 May 2025 13:04:38 +0200 Subject: [PATCH 2/3] Add support for private network interfaces --- config-example.yml | 18 ++++++++++++++++++ playbooks/gitlab-autoscale.yml | 4 ++++ templates/gitlab-runner.toml.j2 | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/config-example.yml b/config-example.yml index 926158a..74ce1a3 100644 --- a/config-example.yml +++ b/config-example.yml @@ -44,6 +44,14 @@ gitlab: #cloud-config package_upgrade: true + # List of networks this gitlab server is part of. This may be a private + # network uuid, or the constant "public" for public networks. + # + # Note that at least one network entry has to be shared with the gitlab + # runner config below, or the runners won't be able to contact the server. + networks: + - public + # GitLab runner instances settings gitlab_runner: @@ -65,6 +73,16 @@ gitlab_runner: # The size of the root disk volume_size_gb: 25 + # The networks attached to the gitlab runner. The first network is used to + # communicate with the GitLab server. The GitLab runner typically needs + # internet access, so if only private networks are configured, a default + # gateway has to be configured. + # + # The first entry in the list of networks is used to communicate with + # the GitLab server. + networks: + - public + # The user data applied to each instance. Note that GitLab expects to find # a working docker configuration. user_data: | diff --git a/playbooks/gitlab-autoscale.yml b/playbooks/gitlab-autoscale.yml index 6e44707..af929e2 100755 --- a/playbooks/gitlab-autoscale.yml +++ b/playbooks/gitlab-autoscale.yml @@ -45,6 +45,10 @@ volume_size_gb: '{{ config.gitlab.volume_size_gb }}' ssh_keys: '{{ config.gitlab.ssh_keys }}' user_data: '{{ config.gitlab.user_data }}' + interfaces: | + [{% for network in config.gitlab.networks | default(["public"]) %} + {"network": "{{ network }}"}{% if not loop.last %},{% endif %} + {% endfor %}] register: gitlab_server until: gitlab_server.ssh_host_keys retries: 60 diff --git a/templates/gitlab-runner.toml.j2 b/templates/gitlab-runner.toml.j2 index bf6fc15..f4b3b2b 100644 --- a/templates/gitlab-runner.toml.j2 +++ b/templates/gitlab-runner.toml.j2 @@ -38,6 +38,11 @@ concurrent = {{ zone = "{{ config.gitlab_runner.zone }}" user_data = """{{ config.gitlab_runner.user_data }}""" volume_size_gb = {{ config.gitlab_runner.volume_size_gb | default(10) }} + interfaces = [ + {% for network in config.gitlab_runner.networks | default(["public"]) %} + { network = "{{ network }}" }, + {% endfor %} + ] {% for policy in config.gitlab_runner.policies %} # {{ policy.name }} From 84a9c54a55e0b6cd2584bb15272a7f7984974351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Krienb=C3=BChl?= Date: Mon, 19 May 2025 12:50:32 +0200 Subject: [PATCH 3/3] Improve wording and consistency of docs --- config-example.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/config-example.yml b/config-example.yml index 74ce1a3..96c2101 100644 --- a/config-example.yml +++ b/config-example.yml @@ -44,10 +44,10 @@ gitlab: #cloud-config package_upgrade: true - # List of networks this gitlab server is part of. This may be a private + # List of networks this GitLab server is part of. This may be a private # network uuid, or the constant "public" for public networks. # - # Note that at least one network entry has to be shared with the gitlab + # Note that at least one network entry has to be shared with the GitLab # runner config below, or the runners won't be able to contact the server. networks: - public @@ -73,13 +73,10 @@ gitlab_runner: # The size of the root disk volume_size_gb: 25 - # The networks attached to the gitlab runner. The first network is used to + # The networks attached to the GitLab runner. The first network is used to # communicate with the GitLab server. The GitLab runner typically needs # internet access, so if only private networks are configured, a default # gateway has to be configured. - # - # The first entry in the list of networks is used to communicate with - # the GitLab server. networks: - public @@ -114,7 +111,7 @@ gitlab_runner: # The number of jobs an instance completes, before it is removed max_builds: 1024 - # Delete instances when the controlling gitlab runner is shut down. This + # Delete instances when the controlling GitLab runner is shut down. This # ensures that a new fleeting plugin release causes new runners to be # created, but can introduce some instance churn. #