Skip to content

Commit

Permalink
[prometheus-node-exporter] Add variable to change port for node-expor…
Browse files Browse the repository at this point in the history
…ter daemonset (#4167)

* added var for port to be used in daemonset. Added option to add host port and change name for kuberbacproxy container port

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

* changed default of hostport to false

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

* added default value for port name to values file instead of in daemonset template

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

* changed comments for new vars and changed name of var to enable hostport

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

---------

Signed-off-by: Nicole <[email protected]>
  • Loading branch information
nfrazier08 authored Jan 24, 2024
1 parent 76166d2 commit 1f70a6b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-node-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- prometheus
- exporter
type: application
version: 4.25.0
version: 4.26.0
appVersion: 1.7.0
home: https://github.com/prometheus/node_exporter/
sources:
Expand Down
7 changes: 5 additions & 2 deletions charts/prometheus-node-exporter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
{{- end }}
serviceAccountName: {{ include "prometheus-node-exporter.serviceAccountName" . }}
containers:
{{- $servicePort := ternary 8100 .Values.service.port .Values.kubeRBACProxy.enabled }}
{{- $servicePort := ternary .Values.kubeRBACProxy.port .Values.service.port .Values.kubeRBACProxy.enabled }}
- name: node-exporter
image: {{ include "prometheus-node-exporter.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand Down Expand Up @@ -200,7 +200,10 @@ spec:
{{- end }}
ports:
- containerPort: {{ .Values.service.port}}
name: "http"
name: {{ .Values.kubeRBACProxy.portName }}
{{- if .Values.kubeRBACProxy.enableHostPort }}
hostPort: {{ .Values.service.port }}
{{- end }}
- containerPort: 8888
name: "http-healthz"
readinessProbe:
Expand Down
7 changes: 7 additions & 0 deletions charts/prometheus-node-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ kubeRBACProxy:
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container
containerSecurityContext: {}

# Specify the port used for the Node exporter container (upstream port)
port: 8100
# Specify the name of the container port
portName: http
# Configure a hostPort. If true, hostPort will be enabled in the container and set to service.port.
enableHostPort: false

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand Down

0 comments on commit 1f70a6b

Please sign in to comment.