This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.tf
124 lines (100 loc) · 2.7 KB
/
server.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
resource "kubernetes_config_map" "preconfigure_server" {
metadata {
name = var.gocd_name
namespace = kubernetes_namespace.namespace.id
labels = {
app = var.gocd_name
component = "server"
}
}
data = {
"preconfigure_server.sh" = data.template_file.preconfigure_server.rendered
}
}
module "gocd_server" {
source = "terraform-iaac/deployment/kubernetes"
version = "1.0.8"
strategy_update = "Recreate"
name = "${var.gocd_name}-server"
namespace = kubernetes_namespace.namespace.id
image = "${var.gocd_server_image}:${var.gocd_image_tag}"
custom_labels = {
app = var.gocd_name
component = "server"
}
env = var.gocd_server_env
internal_port = var.gocd_server_ports
service_account_name = var.server_service_account_name
service_account_token = true
security_context = var.gocd_security_context
readiness_probe = var.gocd_server_probe
liveness_probe = var.gocd_server_probe
lifecycle_events = var.gocd_server_lifecycle_events
tty = false
node_selector = var.gocd_server_node_selector
resources = var.resources
volume_mount = [
{
mount_path = "/preconfigure_server.sh"
volume_name = local.gocd-config-vol
sub_path = "preconfigure_server.sh"
},
{
mount_path = "/godata"
volume_name = local.gocd-data-vol
sub_path = "gocd/godata"
},
{
mount_path = "/home/go"
volume_name = local.gocd-data-vol
sub_path = "gocd/homego"
},
{
mount_path = "/docker-entrypoint.d"
volume_name = local.gocd-data-vol
sub_path = "gocd/scripts"
}
]
volume_nfs = [
{
path_on_nfs = var.path_on_nfs
nfs_endpoint = var.nfs_endpoint
volume_name = local.gocd-data-vol
}
]
volume_config_map = [
{
mode = "0420"
name = kubernetes_config_map.preconfigure_server.metadata[0].name
volume_name = local.gocd-config-vol
}
]
}
module "service" {
source = "terraform-iaac/service/kubernetes"
version = "1.0.0"
app_name = "${var.gocd_name}-server"
app_namespace = kubernetes_namespace.namespace.id
port_mapping = var.gocd_server_ports
type = "NodePort"
custom_labels = {
app = var.gocd_name
component = "server"
}
}
module "ingress" {
source = "terraform-iaac/ingress/kubernetes"
version = "1.0.2"
app_name = "${var.gocd_name}-server"
app_namespace = kubernetes_namespace.namespace.id
domain_name = var.domain
web_internal_port = [
{
sub_domain = "gocd."
internal_port = var.gocd_server_ports[0].internal_port
}
]
tls = var.tls
tls_hosts = var.tls_hosts
annotations = var.ingress_annotations
}