Skip to content

Commit 240e05c

Browse files
committed
resolve conflict
2 parents c9da09e + 4f90212 commit 240e05c

File tree

3 files changed

+373
-0
lines changed

3 files changed

+373
-0
lines changed

ent_runners.tf

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
resource "kubernetes_manifest" "github_ent_runners" {
2+
for_each = { for ent in var.github_ent_runners : ent.label => ent }
3+
4+
manifest = {
5+
apiVersion = "actions.summerwind.dev/v1alpha1"
6+
kind = "RunnerDeployment"
7+
8+
metadata = {
9+
name = "${lower(each.value.label)}-runner-deployment"
10+
namespace = helm_release.release.namespace
11+
}
12+
13+
spec = {
14+
template = {
15+
spec = {
16+
enterprise = each.value.name
17+
initContainers = [
18+
{
19+
command = ["sh", "-c", "cat /home/runner/config.json > /home/runner/.docker/config.json"]
20+
image = "alpine"
21+
securityContext = {
22+
fsGroup = 1000
23+
}
24+
name = "dockerconfigwriter"
25+
volumeMounts = [
26+
{
27+
mountPath = "/home/runner/config.json"
28+
subPath = "config.json"
29+
name = "docker-secret"
30+
},
31+
{
32+
mountPath = "/home/runner/.docker"
33+
name = "docker-config-volume"
34+
},
35+
]
36+
}
37+
]
38+
serviceAccountName = var.service_account_name
39+
group = each.value.group
40+
imagePullPolicy = "IfNotPresent"
41+
securityContext = {
42+
fsGroup = 1000
43+
}
44+
labels = [each.value.label]
45+
resources = each.value.resources
46+
tolerations = each.value.tolerations
47+
affinity = each.value.affinity
48+
volumeMounts = [
49+
{
50+
mountPath = "/home/runner/config.json"
51+
subPath = "config.json"
52+
name = "docker-secret"
53+
},
54+
{
55+
mountPath = "/home/runner/.docker"
56+
name = "docker-config-volume"
57+
},
58+
]
59+
volumes = [
60+
{
61+
name = "docker-secret"
62+
secret = {
63+
secretName = "regcred"
64+
items = [
65+
{
66+
key = ".dockerconfigjson"
67+
path = "config.json"
68+
}
69+
]
70+
}
71+
},
72+
{
73+
name = "docker-config-volume"
74+
emptyDir = {}
75+
},
76+
]
77+
78+
}
79+
}
80+
}
81+
}
82+
83+
depends_on = [
84+
helm_release.release
85+
]
86+
}
87+
88+
resource "kubernetes_manifest" "github_ent_runners_horizontal_autoscaler" {
89+
for_each = { for ent in var.github_ent_runners : ent.label => ent }
90+
91+
manifest = {
92+
apiVersion = "actions.summerwind.dev/v1alpha1"
93+
kind = "HorizontalRunnerAutoscaler"
94+
95+
metadata = {
96+
name = "${lower(each.value.label)}-runner-deployment"
97+
namespace = helm_release.release.namespace
98+
}
99+
100+
spec = {
101+
minReplicas = each.value.min_replicas
102+
maxReplicas = each.value.max_replicas
103+
scaleTargetRef = {
104+
kind = "RunnerDeployment"
105+
name = "${lower(each.value.label)}-runner-deployment"
106+
}
107+
scaleUpTriggers = [
108+
{
109+
githubEvent = {
110+
workflowJob = {}
111+
}
112+
duration = each.value.scale_up_trigger_duration
113+
},
114+
]
115+
}
116+
}
117+
118+
field_manager {
119+
force_conflicts = true
120+
}
121+
122+
depends_on = [
123+
helm_release.release
124+
]
125+
}

ent_runners_dind.tf

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
resource "kubernetes_manifest" "github_ent_runners_dind" {
2+
for_each = { for ent in var.github_ent_runners_dind : ent.label => ent }
3+
4+
manifest = {
5+
apiVersion = "actions.summerwind.dev/v1alpha1"
6+
kind = "RunnerDeployment"
7+
8+
metadata = {
9+
name = "${lower(each.value.label)}-runner-deployment"
10+
namespace = helm_release.release.namespace
11+
}
12+
13+
spec = {
14+
template = {
15+
spec = {
16+
enterprise = each.value.name
17+
initContainers = [
18+
{
19+
command = ["sh", "-c", "cat /home/runner/config.json > /home/runner/.docker/config.json"]
20+
image = "alpine"
21+
securityContext = {
22+
fsGroup = 1000
23+
}
24+
name = "dockerconfigwriter"
25+
volumeMounts = [
26+
{
27+
mountPath = "/home/runner/config.json"
28+
subPath = "config.json"
29+
name = "docker-secret"
30+
},
31+
{
32+
mountPath = "/home/runner/.docker"
33+
name = "docker-config-volume"
34+
},
35+
]
36+
}
37+
]
38+
dockerdWithinRunnerContainer = true
39+
image = "summerwind/actions-runner-dind"
40+
serviceAccountName = var.service_account_name
41+
group = each.value.group
42+
imagePullPolicy = "IfNotPresent"
43+
labels = [each.value.label]
44+
resources = each.value.resources
45+
tolerations = each.value.tolerations
46+
affinity = each.value.affinity
47+
volumeMounts = [
48+
{
49+
mountPath = "/home/runner/config.json"
50+
subPath = "config.json"
51+
name = "docker-secret"
52+
},
53+
{
54+
mountPath = "/home/runner/.docker"
55+
name = "docker-config-volume"
56+
},
57+
]
58+
volumes = [
59+
{
60+
name = "docker-secret"
61+
secret = {
62+
secretName = "regcred"
63+
items = [
64+
{
65+
key = ".dockerconfigjson"
66+
path = "config.json"
67+
}
68+
]
69+
}
70+
},
71+
{
72+
name = "docker-config-volume"
73+
emptyDir = {}
74+
},
75+
]
76+
77+
}
78+
}
79+
}
80+
}
81+
82+
depends_on = [
83+
helm_release.release
84+
]
85+
}
86+
87+
resource "kubernetes_manifest" "github_ent_runners_horizontal_autoscaler_dind" {
88+
for_each = { for ent in var.github_ent_runners_dind : ent.label => ent }
89+
90+
manifest = {
91+
apiVersion = "actions.summerwind.dev/v1alpha1"
92+
kind = "HorizontalRunnerAutoscaler"
93+
94+
metadata = {
95+
name = "${lower(each.value.label)}-runner-deployment"
96+
namespace = helm_release.release.namespace
97+
}
98+
99+
spec = {
100+
minReplicas = each.value.min_replicas
101+
maxReplicas = each.value.max_replicas
102+
scaleTargetRef = {
103+
kind = "RunnerDeployment"
104+
name = "${lower(each.value.label)}-runner-deployment"
105+
}
106+
scaleUpTriggers = [
107+
{
108+
githubEvent = {
109+
workflowJob = {}
110+
}
111+
duration = each.value.scale_up_trigger_duration
112+
},
113+
]
114+
}
115+
}
116+
117+
field_manager {
118+
force_conflicts = true
119+
}
120+
121+
depends_on = [
122+
helm_release.release
123+
]
124+
}

ent_runners_dind_rootless.tf

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
resource "kubernetes_manifest" "github_ent_runners_dind_rootless" {
2+
for_each = { for ent in var.github_ent_runners_dind_rootless : ent.label => ent }
3+
4+
manifest = {
5+
apiVersion = "actions.summerwind.dev/v1alpha1"
6+
kind = "RunnerDeployment"
7+
8+
metadata = {
9+
name = "${lower(each.value.label)}-runner-deployment"
10+
namespace = helm_release.release.namespace
11+
}
12+
13+
spec = {
14+
template = {
15+
spec = {
16+
enterprise = each.value.name
17+
initContainers = [
18+
{
19+
command = ["sh", "-c", "cat /home/runner/config.json > /home/runner/.docker/config.json"]
20+
image = "alpine"
21+
securityContext = {
22+
fsGroup = 1000
23+
}
24+
name = "dockerconfigwriter"
25+
volumeMounts = [
26+
{
27+
mountPath = "/home/runner/config.json"
28+
subPath = "config.json"
29+
name = "docker-secret"
30+
},
31+
{
32+
mountPath = "/home/runner/.docker"
33+
name = "docker-config-volume"
34+
},
35+
]
36+
}
37+
]
38+
dockerdWithinRunnerContainer = true
39+
image = "summerwind/actions-runner-dind-rootless"
40+
serviceAccountName = var.service_account_name
41+
group = each.value.group
42+
imagePullPolicy = "IfNotPresent"
43+
labels = [each.value.label]
44+
resources = each.value.resources
45+
tolerations = each.value.tolerations
46+
affinity = each.value.affinity
47+
volumeMounts = [
48+
{
49+
mountPath = "/home/runner/config.json"
50+
subPath = "config.json"
51+
name = "docker-secret"
52+
},
53+
{
54+
mountPath = "/home/runner/.docker"
55+
name = "docker-config-volume"
56+
},
57+
]
58+
volumes = [
59+
{
60+
name = "docker-secret"
61+
secret = {
62+
secretName = "regcred"
63+
items = [
64+
{
65+
key = ".dockerconfigjson"
66+
path = "config.json"
67+
}
68+
]
69+
}
70+
},
71+
{
72+
name = "docker-config-volume"
73+
emptyDir = {}
74+
},
75+
]
76+
77+
}
78+
}
79+
}
80+
}
81+
82+
depends_on = [
83+
helm_release.release
84+
]
85+
}
86+
87+
resource "kubernetes_manifest" "github_ent_runners_horizontal_autoscaler_dind_rootless" {
88+
for_each = { for ent in var.github_ent_runners_dind_rootless : ent.label => ent }
89+
90+
manifest = {
91+
apiVersion = "actions.summerwind.dev/v1alpha1"
92+
kind = "HorizontalRunnerAutoscaler"
93+
94+
metadata = {
95+
name = "${lower(each.value.label)}-runner-deployment"
96+
namespace = helm_release.release.namespace
97+
}
98+
99+
spec = {
100+
minReplicas = each.value.min_replicas
101+
maxReplicas = each.value.max_replicas
102+
scaleTargetRef = {
103+
kind = "RunnerDeployment"
104+
name = "${lower(each.value.label)}-runner-deployment"
105+
}
106+
scaleUpTriggers = [
107+
{
108+
githubEvent = {
109+
workflowJob = {}
110+
}
111+
duration = each.value.scale_up_trigger_duration
112+
},
113+
]
114+
}
115+
}
116+
117+
field_manager {
118+
force_conflicts = true
119+
}
120+
121+
depends_on = [
122+
helm_release.release
123+
]
124+
}

0 commit comments

Comments
 (0)