Browse Source

Merge pull request #230 from DeepikaKrishnaiah/devel

Issue #229: Updated to stable commit version of slurm exporter and added prometheus extra scrape configs for slurm exporter
Lucas A. Wilson 4 years ago
parent
commit
380407c72a

+ 4 - 0
roles/k8s_start_services/files/extraScrapeConfigs.yaml

@@ -0,0 +1,4 @@
+- job_name: Slurm-exporter-prometheus
+  static_configs:
+  - targets:
+    - localhost:8080

+ 16 - 0
roles/k8s_start_services/tasks/main.yml

@@ -99,10 +99,26 @@
     -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
     -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
   changed_when: true
   changed_when: true
   tags: init
   tags: init
+  
+- name: Copy the slurm exporter config file
+  copy:
+    src: "{{ slurm_exporter_config_file }}"
+    dest: "{{ slurm_exporter_config_file_path }}"
+    owner: root
+    group: root
+    mode: "{{ slurm_exporter_file_mode }}"
+
+- name: Add the host IP to config file
+  replace:
+    path: "{{ slurm_exporter_config_file_path }}{{ slurm_exporter_config_file }}"
+    regexp: "localhost"
+    replace: "{{ inventory_hostname }}"
+  tags: init
 
 
 - name: Prometheus deployment
 - name: Prometheus deployment
   command: >
   command: >
     helm install stable/prometheus \
     helm install stable/prometheus \
+    --set-file extraScrapeConfigs="{{ slurm_exporter_config_file_path }}{{ slurm_exporter_config_file }}" \
     --set alertmanager.persistentVolume.storageClass=nfs-client,server.persistentVolume.storageClass=nfs-client,server.service.type=LoadBalancer \
     --set alertmanager.persistentVolume.storageClass=nfs-client,server.persistentVolume.storageClass=nfs-client,server.service.type=LoadBalancer \
     --generate-name
     --generate-name
   changed_when: true
   changed_when: true

+ 6 - 0
roles/k8s_start_services/vars/main.yml

@@ -46,3 +46,9 @@ gpu_feature_discovery_version: 0.2.0
 fpga_device_plugin_yaml_url: https://raw.githubusercontent.com/Xilinx/FPGA_as_a_Service/master/k8s-fpga-device-plugin/fpga-device-plugin.yml
 fpga_device_plugin_yaml_url: https://raw.githubusercontent.com/Xilinx/FPGA_as_a_Service/master/k8s-fpga-device-plugin/fpga-device-plugin.yml
 
 
 rocm_device_plugin_yaml_url: https://raw.githubusercontent.com/RadeonOpenCompute/k8s-device-plugin/master/k8s-ds-amdgpu-dp.yaml 
 rocm_device_plugin_yaml_url: https://raw.githubusercontent.com/RadeonOpenCompute/k8s-device-plugin/master/k8s-ds-amdgpu-dp.yaml 
+
+slurm_exporter_config_file: extraScrapeConfigs.yaml
+
+slurm_exporter_config_file_path: /var/lib/
+
+slurm_exporter_file_mode: 0655

+ 1 - 1
roles/slurm_exporter/tasks/install_slurm_exporter.yml

@@ -29,7 +29,7 @@
   git:
   git:
     repo: "{{ slurm_exporter_git_repo }}"
     repo: "{{ slurm_exporter_git_repo }}"
     dest: "{{ slurm_exporter_inst_dir }}"
     dest: "{{ slurm_exporter_inst_dir }}"
-    version: "master"
+    version: "{{ stable_commit_id }}"
 
 
 - name: export GOPATH
 - name: export GOPATH
   shell: echo $GOPATH
   shell: echo $GOPATH

+ 1 - 5
roles/slurm_exporter/tasks/main.yml

@@ -21,8 +21,4 @@
 
 
 - name: Install prometheus on host
 - name: Install prometheus on host
   include_tasks: install_prometheus.yml
   include_tasks: install_prometheus.yml
-  when: "'kubernetes' in ansible_skip_tags"
-
-- name: Apply slurm exporter config to prometheus pod
-  include_tasks: configure_prometheus_pod.yml
-  tags: kubernetes
+  when: "'kubernetes' in ansible_skip_tags"

+ 1 - 0
roles/slurm_exporter/vars/main.yml

@@ -23,6 +23,7 @@ slurm_exporter_git_repo: "https://github.com/vpenso/prometheus-slurm-exporter.gi
 go_modules_path: "{{ slurm_exporter_inst_dir }}/go/modules"
 go_modules_path: "{{ slurm_exporter_inst_dir }}/go/modules"
 slurm_exporter_exec: "{{ slurm_exporter_inst_dir }}/bin/prometheus-slurm-exporter"
 slurm_exporter_exec: "{{ slurm_exporter_inst_dir }}/bin/prometheus-slurm-exporter"
 system_path: "/usr/bin"
 system_path: "/usr/bin"
+stable_commit_id: "00a7dee"
 
 
 #Usage: install_prometheus.yml
 #Usage: install_prometheus.yml
 prometheus_git_repo: "https://github.com/prometheus/prometheus/releases/download/v2.23.0/prometheus-2.23.0.linux-amd64.tar.gz"
 prometheus_git_repo: "https://github.com/prometheus/prometheus/releases/download/v2.23.0/prometheus-2.23.0.linux-amd64.tar.gz"