Skip to content

Commit

Permalink
build: Add service monitor defintion (if stack_deploy_metrics, deafiu…
Browse files Browse the repository at this point in the history
…lt 'yes')
  • Loading branch information
Alan Christie committed May 20, 2024
1 parent e719073 commit 5e419e7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions roles/fragalysis-stack/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ stack_logging_framework_root_level: INFO
# Wait for the neo4j graph to become ready before starting the stack?
stack_wait_for_graph: yes

# Metrics?
stack_deploy_metrics: yes

# ISPyB/SSH variables ---------------------------------------------------------
# These are set from vars/sensitive.vault
# and are defined here for clarity.
Expand Down
6 changes: 6 additions & 0 deletions roles/fragalysis-stack/tasks/deploy-stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@
- service-stack
- ingress-stack

- name: Deploy Metrics
k8s:
definition: "{{ lookup('template', 'servicemonitor-stack.yaml.j2') }}"
wait: yes
when: stack_deploy_metrics|bool

- name: Deploy beat
k8s:
definition: "{{ lookup('template', 'deployment-beat.yaml.j2') }}"
Expand Down
20 changes: 20 additions & 0 deletions roles/fragalysis-stack/templates/servicemonitor-stack.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
kind: ServiceMonitor
apiVersion: monitoring.coreos.com/v1
metadata:
name: fragalysis-stack
namespace: {{ stack_namespace }}
spec:
# A selector for the Public API Service.
# The service to be scraped.
selector:
matchLabels:
name: stack
namespaceSelector:
matchNames:
- {{ stack_namespace }}
# The endpoint (port name)
# and the scraping interval
endpoints:
- port: http
interval: 60s

0 comments on commit 5e419e7

Please sign in to comment.