-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
103 lines (79 loc) · 2.64 KB
/
main.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
resource "kubernetes_namespace" "kuberhealthy" {
metadata {
name = "kuberhealthy"
labels = {
"name" = "kuberhealthy"
"component" = "kuberhealthy"
"cloud-platform.justice.gov.uk/is-production" = "true"
"cloud-platform.justice.gov.uk/environment-name" = "production"
"pod-security.kubernetes.io/enforce" = "privileged"
}
annotations = {
"cloud-platform.justice.gov.uk/application" = "Kuberhealthy"
"cloud-platform.justice.gov.uk/business-unit" = "Platforms"
"cloud-platform.justice.gov.uk/owner" = "Cloud Platform: [email protected]"
"cloud-platform.justice.gov.uk/source-code" = "https://github.com/ministryofjustice/cloud-platform-infrastructure"
"cloud-platform.justice.gov.uk/slack-channel" = "cloud-platform"
"cloud-platform-out-of-hours-alert" = "true"
}
}
}
resource "helm_release" "kuberhealthy" {
name = "kuberhealthy"
namespace = kubernetes_namespace.kuberhealthy.id
repository = "https://kuberhealthy.github.io/kuberhealthy/helm-repos/"
chart = "kuberhealthy"
version = "104"
set {
name = "prometheus.enabled"
value = "true"
}
set {
name = "prometheus.serviceMonitor.enabled"
value = "true"
}
set {
name = "prometheus.prometheusRule.enabled"
value = "false"
}
set {
name = "check.daemonset.extraEnvs.DAEMONSET_PRIORITY_CLASS_NAME"
value = "cluster-critical"
}
set {
name = "check.deployment.extraEnvs.CHECK_DEPLOYMENT_REPLICAS"
value = "2"
}
set {
name = "checkReaper.logLevel"
value = "debug"
}
lifecycle {
ignore_changes = [keyring]
}
}
resource "kubectl_manifest" "namespacecheck_rule_alert_crb" {
yaml_body = file("${path.module}/resources/cluster-role-binding.yaml")
wait = true
depends_on = [helm_release.kuberhealthy]
}
resource "kubectl_manifest" "namespacecheck_rule_alert_cr" {
yaml_body = file("${path.module}/resources/cluster-role.yaml")
wait = true
depends_on = [helm_release.kuberhealthy]
}
resource "kubectl_manifest" "namespacecheck_rule_alert_sa" {
yaml_body = file("${path.module}/resources/serviceaccount.yaml")
wait = true
depends_on = [
helm_release.kuberhealthy,
kubectl_manifest.namespacecheck_rule_alert_crb
]
}
resource "kubectl_manifest" "namespace_check" {
wait = true
yaml_body = templatefile("${path.module}/templates/namespace-check.yaml.tmpl", {
cluster_env = var.cluster_env
})
depends_on = [helm_release.kuberhealthy, kubectl_manifest.namespacecheck_rule_alert_sa]
}