Skip to content

Commit 73f27dc

Browse files
authored
Update Helm Chart for v3 (#195)
Update the Helm chart for the next major version of the Script Exporter.
1 parent 4312581 commit 73f27dc

File tree

5 files changed

+53
-50
lines changed

5 files changed

+53
-50
lines changed

.github/workflows/continuous-delivery.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ jobs:
136136
with:
137137
fetch-depth: 0
138138

139+
- name: Lint
140+
run: |
141+
helm lint ./charts/script-exporter
142+
143+
- name: Template
144+
run: |
145+
helm template ./charts/script-exporter
146+
139147
- name: Set Version
140148
id: version
141149
run: |

charts/script-exporter/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ description:
55
Prometheus exporter to execute scripts and collect metrics from the output or
66
the exit status.
77
type: application
8-
version: 2.0.3
9-
appVersion: v2.24.3
8+
version: 3.0.0
9+
appVersion: v3.0.0

charts/script-exporter/templates/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
labels:
66
{{- include "script-exporter.labels" . | nindent 4 }}
77
data:
8-
config.yaml: |
8+
scripts.yaml: |
99
{{ tpl .Values.config . | indent 4 }}
1010

1111
{{- with .Values.scripts }}

charts/script-exporter/templates/deployment.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ spec:
3737
env:
3838
{{- toYaml . | nindent 12 }}
3939
{{- end }}
40+
{{- with .Values.args }}
4041
args:
41-
- -config.file={{ .Values.configFile | default "/etc/script-exporter/config.yaml" }}
42+
{{- toYaml . | nindent 12 }}
43+
{{- end }}
4244
ports:
4345
- name: http
4446
containerPort: 9469
@@ -55,7 +57,7 @@ spec:
5557
{{- toYaml .Values.resources | nindent 12 }}
5658
volumeMounts:
5759
- name: config
58-
mountPath: /etc/script-exporter
60+
mountPath: /script_exporter/scripts
5961
readOnly: true
6062
{{- if .Values.volumeMounts }}
6163
{{- toYaml .Values.volumeMounts | nindent 12 }}

charts/script-exporter/values.yaml

Lines changed: 38 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Default values for script_exporter.
1+
# Default values for Script Exporter.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

@@ -10,34 +10,32 @@ fullnameOverride: ""
1010
##
1111
replicaCount: 1
1212

13-
## Specify a list of image pull secrets, to avoid the DockerHub rate limit or to pull the script_exporter image from a
13+
## Specify a list of image pull secrets, to avoid the DockerHub rate limit or to pull the Script Exporter image from a
1414
## private registry.
1515
## See: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
1616
##
1717
imagePullSecrets: []
1818

19-
## Set the image which should be used for script_exporter.
19+
## Set the image which should be used for Script Exporter.
2020
##
2121
image:
2222
repository: ghcr.io/ricoberger/script_exporter
2323
pullPolicy: IfNotPresent
2424
# Overrides the image tag whose default is the chart appVersion.
2525
tag: ""
2626

27-
## Specify security settings for the created Pods. To set the security settings for the script_exporter Container use
27+
## Specify security settings for the created Pods. To set the security settings for the Script Exporter Container use
2828
## the corresponding "securityContext" field.
2929
## See: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
3030
##
31-
podSecurityContext:
32-
{}
31+
podSecurityContext: {}
3332
# fsGroup: 2000
3433

35-
## Specify security settings for the script_exporter Container. They override settings made at the Pod level via the
34+
## Specify security settings for the Script Exporter Container. They override settings made at the Pod level via the
3635
## "podSecurityContext" when there is overlap.
3736
## See: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container
3837
##
39-
securityContext:
40-
{}
38+
securityContext: {}
4139
# capabilities:
4240
# drop:
4341
# - ALL
@@ -50,8 +48,7 @@ securityContext:
5048
## specify resources, uncomment the following lines, adjust them as necessary, and remove the curly braces after
5149
## 'resources:'.
5250
##
53-
resources:
54-
{}
51+
resources: {}
5552
# limits:
5653
# cpu: 100m
5754
# memory: 128Mi
@@ -64,50 +61,51 @@ resources:
6461
##
6562
nodeSelector: {}
6663

67-
## Specify the tolerations for the script_exporter Pods.
64+
## Specify the tolerations for the Script Exporter Pods.
6865
## See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
6966
##
7067
tolerations: []
7168

72-
## Specify a node affinity or inter-pod affinity / anti-affinity for an advanced scheduling of the script_exporter Pods.
69+
## Specify a node affinity or inter-pod affinity / anti-affinity for an advanced scheduling of the Script Exporter Pods.
7370
## See: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
7471
##
7572
affinity: {}
7673

7774
## Topology spread constraints rely on node labels to identify the topology domain(s) that each Node is in.
7875
## See: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
7976
##
80-
topologySpreadConstraints:
81-
[]
77+
topologySpreadConstraints: []
8278
# - maxSkew: 1
8379
# topologyKey: topology.kubernetes.io/zone
8480
# whenUnsatisfiable: DoNotSchedule
8581
# labelSelector:
8682
# matchLabels:
8783
# app.kubernetes.io/name=hub
8884

89-
## Specify additional volumes for the script_exporter deployment.
85+
## Specify additional volumes for the Script Exporter deployment.
9086
## See: https://kubernetes.io/docs/concepts/storage/volumes/
9187
##
92-
volumes:
93-
[]
88+
volumes: []
9489
# - name: scripts
9590
# configMap:
9691
# name: scripts
9792

98-
## Specify additional volumeMounts for the script_exporter container.
93+
## Specify additional volumeMounts for the Script Exporter container.
9994
## See: https://kubernetes.io/docs/concepts/storage/volumes/
10095
##
101-
volumeMounts:
102-
[]
96+
volumeMounts: []
10397
# - name: scripts
104-
# mountPath: /scripts
98+
# mountPath: /script_exporter/scripts
10599
# readOnly: true
106100

107-
## Specify additional environment variables for the script_exporter container.
101+
## Specify additional arguments for the Script Exporter container.
108102
##
109-
env:
110-
[]
103+
args:
104+
- --config.files=/script_exporter/scripts/scripts.yaml
105+
106+
## Specify additional environment variables for the Script Exporter container.
107+
##
108+
env: []
111109
# - name: MY_ENV_VAR
112110
# value: MY_ENV_VALUE
113111

@@ -168,17 +166,15 @@ serviceMonitor:
168166

169167
## MetricRelabelConfigs to apply to samples before ingestion.
170168
##
171-
metricRelabelings:
172-
[]
169+
metricRelabelings: []
173170
# - action: keep
174171
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
175172
# sourceLabels: [__name__]
176173

177174
## RelabelConfigs to apply to samples before scraping. Prometheus Operator automatically adds relabelings for a few
178175
## standard Kubernetes fields and replaces original scrape job name with __tmp_prometheus_job_name.
179176
##
180-
relabelings:
181-
[]
177+
relabelings: []
182178
# - sourceLabels: [__meta_kubernetes_pod_node_name]
183179
# separator: ;
184180
# regex: ^(.*)$
@@ -192,8 +188,7 @@ serviceMonitor:
192188
autoCreate:
193189
enabled: true
194190

195-
targets:
196-
[]
191+
targets: []
197192
# - name: example # Human readable URL that will appear in Prometheus / AlertManager
198193
# script: ping # Name of the script to target.
199194
# labels: {} # Map of labels for ServiceMonitor. Overrides value set in `defaults`
@@ -234,40 +229,38 @@ selfServiceMonitor:
234229

235230
## MetricRelabelConfigs to apply to samples before ingestion.
236231
##
237-
metricRelabelings:
238-
[]
232+
metricRelabelings: []
239233
# - action: keep
240234
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
241235
# sourceLabels: [__name__]
242236

243237
## RelabelConfigs to apply to samples before scraping. Prometheus Operator automatically adds relabelings for a few
244238
## standard Kubernetes fields and replaces original scrape job name with __tmp_prometheus_job_name.
245239
##
246-
relabelings:
247-
[]
240+
relabelings: []
248241
# - sourceLabels: [__meta_kubernetes_pod_node_name]
249242
# separator: ;
250243
# regex: ^(.*)$
251244
# targetLabel: nodename
252245
# replacement: $1
253246
# action: replace
254247

255-
## The configuration file path for the script_exporter. It defaults to "/etc/script-exporter/config.yaml".
256-
configFile: ""
257-
258-
## The configuration for the script_exporter as shown in
248+
## The configuration for the Script Exporter as shown in
259249
## https://github.com/ricoberger/script_exporter/tree/main#usage-and-configuration
260250
##
261251
config: |
262252
scripts:
263-
- name: ping
264-
command: /etc/script-exporter/ping.sh
253+
- name: example
254+
command:
255+
- /script_exporter/scripts/example.sh
265256
266257
## A list of scripts which should be added to the container. It is also possible to add some scripts to the container,
267258
## via the "volumes" and "volumeMounts" values.
268259
##
269260
scripts:
270-
ping.sh: |
271-
#!/bin/bash
272-
ping -c 3 $1 > /dev/null 2>&1
273-
exit $?
261+
example.sh: |
262+
#!/usr/bin/env bash
263+
264+
echo '# HELP custom_metric A custom metric exported by the script'
265+
echo '# TYPE custom_metric gauge'
266+
echo 'custom_metric{script="example"} 1'

0 commit comments

Comments
 (0)