Skip to content

Commit

Permalink
support external prometheus stack
Browse files Browse the repository at this point in the history
Signed-off-by: zhu733756 <talonzhu@yunify.com>
  • Loading branch information
zhu733756 committed Jun 16, 2021
1 parent 08eec60 commit 8c5ec23
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 42 deletions.
1 change: 1 addition & 0 deletions deploy/cluster-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
openldapVolumeSize: 2Gi # openldap PVC size.
redisVolumSize: 2Gi # Redis PVC size.
monitoring:
# type: external # Whether to specify the external prometheus stack, and need to modify the endpoint at the next line.
endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 # Prometheus endpoint to get metrics data.
es: # Storage backend for logging, events and auditing.
# elasticsearchMasterReplicas: 1 # The total number of master nodes. Even numbers are not allowed.
Expand Down
45 changes: 3 additions & 42 deletions roles/ks-monitor/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,6 @@
---
- import_tasks: cleanup.yaml

- import_tasks: generate_manifests.yaml

- import_tasks: prometheus-operator.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: node-exporter.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: kube-state-metrics.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

# - import_tasks: prometheus-adapter.yaml

- import_tasks: grafana.yaml
- import_tasks: prometheus-stack.yaml
when:
- monitoring.grafana is defined
- monitoring.grafana.enabled is defined
- monitoring.grafana.enabled == true

- import_tasks: prometheus.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: devops.yaml

- import_tasks: etcd.yaml

- import_tasks: prometheus-rules.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: alertmanager.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: notification-manager.yaml
- "common.monitoring.type is not defined or common.monitoring.type != 'external'"

- import_tasks: monitoring-dashboard.yaml
when:
Expand All @@ -63,4 +24,4 @@
when:
- alerting is defined
- alerting.enabled is defined
- alerting.enabled == true
- alerting.enabled == true
46 changes: 46 additions & 0 deletions roles/ks-monitor/tasks/prometheus-stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
- import_tasks: cleanup.yaml

- import_tasks: generate_manifests.yaml

- import_tasks: prometheus-operator.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: node-exporter.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: kube-state-metrics.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

# - import_tasks: prometheus-adapter.yaml

- import_tasks: grafana.yaml
when:
- monitoring.grafana is defined
- monitoring.grafana.enabled is defined
- monitoring.grafana.enabled == true

- import_tasks: prometheus.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: devops.yaml

- import_tasks: etcd.yaml

- import_tasks: prometheus-rules.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: alertmanager.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

- import_tasks: notification-manager.yaml

- import_tasks: monitoring-dashboard.yaml
when:
- "status.monitoring is not defined or status.monitoring.status is not defined or status.monitoring.status != 'enabled'"

0 comments on commit 8c5ec23

Please sign in to comment.