Skip to content

Commit

Permalink
[prometheus-ipmi-exporter] Add ipmi-exporter chart (prometheus-commun…
Browse files Browse the repository at this point in the history
…ity#3740)

* add ipmi-exporter

Signed-off-by: Aleksey Sviridkin <[email protected]>

* switch to "official" image

Signed-off-by: Aleksey Sviridkin <[email protected]>

* add maintainer, keywords and home link

Signed-off-by: Aleksey Sviridkin <[email protected]>

* Update CODEOWNERS

Signed-off-by: MH <[email protected]>

* fix linting

Signed-off-by: Aleksey Sviridkin <[email protected]>

* Update charts/prometheus-ipmi-exporter/templates/deployment.yaml

Signed-off-by: MH <[email protected]>

---------

Signed-off-by: Aleksey Sviridkin <[email protected]>
Signed-off-by: MH <[email protected]>
Co-authored-by: MH <[email protected]>
  • Loading branch information
2 people authored and Matiasmct committed Mar 20, 2024
1 parent 70e214b commit d0fa89f
Show file tree
Hide file tree
Showing 10 changed files with 426 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/charts/prometheus-druid-exporter/ @iamabhishek-dubey @sandy724
/charts/prometheus-elasticsearch-exporter/ @desaintmartin @svenmueller @zeritti
/charts/prometheus-fastly-exporter/ @arslanbekov
/charts/prometheus-ipmi-exporter/ @lexfrei
/charts/prometheus-json-exporter/ @schmiddim @xiu @zanhsieh
/charts/prometheus-kafka-exporter/ @gkarthiks @golgoth31 @zeritti
/charts/prometheus-modbus-exporter/ @openenergyprojects
Expand Down
23 changes: 23 additions & 0 deletions charts/prometheus-ipmi-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
20 changes: 20 additions & 0 deletions charts/prometheus-ipmi-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: prometheus-ipmi-exporter
description: This is an IPMI exporter for Prometheus.

type: application

version: 0.1.0

appVersion: "1.6.1"

keywords:
- metrics
- ipmi
- monitoring

home: https://github.com/prometheus-community/ipmi_exporter

maintainers:
- name: lexfrei
email: [email protected]
22 changes: 22 additions & 0 deletions charts/prometheus-ipmi-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Thank you for installing prometheus-ipmi-exporter!

Your release is named: {{ .Release.Name }}

To view the IPMI Exporter service within your cluster, you can run:

kubectl get svc {{ .Release.Name }}-ipmi-exporter-service

{{- if .Values.serviceMonitor.enabled }}
ServiceMonitor has been installed. Make sure you've installed Prometheus Operator in your cluster and then verify that the target is up in your Prometheus instance.
{{- else }}
Note: ServiceMonitor is disabled. If you want to enable monitoring through Prometheus Operator, please set `serviceMonitor.enabled` to `true` in the values.yaml file or via --set flag.
{{- end }}

{{- if .Values.resources }}
Resource requests and limits are set as follows:

CPU Requests: {{ .Values.resources.requests.cpu }}
Memory Requests: {{ .Values.resources.requests.memory }}
CPU Limits: {{ .Values.resources.limits.cpu }}
Memory Limits: {{ .Values.resources.limits.memory }}
{{- end }}
85 changes: 85 additions & 0 deletions charts/prometheus-ipmi-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "prometheus-ipmi-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "prometheus-ipmi-exporter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "prometheus-ipmi-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "prometheus-ipmi-exporter.labels" -}}
helm.sh/chart: {{ include "prometheus-ipmi-exporter.chart" . }}
{{ include "prometheus-ipmi-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "prometheus-ipmi-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "prometheus-ipmi-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "prometheus-ipmi-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{- default (include "prometheus-ipmi-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{- default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for rbac.
*/}}
{{- define "rbac.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }}
{{- print "rbac.authorization.k8s.io/v1" -}}
{{- else -}}
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/*
Determine secret name, can either be the self-created of an existing one
*/}}
{{- define "prometheus-ipmi-exporter.secretName" -}}
{{- if .Values.existingSecret.name -}}
{{- .Values.existingSecret.name -}}
{{- else -}}
{{ include "prometheus-ipmi-exporter.fullname" . }}
{{- end -}}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/prometheus-ipmi-exporter/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if not .Values.configMapFile -}}
{{- $fullName := include "prometheus-ipmi-exporter.fullname" . -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $fullName }}
labels:
{{- include "prometheus-ipmi-exporter.labels" . | nindent 4 }}
data:
config.yml: |
modules:
{{- toYaml .Values.modules | nindent 6 }}
{{- end }}
62 changes: 62 additions & 0 deletions charts/prometheus-ipmi-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "prometheus-ipmi-exporter.fullname" . }}
labels:
{{- include "prometheus-ipmi-exporter.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "prometheus-ipmi-exporter.selectorLabels" . | nindent 6 }}
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
{{- include "prometheus-ipmi-exporter.selectorLabels" . | nindent 8 }}
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: ipmi-exporter
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "--config.file"
- "/config.yml"
volumeMounts:
- name: config-volume
mountPath: /config.yml
subPath: config.yml
readOnly: true
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
resources:
limits:
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
volumes:
- name: config-volume
configMap:
name: {{ template "prometheus-ipmi-exporter.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/prometheus-ipmi-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "prometheus-ipmi-exporter.fullname" . }}
labels:
{{- include "prometheus-ipmi-exporter.labels" . | nindent 4 }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "prometheus-ipmi-exporter.selectorLabels" . | nindent 4 }}
44 changes: 44 additions & 0 deletions charts/prometheus-ipmi-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if $.Values.serviceMonitor }}
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.serviceMonitor.enabled ) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.serviceMonitor.labels }}
labels:
{{ toYaml .Values.serviceMonitor.labels | indent 4}}
{{- end }}
name: {{ template "prometheus-ipmi-exporter.fullname" . }}
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
spec:
endpoints:
- targetPort: {{ .Values.service.port }}
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.telemetryPath }}
path: {{ .Values.serviceMonitor.telemetryPath }}
{{- end }}
{{- if .Values.serviceMonitor.timeout }}
scrapeTimeout: {{ .Values.serviceMonitor.timeout }}
{{- end }}
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ toYaml .Values.serviceMonitor.metricRelabelings | indent 4 }}
{{- end }}
jobLabel: {{ template "prometheus-ipmi-exporter.fullname" . }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "prometheus-ipmi-exporter.selectorLabels" . | nindent 6 }}
{{- if .Values.serviceMonitor.targetLabels }}
targetLabels:
{{- range .Values.serviceMonitor.targetLabels }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit d0fa89f

Please sign in to comment.