From cbe08eb53dca65469abd2a23f276206c35d2df65 Mon Sep 17 00:00:00 2001 From: Jason Kincl Date: Mon, 30 Oct 2023 11:58:57 -0400 Subject: [PATCH] Adding service monitor scraping for slurm --- slurm/manifests/kustomization.yaml | 1 + slurm/manifests/namespace.yaml | 4 ++- slurm/manifests/service.yaml | 7 ++--- slurm/manifests/servicemonitor.yaml | 42 +++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 slurm/manifests/servicemonitor.yaml diff --git a/slurm/manifests/kustomization.yaml b/slurm/manifests/kustomization.yaml index d83f087..c633e30 100644 --- a/slurm/manifests/kustomization.yaml +++ b/slurm/manifests/kustomization.yaml @@ -11,6 +11,7 @@ resources: - serviceaccount.yaml - clusterrolebinding.yaml - claim.yaml + - servicemonitor.yaml configMapGenerator: - name: slurm-conf diff --git a/slurm/manifests/namespace.yaml b/slurm/manifests/namespace.yaml index e8a5ec6..d4bbd52 100644 --- a/slurm/manifests/namespace.yaml +++ b/slurm/manifests/namespace.yaml @@ -1,4 +1,6 @@ apiVersion: v1 kind: Namespace metadata: - name: slurm-system \ No newline at end of file + name: slurm-system + labels: + openshift.io/cluster-monitoring: 'true' \ No newline at end of file diff --git a/slurm/manifests/service.yaml b/slurm/manifests/service.yaml index d38733f..9a75d09 100644 --- a/slurm/manifests/service.yaml +++ b/slurm/manifests/service.yaml @@ -8,8 +8,9 @@ spec: ports: - port: 6817 name: slurmctld - - port: 6818 - name: slurmd + - port: 8080 + name: scrape clusterIP: None selector: - app: slurm \ No newline at end of file + app: slurm + component: head \ No newline at end of file diff --git a/slurm/manifests/servicemonitor.yaml b/slurm/manifests/servicemonitor.yaml new file mode 100644 index 0000000..ed6ddb6 --- /dev/null +++ b/slurm/manifests/servicemonitor.yaml @@ -0,0 +1,42 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: slurm +spec: + endpoints: + - interval: 30s + port: scrape + scheme: http + selector: + matchLabels: + app: slurm + component: head +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: prometheus-k8s +subjects: + - kind: ServiceAccount + name: prometheus-k8s + namespace: openshift-monitoring +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: prometheus-k8s +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: prometheus-k8s +rules: + - verbs: + - get + - list + - watch + apiGroups: + - '' + resources: + - services + - endpoints + - pods