Skip to content

Commit

Permalink
feat(monitoring): allow disabling prometheus operator
Browse files Browse the repository at this point in the history
In some cases CRDs and the prometheus operator will already be installed by Gardener itself leading to two conflicting instances of the operator. These changes allow disabling deploying the prometheus ooperator to solve this conflict.
  • Loading branch information
vknabel committed Oct 11, 2024
1 parent 1bb6eb9 commit 995a871
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
6 changes: 4 additions & 2 deletions control-plane/roles/monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following variables can be set to configure the role:
### General

| Name | Mandatory | Description |
|-----------------------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| --------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| rethinkdb_exporter_name | yes | rethinkdb exporter image name |
| rethinkdb_exporter_tag | yes | rethinkdb exporter image tag |
| event_exporter_name | yes | event exporter image name |
Expand Down Expand Up @@ -55,11 +55,13 @@ The following variables can be set to configure the role:
| monitoring_thanos_receive_ingress_basic_auth | | Set basic authentication on the Ingress for Thanos Receive |
| monitoring_thanos_receive_ingress_dns | | The DNS name used for exposing Thanos Receive via Ingress |
| monitoring_thanos_receive_ingress_tls | | If enabled, exposes Thanos Receive through HTTPS on the Ingress |
| monitoring_prometheus_operator_crds_enabled | | If enabled, deploys CRDs for the Prometheus Operator. Consider disabling when using Gardener. |
| monitoring_prometheus_operator_enabled | | If enabled, deploys the Prometheus Operator. Consider disabling when using Gardener. |

### Gardener

| Name | Mandatory | Description |
|-------------------------------------------------|-----------|-------------------------------------------------------------|
| ----------------------------------------------- | --------- | ----------------------------------------------------------- |
| monitoring_gardener_enabled | | Enables monitoring for Gardener |
| monitoring_gardener_metrics_exporter_image_name | | gardener-metrics-exporter image name |
| monitoring_gardener_metrics_exporter_image_tag | | gardener-metrics-exporter image tag |
Expand Down
3 changes: 3 additions & 0 deletions control-plane/roles/monitoring/defaults/main/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ monitoring_additional_ingress_annotations: {}

monitoring_thanos_receive_ingress_dns: "monitoring.{{ metal_control_plane_ingress_dns }}"

monitoring_prometheus_operator_crds_enabled: true
monitoring_prometheus_operator_enabled: true

monitoring_alertmanager_ingress_enabled: true
monitoring_alertmanager_ingress_dns: "alert.{{ metal_control_plane_ingress_dns }}"
monitoring_alertmanager_ingress_tls: yes
Expand Down
12 changes: 7 additions & 5 deletions control-plane/roles/monitoring/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- name: Determine app version for prometheus operator CRDs
command: helm show chart --repo {{ prometheus_stack_repo }} --version {{ prometheus_chart_version }} kube-prometheus-stack
register: helm_output
when: monitoring_crds_enabled

- name: Apply prometheus operator CRDs
k8s:
Expand All @@ -40,6 +41,7 @@
- monitoring.coreos.com_prometheusrules.yaml
- monitoring.coreos.com_servicemonitors.yaml
- monitoring.coreos.com_thanosrulers.yaml
when: monitoring_crds_enabled

- name: Deploy kube-prometheus-stack
include_role:
Expand Down Expand Up @@ -72,11 +74,11 @@
definition: "{{ lookup('template', 'grafana-dashboards/' + item) }}"
namespace: "{{ monitoring_namespace }}"
loop:
- machine-capacity.yaml
- metal-api.yaml
- rethinkdb.yaml
- alertmanager.yaml
- sonic-exporter.yaml
- machine-capacity.yaml
- metal-api.yaml
- rethinkdb.yaml
- alertmanager.yaml
- sonic-exporter.yaml

- name: Deploy Grafana dashboards for Gardener
k8s:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
crds:
enabled: {{ monitoring_prometheus_operator_crds_enabled }}

prometheus:
ingress:
enabled: {{ monitoring_prometheus_ingress_enabled }}
Expand Down Expand Up @@ -78,6 +81,9 @@ grafana:
{% endfor %}
{% endif %}

prometheusOperator:
enabled: {{ monitoring_prometheus_operator_enabled }}

alertmanager:
ingress:
enabled: {{ monitoring_alertmanager_ingress_enabled }}
Expand Down

0 comments on commit 995a871

Please sign in to comment.