Skip to content

Commit 2088982

Browse files
authored
Upstream EKS/ARC amd64 Support (cloudposse/terraform-aws-components#609)
1 parent bc527c0 commit 2088982

File tree

7 files changed

+77
-30
lines changed

7 files changed

+77
-30
lines changed

src/README.md

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,55 +20,78 @@ The default catalog values `e.g. stacks/catalog/eks/actions-runner-controller.ya
2020
components:
2121
terraform:
2222
eks/actions-runner-controller:
23-
settings:
24-
spacelift:
25-
workspace_enabled: true
2623
vars:
2724
enabled: true
2825
name: "actions-runner" # avoids hitting name length limit on IAM role
2926
chart: "actions-runner-controller"
3027
chart_repository: "https://actions-runner-controller.github.io/actions-runner-controller"
31-
chart_version: "0.21.0"
28+
chart_version: "0.22.0"
3229
kubernetes_namespace: "actions-runner-system"
3330
create_namespace: true
31+
kubeconfig_exec_auth_api_version: "client.authentication.k8s.io/v1beta1"
32+
# helm_manifest_experiment_enabled feature causes inconsistent final plans with charts that have CRDs
33+
# see https://github.com/hashicorp/terraform-provider-helm/issues/711#issuecomment-836192991
34+
helm_manifest_experiment_enabled: false
35+
36+
ssm_github_secret_path: "/github_runners/controller_github_app_secret"
37+
github_app_id: "REPLACE_ME_GH_APP_ID"
38+
github_app_installation_id: "REPLACE_ME_GH_INSTALLATION_ID"
39+
40+
# ssm_github_webhook_secret_token_path: "/github_runners/github_webhook_secret_token"
41+
webhook:
42+
enabled: false
43+
hostname_template: "gha-webhook.%[3]v.%[2]v.%[1]v.acme.com"
44+
45+
eks_component_name: "eks/cluster"
3446
resources:
3547
limits:
36-
cpu: 100m
37-
memory: 128Mi
48+
cpu: 500m
49+
memory: 256Mi
3850
requests:
39-
cpu: 100m
51+
cpu: 250m
4052
memory: 128Mi
41-
ssm_github_token_path: "/github_runners/controller_github_app_secret"
42-
ssm_github_webhook_secret_token_path: "/github_runners/controller_github_app_secret"
43-
github_app_id: "123456"
44-
github_app_installation_id: "234567890"
45-
webhook:
46-
enabled: true
47-
# gha-webhook.use1.auto.core.acme.net
48-
hostname_template: "gha-webhook.%[3]v.%[2]v.%[1]v.acme.net"
49-
timeout: 120
5053
runners:
51-
infrastructure-runner:
54+
infra-runner:
55+
node_selector:
56+
kubernetes.io/os: "linux"
57+
kubernetes.io/arch: "arm64"
58+
tolerations:
59+
- key: "kubernetes.io/arch"
60+
operator: "Equal"
61+
value: "arm64"
62+
effect: "NoSchedule"
5263
type: "repository" # can be either 'organization' or 'repository'
5364
dind_enabled: false # If `true`, a Docker sidecar container will be deployed
54-
# To run Docker in Docker (dind), change image from summerwind/actions-runner to summerwind/actions-runner-dind
55-
image: summerwind/actions-runner
56-
scope: "acme/infrastructure"
57-
scale_down_delay_seconds: 300
65+
# To run Docker in Docker (dind), change image to summerwind/actions-runner-dind
66+
# If not running Docker, change image to summerwind/actions-runner use a smaller image
67+
image: summerwind/actions-runner-dind
68+
# `scope` is org name for Organization runners, repo name for Repository runners
69+
scope: "org/infra"
5870
min_replicas: 1
59-
max_replicas: 5
71+
max_replicas: 20
72+
scale_down_delay_seconds: 100
6073
resources:
6174
limits:
6275
cpu: 200m
63-
memory: 256Mi
76+
memory: 512Mi
6477
requests:
6578
cpu: 100m
6679
memory: 128Mi
6780
webhook_driven_scaling_enabled: true
81+
webhook_startup_timeout: "2m"
6882
pull_driven_scaling_enabled: false
6983
labels:
84+
- "Linux"
85+
- "linux"
7086
- "Ubuntu"
71-
- "self-hosted"
87+
- "ubuntu"
88+
- "X64"
89+
- "x64"
90+
- "x86_64"
91+
- "amd64"
92+
- "AMD64"
93+
- "core-auto"
94+
- "common"
7295
```
7396
7497
### Generating Required Secrets
@@ -266,7 +289,7 @@ Consult [actions-runner-controller](https://github.com/actions-runner-controller
266289
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
267290
| <a name="input_region"></a> [region](#input\_region) | AWS Region. | `string` | n/a | yes |
268291
| <a name="input_resources"></a> [resources](#input\_resources) | The cpu and memory of the deployment's limits and requests. | <pre>object({<br> limits = object({<br> cpu = string<br> memory = string<br> })<br> requests = object({<br> cpu = string<br> memory = string<br> })<br> })</pre> | n/a | yes |
269-
| <a name="input_runners"></a> [runners](#input\_runners) | Map of Action Runner configurations, with the key being the name of the runner. Please note that the name must be in<br>kebab-case.<br><br>For example:<pre>hcl<br>organization_runner = {<br> type = "organization" # can be either 'organization' or 'repository'<br> dind_enabled: false # A Docker sidecar container will be deployed<br> image: summerwind/actions-runner # If dind_enabled=true, set this to 'summerwind/actions-runner-dind'<br> scope = "ACME" # org name for Organization runners, repo name for Repository runners<br> scale_down_delay_seconds = 300<br> min_replicas = 1<br> max_replicas = 5<br> busy_metrics = {<br> scale_up_threshold = 0.75<br> scale_down_threshold = 0.25<br> scale_up_factor = 2<br> scale_down_factor = 0.5<br> }<br> labels = [<br> "Ubuntu",<br> "core-automation",<br> ]<br>}</pre> | <pre>map(object({<br> type = string<br> scope = string<br> image = optional(string, "")<br> dind_enabled = bool<br> scale_down_delay_seconds = number<br> min_replicas = number<br> max_replicas = number<br> busy_metrics = optional(object({<br> scale_up_threshold = string<br> scale_down_threshold = string<br> scale_up_adjustment = optional(string)<br> scale_down_adjustment = optional(string)<br> scale_up_factor = optional(string)<br> scale_down_factor = optional(string)<br> }))<br> webhook_driven_scaling_enabled = bool<br> webhook_startup_timeout = optional(string, null)<br> pull_driven_scaling_enabled = bool<br> labels = list(string)<br> storage = optional(string, null)<br> pvc_enabled = optional(string, false)<br> resources = object({<br> limits = object({<br> cpu = string<br> memory = string<br> ephemeral_storage = optional(string, null)<br> })<br> requests = object({<br> cpu = string<br> memory = string<br> })<br> })<br> }))</pre> | n/a | yes |
292+
| <a name="input_runners"></a> [runners](#input\_runners) | Map of Action Runner configurations, with the key being the name of the runner. Please note that the name must be in<br>kebab-case.<br><br>For example:<pre>hcl<br>organization_runner = {<br> type = "organization" # can be either 'organization' or 'repository'<br> dind_enabled: false # A Docker sidecar container will be deployed<br> image: summerwind/actions-runner # If dind_enabled=true, set this to 'summerwind/actions-runner-dind'<br> scope = "ACME" # org name for Organization runners, repo name for Repository runners<br> scale_down_delay_seconds = 300<br> min_replicas = 1<br> max_replicas = 5<br> busy_metrics = {<br> scale_up_threshold = 0.75<br> scale_down_threshold = 0.25<br> scale_up_factor = 2<br> scale_down_factor = 0.5<br> }<br> labels = [<br> "Ubuntu",<br> "core-automation",<br> ]<br>}</pre> | <pre>map(object({<br> type = string<br> scope = string<br> image = optional(string, "")<br> dind_enabled = bool<br> node_selector = optional(map(string), {})<br> tolerations = optional(list(object({<br> key = string<br> operator = string<br> value = string<br> effect = string<br> })), [])<br> scale_down_delay_seconds = number<br> min_replicas = number<br> max_replicas = number<br> busy_metrics = optional(object({<br> scale_up_threshold = string<br> scale_down_threshold = string<br> scale_up_adjustment = optional(string)<br> scale_down_adjustment = optional(string)<br> scale_up_factor = optional(string)<br> scale_down_factor = optional(string)<br> }))<br> webhook_driven_scaling_enabled = bool<br> webhook_startup_timeout = optional(string, null)<br> pull_driven_scaling_enabled = bool<br> labels = list(string)<br> storage = optional(string, null)<br> pvc_enabled = optional(string, false)<br> resources = object({<br> limits = object({<br> cpu = string<br> memory = string<br> ephemeral_storage = optional(string, null)<br> })<br> requests = object({<br> cpu = string<br> memory = string<br> })<br> })<br> }))</pre> | n/a | yes |
270293
| <a name="input_s3_bucket_arns"></a> [s3\_bucket\_arns](#input\_s3\_bucket\_arns) | List of ARNs of S3 Buckets to which the runners will have read-write access to. | `list(string)` | `[]` | no |
271294
| <a name="input_ssm_github_secret_path"></a> [ssm\_github\_secret\_path](#input\_ssm\_github\_secret\_path) | The path in SSM to the GitHub app private key file contents or GitHub PAT token. | `string` | `""` | no |
272295
| <a name="input_ssm_github_webhook_secret_token_path"></a> [ssm\_github\_webhook\_secret\_token\_path](#input\_ssm\_github\_webhook\_secret\_token\_path) | The path in SSM to the GitHub Webhook Secret token. | `string` | `""` | no |

src/charts/actions-runner/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: 0.1.1
1919

2020
# This chart only deploys Resources for actions-runner-controller, so app version does not really apply.
2121
# We use Resource API version instead.

src/charts/actions-runner/templates/runnerdeployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ spec:
5858
{{- range .Values.labels }}
5959
- {{ . | quote }}
6060
{{- end }}
61+
{{- if gt ( len (index .Values "node_selector") ) 0 }}
62+
nodeSelector:
63+
{{- toYaml .Values.node_selector | nindent 8 }}
64+
{{- end }}
65+
{{- if gt ( len (index .Values "tolerations") ) 0 }}
66+
tolerations:
67+
{{- toYaml .Values.tolerations | nindent 8 }}
68+
{{- end }}
6169
# dockerdWithinRunnerContainer = false means access to a Docker daemon is provided by a sidecar container.
6270
dockerdWithinRunnerContainer: {{ .Values.dind_enabled }}
6371
image: {{ .Values.image | quote }}

src/charts/actions-runner/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ type: "repository" # can be either 'organization' or 'repository'
22
dind_enabled: true # If `true`, a Docker sidecar container will be deployed
33
# To run Docker in Docker (dind), change image from summerwind/actions-runner to summerwind/actions-runner-dind
44
image: summerwind/actions-runner-dind
5+
node_selector:
6+
kubernetes.io/os: "linux"
7+
kubernetes.io/arch: "amd64"
58
scope: "example/app"
69
scale_down_delay_seconds: 300
710
min_replicas: 1

src/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ module "actions_runner" {
219219
webhook_startup_timeout = coalesce(each.value.webhook_startup_timeout, "${each.value.scale_down_delay_seconds}s") # if webhook_startup_timeout isnt defined, use scale_down_delay_seconds
220220
pull_driven_scaling_enabled = each.value.pull_driven_scaling_enabled
221221
pvc_enabled = each.value.pvc_enabled
222+
node_selector = each.value.node_selector
223+
tolerations = each.value.tolerations
222224
}),
223225
local.busy_metrics_filtered[each.key] == null ? "" : yamlencode(local.busy_metrics_filtered[each.key]),
224226
])

src/resources/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ githubWebhookServer:
3333
kubernetes.io/ingress.class: alb
3434
podDisruptionBudget:
3535
maxUnavailable: "60%"
36+
37+
nodeSelector:
38+
kubernetes.io/os: "linux"
39+
kubernetes.io/arch: "amd64"

src/variables.tf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,17 @@ variable "runners" {
162162
EOT
163163

164164
type = map(object({
165-
type = string
166-
scope = string
167-
image = optional(string, "")
168-
dind_enabled = bool
165+
type = string
166+
scope = string
167+
image = optional(string, "")
168+
dind_enabled = bool
169+
node_selector = optional(map(string), {})
170+
tolerations = optional(list(object({
171+
key = string
172+
operator = string
173+
value = string
174+
effect = string
175+
})), [])
169176
scale_down_delay_seconds = number
170177
min_replicas = number
171178
max_replicas = number

0 commit comments

Comments
 (0)