-
Notifications
You must be signed in to change notification settings - Fork 16
/
proxy.tf
149 lines (126 loc) · 3.5 KB
/
proxy.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Prometheus proxy
resource "helm_release" "prometheus_proxy" {
name = "prometheus-proxy"
namespace = kubernetes_namespace.monitoring.id
repository = "https://oauth2-proxy.github.io/manifests"
chart = "oauth2-proxy"
version = "7.1.0"
timeout = 900
values = [
templatefile("${path.module}/templates/oauth2-proxy.yaml.tpl", {
upstream = "http://prometheus-operator-kube-p-prometheus:9090"
hostname = format(
"%s.%s",
"prometheus",
var.cluster_domain_name,
)
exclude_paths = "^/-/healthy$"
issuer_url = var.oidc_issuer_url
clusterName = terraform.workspace
ingress_redirect = terraform.workspace == local.live_workspace ? true : false
live_domain_hostname = "prometheus.${local.live_domain}"
}),
]
set_sensitive {
name = "config.clientID"
value = var.oidc_components_client_id
}
set_sensitive {
name = "config.clientSecret"
value = var.oidc_components_client_secret
}
set_sensitive {
name = "config.cookieSecret"
value = random_id.session_secret.b64_std
}
depends_on = [
random_id.session_secret
]
lifecycle {
ignore_changes = [keyring]
}
}
# Alertmanager proxy
resource "helm_release" "alertmanager_proxy" {
name = "alertmanager-proxy"
namespace = "monitoring"
repository = "https://oauth2-proxy.github.io/manifests"
chart = "oauth2-proxy"
version = "7.1.0"
timeout = 900
values = [
templatefile("${path.module}/templates/oauth2-proxy.yaml.tpl", {
upstream = "http://prometheus-operator-kube-p-alertmanager:9093"
hostname = format(
"%s.%s",
"alertmanager",
var.cluster_domain_name,
)
exclude_paths = "^/-/healthy$"
issuer_url = var.oidc_issuer_url
clusterName = terraform.workspace
ingress_redirect = local.ingress_redirect
live_domain_hostname = "alertmanager.${local.live_domain}"
}),
]
set_sensitive {
name = "config.clientID"
value = var.oidc_components_client_id
}
set_sensitive {
name = "config.clientSecret"
value = var.oidc_components_client_secret
}
set_sensitive {
name = "config.cookieSecret"
value = random_id.session_secret.b64_std
}
depends_on = [
random_id.session_secret
]
lifecycle {
ignore_changes = [keyring]
}
}
# Thanos
resource "helm_release" "thanos_proxy" {
name = "thanos-proxy"
namespace = "monitoring"
repository = "https://oauth2-proxy.github.io/manifests"
chart = "oauth2-proxy"
version = "7.1.0"
timeout = 900
values = [
templatefile("${path.module}/templates/oauth2-proxy.yaml.tpl", {
upstream = "http://thanos-query-frontend:9090"
hostname = format(
"%s.%s",
"thanos",
var.cluster_domain_name,
)
exclude_paths = "^/-/healthy$"
issuer_url = var.oidc_issuer_url
clusterName = terraform.workspace
ingress_redirect = local.ingress_redirect
live_domain_hostname = "thanos.${local.live_domain}"
}),
]
set_sensitive {
name = "config.clientID"
value = var.oidc_components_client_id
}
set_sensitive {
name = "config.clientSecret"
value = var.oidc_components_client_secret
}
set_sensitive {
name = "config.cookieSecret"
value = random_id.session_secret.b64_std
}
depends_on = [
random_id.session_secret
]
lifecycle {
ignore_changes = [keyring]
}
}