forked from StatCan/terraform-kubernetes-istio-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.tf
113 lines (96 loc) · 2.38 KB
/
app.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
resource "kubernetes_service" "istio_operator_service" {
metadata {
name = "istio-operator"
labels = {
name = "istio-operator"
}
namespace = var.namespace
}
spec {
selector = {
name = "istio-operator"
}
port {
name = "http-metrics"
port = 8383
target_port = 8383
}
}
}
resource "kubernetes_deployment" "istio_operator_controller" {
metadata {
name = "istio-operator"
namespace = var.namespace
}
spec {
replicas = 1
selector {
match_labels = {
name = "istio-operator"
}
}
template {
metadata {
labels = {
name = "istio-operator"
}
}
spec {
service_account_name = kubernetes_service_account.istio_operator_service_account.metadata[0].name
container {
name = "istio-operator"
image = "${var.hub}/operator:${var.tag}"
image_pull_policy = "IfNotPresent"
command = ["operator", "server"]
security_context {
allow_privilege_escalation = false
capabilities {
drop = ["ALL"]
}
privileged = false
read_only_root_filesystem = true
run_as_group = 1337
run_as_user = 1337
run_as_non_root = true
}
resources {
limits = var.resources.limits
requests = var.resources.requests
}
env {
name = "WATCH_NAMESPACE"
value = join(",", var.watch_namespaces)
}
env {
name = "LEADER_ELECTION_NAMESPACE"
value_from {
field_ref {
field_path = "metadata.namespace"
}
}
}
env {
name = "POD_NAME"
value_from {
field_ref {
field_path = "metadata.name"
}
}
}
env {
name = "OPERATOR_NAME"
value = "istio-operator"
}
env {
name = "WAIT_FOR_RESOURCES_TIMEOUT"
value = "${floor(var.wait_for_resources_timeout)}s"
}
env {
name = "REVISION"
value = ""
}
}
}
}
}
}