-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperator.tf
113 lines (93 loc) · 2.22 KB
/
operator.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_namespace" "istio_operator" {
count = var.create_istio_operator_namespace ? 1 : 0
metadata {
name = var.istio_operator_namespace
labels = {
istio-injection = "disabled"
istio-operator-managed = "Reconcile"
}
}
}
resource "k8s_manifest" "operator_crd" {
content = templatefile("${path.module}/kubernetes/install.istio.io_istiooperators.yaml", {})
}
resource "kubernetes_deployment" "istio_operator" {
metadata {
name = "istio-operator"
namespace = var.istio_operator_namespace
}
spec {
replicas = 1
selector {
match_labels = {
name = "istio-operator"
}
}
template {
metadata {
labels = {
name = "istio-operator"
}
}
spec {
automount_service_account_token = true
container {
name = "istio-operator"
image = "docker.io/istio/operator:${var.istio_version}"
command = ["operator", "server"]
env {
name = "WATCH_NAMESPACE"
value = var.istio_namespace
}
env {
name = "LEADER_ELECTION_NAMESPACE"
value = var.istio_operator_namespace
}
env {
name = "POD_NAME"
value_from {
field_ref {
field_path = "metadata.name"
}
}
}
env {
name = "OPERATOR_NAME"
value = "istio"
}
resources {
limits = {
cpu = "200m"
memory = "256Mi"
}
requests = {
cpu = "50m"
memory = "128Mi"
}
}
image_pull_policy = "IfNotPresent"
}
service_account_name = kubernetes_service_account.istio_operator.metadata.0.name
}
}
}
}
resource "kubernetes_service" "istio_operator" {
metadata {
name = "istio-operator"
namespace = var.istio_operator_namespace
labels = {
name = "istio-operator"
}
}
spec {
port {
name = "http-metrics"
port = 8383
target_port = "8383"
}
selector = {
name = "istio-operator"
}
}
}