@@ -6,30 +6,67 @@ locals {
66 enabled = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].enabled
77 chart = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].chart
88 repository = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].repository
9- chart_version = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].version
9+ chart_version = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].chart_version
1010 namespace = local.helm_releases[index(local.helm_releases.*.id, "teamcity")].namespace
1111 }
12- teamcity_domain_name = "teamcity-${local.domain_suffix}"
13- }
14-
15- data "template_file" "teamcity" {
16- count = local.teamcity.enabled ? 1 : 0
17-
18- template = file("${path.module}/templates/teamcity-values.yaml")
19- vars = {
20- domain_name = local.teamcity_domain_name
21- storage_class_name = kubernetes_storage_class.teamcity.id
22- service_account_name = module.eks_rbac_teamcity.service_account_name
23- }
24- }
25-
26- data "template_file" "teamcity_agent" {
27- count = local.teamcity.enabled ? 1 : 0
28-
29- template = file("${path.module}/templates/teamcity-agent-pod-template.yaml")
30- vars = {
31- service_account_name = module.eks_rbac_teamcity.service_account_name
32- }
12+ teamcity_domain_name = "teamcity-${local.domain_suffix}"
13+ teamcity_values = <<VALUES
14+ serviceAccountName: ${module.eks_rbac_teamcity.service_account_name}
15+ ingress:
16+ enabled: true
17+ annotations:
18+ kubernetes.io/ingress.class: nginx
19+ nginx.ingress.kubernetes.io/proxy-body-size: 2000m
20+ nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
21+ path: /
22+ hosts:
23+ - ${local.teamcity_domain_name}
24+
25+ server:
26+ replicaCount: 1
27+ persistence:
28+ type: pvc
29+ enabled: true
30+ storageClassName: advanced
31+ accessModes:
32+ - ReadWriteOnce
33+ size: 50Gi
34+ affinity:
35+ nodeAffinity:
36+ requiredDuringSchedulingIgnoredDuringExecution:
37+ nodeSelectorTerms:
38+ - matchExpressions:
39+ - key: eks.amazonaws.com/capacityType
40+ operator: In
41+ values:
42+ - ON_DEMAND
43+ VALUES
44+ teamcity_agent_template = <<VALUES
45+ apiVersion: v1
46+ kind: Pod
47+ metadata:
48+ name: teamcity-agent
49+ namespace: teamcity-agent
50+ spec:
51+ containers:
52+ - name: teamcity-agent
53+ image: halfb00t/teamcity-agent:2020.1.2
54+ imagePullPolicy: IfNotPresent
55+ env:
56+ - name: DOCKER_IN_DOCKER
57+ value: "start"
58+ resources: {}
59+ serviceAccountName: ${module.eks_rbac_teamcity.service_account_name}
60+ nodeSelector:
61+ nodegroup: spot
62+ tolerations:
63+ - key: "nodegroup"
64+ operator: "Equal"
65+ value: "ci"
66+ effect: "NoSchedule"
67+ securityContext:
68+ privileged: true
69+ VALUES
3370}
3471
3572module "eks_rbac_teamcity" {
@@ -89,7 +126,7 @@ resource "helm_release" "teamcity" {
89126 max_history = var.helm_release_history_size
90127
91128 values = [
92- data.template_file.teamcity[count.index].rendered
129+ local.teamcity_values
93130 ]
94131}
95132
@@ -103,5 +140,5 @@ output "teamcity_service_account_name" {
103140}
104141
105142output "teamcity_agent_pod_template" {
106- value = local.teamcity.enabled ? data.template_file.teamcity_agent.rendered : null
143+ value = local.teamcity.enabled ? local.teamcity_agent_template : null
107144}
0 commit comments