diff --git a/docs_src/tutorials/kubernetes.md b/docs_src/tutorials/kubernetes.md index e82524ee..4046fa79 100644 --- a/docs_src/tutorials/kubernetes.md +++ b/docs_src/tutorials/kubernetes.md @@ -15,11 +15,20 @@ to be installed from the source code. ### Parameters #### Service monitor parameters -| Name | Description | Value | -| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | ------------------------- | -| `serviceMonitor.enabled` | Create ServiceMonitor Resource for scraping metrics using PrometheusOperator | `false` | -| `serviceMonitor.namespace` | The namespace in which the ServiceMonitor will be created (if not set, default to namespace on which this chart is installed) | `""` | -| `serviceMonitor.interval` | The interval at which metrics should be scraped | `1m` | +| Name | Description | Value | +| ------------------------- -----| ----------------------------------------------------------------------------------------------| ------------------------- | +| `serviceMonitor.enabled` | Create ServiceMonitor Resource for scraping metrics using PrometheusOperator | `false` | +| `serviceMonitor.namespace` | The namespace in which the ServiceMonitor will be created (if not set, default to namespace on which this chart is installed) | `""` | +| `serviceMonitor.interval` | The interval at which metrics should be scraped | `1m` | +| `serviceMonitor.labels` | Extra labels for the ServiceMonitor | `{}` | +| `serviceMonitor.scrapeTimeout` | Specify the timeout after which the scrape is ended | `30s` | +| `serviceMonitor.relabelings` | Allow to add extra labels to metrics | Add node metrics | + +#### Other parameters +| Name | Description | Value | +| ------------------------------------------ | ------------------------------------------------------------------------------------------------| ------------------------- | +| `affinity` | Pod scheduling preference. Can be used for instance when some node does not support scaphandre. | `{}` | +| `tolerations` | Tolerations for pod assignment. Evaluated as a template. | `- operator: "Exists"` | ## Install Prometheus diff --git a/helm/scaphandre/Chart.yaml b/helm/scaphandre/Chart.yaml index f2d60316..9792e237 100644 --- a/helm/scaphandre/Chart.yaml +++ b/helm/scaphandre/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.1.1 description: A Helm chart for Scaphandre electrical power consumption agent home: https://github.com/hubblo-org/scaphandre name: scaphandre -version: 0.1.0 +version: 0.1.1 diff --git a/helm/scaphandre/templates/daemonset.yaml b/helm/scaphandre/templates/daemonset.yaml index f51767f4..f7cc860a 100644 --- a/helm/scaphandre/templates/daemonset.yaml +++ b/helm/scaphandre/templates/daemonset.yaml @@ -56,9 +56,14 @@ spec: runAsUser: {{ .Values.userID }} runAsGroup: {{ .Values.userGroup }} serviceAccountName: {{ template "scaphandre.name" . }} + affinity: + {{- with .Values.affinity }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} tolerations: - # Tolerate all taints for observability - - operator: "Exists" + {{- toYaml . | nindent 8 }} + {{- end }} volumes: - hostPath: path: /proc diff --git a/helm/scaphandre/templates/servicemonitor.yaml b/helm/scaphandre/templates/servicemonitor.yaml index 3d343f71..5b3132fe 100644 --- a/helm/scaphandre/templates/servicemonitor.yaml +++ b/helm/scaphandre/templates/servicemonitor.yaml @@ -9,7 +9,10 @@ metadata: namespace: {{ .Release.Namespace }} {{- end }} labels: - app.kubernetes.io/name: {{ template "scaphandre.name" . }} + {{- include "labels.common" . | nindent 4 }} + {{- if .Values.serviceMonitor.labels }} + {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} + {{- end }} spec: endpoints: - path: /metrics @@ -18,7 +21,11 @@ spec: {{- if .Values.serviceMonitor.interval }} interval: {{ .Values.serviceMonitor.interval }} {{- end }} - scrapeTimeout: 30s + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + {{- if .Values.serviceMonitor.relabelings }} + relabelings: + {{ toYaml .Values.serviceMonitor.relabelings | nindent 8 }} + {{- end }} namespaceSelector: matchNames: - {{ .Release.Namespace }} diff --git a/helm/scaphandre/values.yaml b/helm/scaphandre/values.yaml index 60f47c80..309ab501 100644 --- a/helm/scaphandre/values.yaml +++ b/helm/scaphandre/values.yaml @@ -15,7 +15,7 @@ scaphandre: command: prometheus args: {} extraArgs: - containers: + containers: null # rustBacktrace: '1' # Run as root user to get proper permissions @@ -28,3 +28,21 @@ serviceMonitor: interval: 1m # Specifies namespace, where ServiceMonitor should be installed # namespace: monitoring + + # Extra labels for the ServiceMonitor + labels: {} + + # Specify the timeout after which the scrape is ended + scrapeTimeout: 30s + + relabelings: + - action: replace + sourceLabels: + - __meta_kubernetes_pod_node_name + targetLabel: node + +affinity: {} + +tolerations: + # Tolerate all taints for observability + - operator: "Exists" \ No newline at end of file