Skip to content

Commit f2938b9

Browse files
author
Valentin Khramtsov
committed
Prepare ns dev for deploy with github runner
1 parent bfb50d2 commit f2938b9

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
locals {
2+
dev_namespace = {
3+
namespace = local.namespaces[index(local.namespaces.*.id, "dev")].id
4+
enabled = local.namespaces[index(local.namespaces.*.id, "dev")].enabled
5+
}
6+
}
7+
8+
module "dev_namespace" {
9+
count = local.dev_namespace.enabled ? 1 : 0
10+
11+
source = "../eks-kubernetes-namespace"
12+
name = local.dev_namespace.namespace
13+
network_policies = []
14+
15+
depends_on = [helm_release.gha_runner_scale_set]
16+
}
17+
resource "kubectl_manifest" "github_runner_role_binding" {
18+
count = local.dev_namespace.enabled && local.gha_runner_scale_set_controller.enabled ? 1 : 0
19+
20+
yaml_body = <<EOF
21+
apiVersion: rbac.authorization.k8s.io/v1
22+
kind: RoleBinding
23+
metadata:
24+
name: github-runner-role-binding
25+
namespace: ${local.dev_namespace.namespace}
26+
roleRef:
27+
apiGroup: rbac.authorization.k8s.io
28+
kind: ClusterRole
29+
name: cluster-admin
30+
subjects:
31+
- kind: ServiceAccount
32+
name: gha-runner-scale-set-gha-rs-no-permission
33+
namespace: ${module.gha_runner_scale_set_controller_namespace[0].name}
34+
EOF
35+
36+
depends_on = [module.dev_namespace]
37+
}
38+

terraform/modules/k8s-addons/locals.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ locals {
1616
ssl_certificate_arn = var.ssl_certificate_arn
1717

1818
helm_releases = yamldecode(file("${path.module}/helm-releases.yaml"))["releases"]
19+
namespaces = yamldecode(file("${path.module}/namespaces.yaml"))["namespaces"]
1920
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespaces:
2+
- id: dev
3+
enabled: true

0 commit comments

Comments
 (0)