From 2094725e595722a25865314e88c4f5b11fea2e9e Mon Sep 17 00:00:00 2001 From: Sheogorath <sheogorath@shivering-isles.com> Date: Wed, 2 Feb 2022 01:24:33 +0100 Subject: [PATCH] feat(longhorn): Add monitoring to longhorn This patch adds a service monitor for longhorn --- infrastructure/longhorn/kustomization.yaml | 1 + infrastructure/longhorn/networkpolicy.yaml | 10 ++++++++++ infrastructure/longhorn/servicemonitor.yaml | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 infrastructure/longhorn/servicemonitor.yaml diff --git a/infrastructure/longhorn/kustomization.yaml b/infrastructure/longhorn/kustomization.yaml index 533357391..de19fb8c5 100644 --- a/infrastructure/longhorn/kustomization.yaml +++ b/infrastructure/longhorn/kustomization.yaml @@ -11,6 +11,7 @@ resources: - https://git.shivering-isles.com/github-mirror/longhorn/longhorn/-/raw/v1.2.3/examples/network-policy/backing-image-manager-network-policy.yaml - https://git.shivering-isles.com/github-mirror/longhorn/longhorn/-/raw/v1.2.3/examples/network-policy/backing-image-data-source-network-policy.yaml - ../../shared/networkpolicies/allow-from-ingress.yaml + - ../../shared/networkpolicies/allow-from-monitoring.yaml patchesStrategicMerge: - networkpolicy.yaml diff --git a/infrastructure/longhorn/networkpolicy.yaml b/infrastructure/longhorn/networkpolicy.yaml index 027c4072d..58efb3fad 100644 --- a/infrastructure/longhorn/networkpolicy.yaml +++ b/infrastructure/longhorn/networkpolicy.yaml @@ -1,3 +1,4 @@ +--- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: @@ -6,3 +7,12 @@ spec: podSelector: matchLabels: app: longhorn-ui +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: allow-from-monitoring +spec: + podSelector: + matchLabels: + app: longhorn-manager diff --git a/infrastructure/longhorn/servicemonitor.yaml b/infrastructure/longhorn/servicemonitor.yaml new file mode 100644 index 000000000..88cb3b696 --- /dev/null +++ b/infrastructure/longhorn/servicemonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: longhorn-prometheus-servicemonitor + namespace: longhorn-system + labels: + name: longhorn-prometheus-servicemonitor +spec: + selector: + matchLabels: + app: longhorn-manager + namespaceSelector: + matchNames: + - longhorn-system + endpoints: + - port: manager -- GitLab