Skip to content

Commit 9c68757

Browse files
committed
Add app.kubernetes.io/name Label & Remove Vendor
The 'vendor=crunchydata' label has been removed from all PostgreSQL Operator Monitoring resources. This ensures that PostgreSQL Operator Monitoring resources are not inadvertently deleted when uninstalling the PostgreSQL Operator, specifically in scenarios where the same namespace utilized to deploy the PostgreSQL Operator Monitoring infrastructure is also utilized to deploy PostgreSQL clusters. Additionally, all resources created by the PostgreSQL Operator Monitoring installer now have the following label: app.kubernetes.io/name=postgres-operator-monitoring This new label allows all PostgreSQL Operator Monitoring resources within a Kubernetes cluster to be easily identified, and is also a recommended label for Kubernetes resources per the Kubernetes documentation. It should be noted that this label is already being applied to any installation resources created by Helm (however, this commit does change "metrics" to "monitoring" in the Chart name, and therefore this label, for all PostgreSQL Operator Monitoring Helm installation resources). Also removes the "Disabling Default Dashboards" section from the PostgreSQL Operator documentation since the 'grafana_dashboards' installation setting this section references no longer exists (Grafana dashboards are now customized solely via ConfigMaps). Issue: [ch9190] Issue: [ch9216]
1 parent 66bb84d commit 9c68757

21 files changed

+58
-49
lines changed

docs/content/installation/metrics/metrics-configuration.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,6 @@ and tag as needed to use the RedHat certified containers:
116116
Additionally, these same settings can be utilized as needed to support custom image names,
117117
tags, and additional container registries.
118118

119-
## Disabling Default Dashboards
120-
121-
By default, the following Grafana Dashboards are enabled as provided by the [pgmonitor project](https://github.com/CrunchyData/pgmonitor):
122-
123-
- Bloat_Details.json
124-
- CRUD_Details.json
125-
- PGBackrest.json
126-
- PG_Details.json
127-
- PG_Overview.json
128-
- TableSize_Details.json
129-
130-
Using the `grafana-dashboard` configuration setting, it is possible to customize this list
131-
of dashboards, and therefore further control which dashboards are loaded into Grafana
132-
(specifically via the `grafana-dashboards` ConfigMap) by default. For instance, the following
133-
setting can be utilized to enable only a subset of the default dashboards defined above:
134-
135-
```yaml
136-
grafana_dashboards:
137-
- CRUD_Details.json
138-
- PG_Details.json
139-
- PG_Overview.json
140-
```
141-
142119
## Helm Only Configuration Settings
143120

144121
When using Helm, the following settings can be defined to control the image prefix and image tag

installers/metrics/ansible/roles/pgo-metrics/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
app_name: postgres-operator-monitoring
3+
24
kubernetes_context: ""
35
kubernetes_in_cluster: "false"
46
openshift_host: ""

installers/metrics/ansible/roles/pgo-metrics/tasks/alertmanager.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
shell: |
2929
{{ kubectl_or_oc }} create configmap {{ alertmanager_configmap }} --dry-run --output=yaml \ \
3030
--from-file={{ alertmanager_output_dir }}/alertmanager.yml \
31-
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml vendor=crunchydata \
31+
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml \
32+
app.kubernetes.io/name={{ app_name }} \
3233
| {{ kubectl_or_oc }} create --filename=- -n {{ metrics_namespace }}
3334
when: alertmanager_custom_config == ""
3435
register: create_alertmanager_result
@@ -45,7 +46,8 @@
4546
shell: |
4647
{{ kubectl_or_oc }} create configmap {{ alertmanager_rules_configmap }} --dry-run --output=yaml \
4748
--from-file={{ alertmanager_output_dir }}/crunchy-alert-rules-pg.yml \
48-
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml vendor=crunchydata \
49+
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml \
50+
app.kubernetes.io/name={{ app_name }} \
4951
| {{ kubectl_or_oc }} create --filename=- -n {{ metrics_namespace }}
5052
when: alertmanager_custom_rules_config == ""
5153
register: create_alertmanager_result

installers/metrics/ansible/roles/pgo-metrics/tasks/grafana.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
shell: |
7373
{{ kubectl_or_oc }} create configmap {{ grafana_datasources_configmap }} --dry-run --output=yaml \
7474
--from-file={{ grafana_output_dir }}/crunchy_grafana_datasource.yml \
75-
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml vendor=crunchydata \
75+
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml \
76+
app.kubernetes.io/name={{ app_name }} \
7677
| {{ kubectl_or_oc }} create --filename=- -n {{ metrics_namespace }}
7778
when: grafana_datasources_custom_config == ""
7879
register: create_grafana_datasources_result
@@ -86,7 +87,8 @@
8687
--from-file={{ grafana_output_dir }}/crunchy_grafana_dashboards.yml \
8788
--from-file={{ pgmonitor_grafana_dir }}/containers/ \
8889
| sed -e 's,${DS_PROMETHEUS},PROMETHEUS,' \
89-
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml vendor=crunchydata \
90+
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml \
91+
app.kubernetes.io/name={{ app_name }} \
9092
| {{ kubectl_or_oc }} create --filename=- -n {{ metrics_namespace }}
9193
when: grafana_dashboards_custom_config == ""
9294
register: create_grafana_dashboards_result

installers/metrics/ansible/roles/pgo-metrics/tasks/prometheus.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
shell: |
7070
{{ kubectl_or_oc }} create configmap crunchy-prometheus --dry-run --output=yaml \
7171
--from-file={{ prom_output_dir }}/prometheus.yml \
72-
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml vendor=crunchydata \
72+
| {{ kubectl_or_oc }} label --filename=- --local --dry-run --output=yaml \
73+
app.kubernetes.io/name={{ app_name }} \
7374
| {{ kubectl_or_oc }} create --filename=- -n {{ metrics_namespace }}
7475
when: prometheus_custom_config == ""
7576
register: create_prometheus_datasources_result

installers/metrics/ansible/roles/pgo-metrics/templates/alertmanager-deployment.json.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
"metadata": {
55
"name": "crunchy-alertmanager",
66
"labels": {
7-
"vendor": "crunchydata"
7+
"app.kubernetes.io/name": "{{ app_name }}"
88
}
99
},
1010
"spec": {
1111
"replicas": 1,
1212
"selector": {
1313
"matchLabels": {
1414
"name": "{{ alertmanager_service_name }}",
15-
"vendor": "crunchydata"
15+
"app.kubernetes.io/name": "{{ app_name }}"
1616
}
1717
},
1818
"template": {
1919
"metadata": {
2020
"labels": {
2121
"name": "{{ alertmanager_service_name }}",
22-
"vendor": "crunchydata"
22+
"app.kubernetes.io/name": "{{ app_name }}"
2323
}
2424
},
2525
"spec": {

installers/metrics/ansible/roles/pgo-metrics/templates/alertmanager-pvc.json.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"metadata": {
55
"name": "alertmanagerdata",
66
"labels": {
7-
"vendor": "crunchydata"
7+
"app.kubernetes.io/name": "{{ app_name }}"
88
}
99
},
1010
"spec": {

installers/metrics/ansible/roles/pgo-metrics/templates/alertmanager-rbac.json.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"metadata": {
55
"name": "alertmanager",
66
"labels": {
7-
"vendor": "crunchydata"
7+
"app.kubernetes.io/name": "{{ app_name }}"
88
}
99
},
1010
"automountServiceAccountToken": false,

installers/metrics/ansible/roles/pgo-metrics/templates/alertmanager-service.json.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "{{ alertmanager_service_name }}",
66
"labels": {
77
"name": "{{ alertmanager_service_name }}",
8-
"vendor": "crunchydata"
8+
"app.kubernetes.io/name": "{{ app_name }}"
99
}
1010
},
1111
"spec": {

installers/metrics/ansible/roles/pgo-metrics/templates/grafana-deployment.json.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
"metadata": {
55
"name": "crunchy-grafana",
66
"labels": {
7-
"vendor": "crunchydata"
7+
"app.kubernetes.io/name": "{{ app_name }}"
88
}
99
},
1010
"spec": {
1111
"replicas": 1,
1212
"selector": {
1313
"matchLabels": {
1414
"name": "{{ grafana_service_name }}",
15-
"vendor": "crunchydata"
15+
"app.kubernetes.io/name": "{{ app_name }}"
1616
}
1717
},
1818
"template": {
1919
"metadata": {
2020
"labels": {
2121
"name": "{{ grafana_service_name }}",
22-
"vendor": "crunchydata"
22+
"app.kubernetes.io/name": "{{ app_name }}"
2323
}
2424
},
2525
"spec": {

0 commit comments

Comments
 (0)