-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboards.tf
118 lines (112 loc) · 3.76 KB
/
dashboards.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
resource "kubectl_manifest" "flux_gitrepository" {
count = var.enable_dashboards ? 1 : 0
yaml_body = <<YAML
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
name: ${var.flux_gitrepository_name}
namespace: flux-system
spec:
interval: 5m0s
url: ${var.flux_gitrepository_url}
ref:
tag: ${var.flux_gitrepository_branch}
YAML
depends_on = [module.external_secrets]
}
resource "kubectl_manifest" "flux_kustomization" {
yaml_body = <<YAML
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: ${var.flux_kustomization_name}
namespace: flux-system
spec:
interval: 1m0s
path: ${var.flux_kustomization_path}
prune: true
sourceRef:
kind: GitRepository
name: ${var.flux_gitrepository_name}
postBuild:
substitute:
AMG_AWS_REGION: ${var.managed_prometheus_workspace_region}
AMP_ENDPOINT_URL: ${var.managed_prometheus_workspace_endpoint}
AMG_ENDPOINT_URL: ${var.grafana_url}
GRAFANA_CLUSTER_DASH_URL: ${var.grafana_cluster_dashboard_url}
GRAFANA_KUBELET_DASH_URL: ${var.grafana_kubelet_dashboard_url}
GRAFANA_NSWRKLDS_DASH_URL: ${var.grafana_namespace_workloads_dashboard_url}
GRAFANA_NODEEXP_DASH_URL: ${var.grafana_node_exporter_dashboard_url}
GRAFANA_NODES_DASH_URL: ${var.grafana_nodes_dashboard_url}
GRAFANA_WORKLOADS_DASH_URL: ${var.grafana_workloads_dashboard_url}
YAML
count = var.enable_dashboards ? 1 : 0
depends_on = [module.external_secrets]
}
# api server dashboards
resource "kubectl_manifest" "api_server_dashboards" {
yaml_body = <<YAML
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: ${local.apiserver_monitoring_config.flux_kustomization_name}
namespace: flux-system
spec:
interval: 1m0s
path: ${local.apiserver_monitoring_config.flux_kustomization_path}
prune: true
sourceRef:
kind: GitRepository
name: ${local.apiserver_monitoring_config.flux_gitrepository_name}
postBuild:
substitute:
GRAFANA_APISERVER_BASIC_DASH_URL: ${local.apiserver_monitoring_config.dashboards.basic}
GRAFANA_APISERVER_ADVANCED_DASH_URL: ${local.apiserver_monitoring_config.dashboards.advanced}
GRAFANA_APISERVER_TROUBLESHOOTING_DASH_URL: ${local.apiserver_monitoring_config.dashboards.troubleshooting}
YAML
count = var.enable_apiserver_monitoring ? 1 : 0
depends_on = [module.external_secrets]
}
# adot health dashboards
resource "kubectl_manifest" "adothealth_monitoring_dashboards" {
yaml_body = <<YAML
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: ${local.adothealth_monitoring_config.flux_kustomization_name}
namespace: flux-system
spec:
interval: 1m0s
path: ${local.adothealth_monitoring_config.flux_kustomization_path}
prune: true
sourceRef:
kind: GitRepository
name: ${local.adothealth_monitoring_config.flux_gitrepository_name}
postBuild:
substitute:
GRAFANA_ADOTHEALTH_DASH_URL: ${local.adothealth_monitoring_config.dashboards.health}
YAML
count = var.enable_adotcollector_metrics ? 1 : 0
depends_on = [module.external_secrets]
}
resource "kubectl_manifest" "kubeproxy_monitoring_dashboard" {
yaml_body = <<YAML
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: ${local.kubeproxy_monitoring_config.flux_kustomization_name}
namespace: flux-system
spec:
interval: 1m0s
path: ${local.kubeproxy_monitoring_config.flux_kustomization_path}
prune: true
sourceRef:
kind: GitRepository
name: ${local.kubeproxy_monitoring_config.flux_gitrepository_name}
postBuild:
substitute:
GRAFANA_KUBEPROXY_DASH_URL: ${local.kubeproxy_monitoring_config.dashboards.default}
YAML
count = var.enable_dashboards ? 1 : 0
depends_on = [module.external_secrets]
}