From c5b0b6a8bf53142630d8e1e0bc0e50b1e16dc051 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Wed, 13 Jun 2018 11:31:05 -0500 Subject: [PATCH] Node-Exporter: Override default image entrypoint This updates the node-exporter chart to provide the mechanism for overriding the default image's entrypoint, which brings it in line with the other charts Change-Id: Ia8f6a306a6f72d7dba37e5c5736e0f5a11ad1bf0 --- .../templates/bin/_node-exporter.sh.tpl | 26 +++++++++++++++++++ .../templates/configmap-bin.yaml | 2 ++ .../templates/daemonset.yaml | 16 +++++++----- 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 prometheus-node-exporter/templates/bin/_node-exporter.sh.tpl diff --git a/prometheus-node-exporter/templates/bin/_node-exporter.sh.tpl b/prometheus-node-exporter/templates/bin/_node-exporter.sh.tpl new file mode 100644 index 000000000..8fa01df2d --- /dev/null +++ b/prometheus-node-exporter/templates/bin/_node-exporter.sh.tpl @@ -0,0 +1,26 @@ +#!/bin/sh +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -ex + +exec /bin/node_exporter \ + --collector.ntp \ + --collector.ntp.server={{ .Values.conf.ntp_server_ip }} \ + --collector.meminfo_numa \ + --collector.bonding \ + --collector.mountstats + --logtostderr diff --git a/prometheus-node-exporter/templates/configmap-bin.yaml b/prometheus-node-exporter/templates/configmap-bin.yaml index 1578a02fa..9a29bf892 100644 --- a/prometheus-node-exporter/templates/configmap-bin.yaml +++ b/prometheus-node-exporter/templates/configmap-bin.yaml @@ -22,6 +22,8 @@ kind: ConfigMap metadata: name: node-exporter-bin data: + node-exporter.sh: | +{{ tuple "bin/_node-exporter.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} image-repo-sync.sh: | {{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} {{- end }} diff --git a/prometheus-node-exporter/templates/daemonset.yaml b/prometheus-node-exporter/templates/daemonset.yaml index 7c518a48d..6244188a2 100644 --- a/prometheus-node-exporter/templates/daemonset.yaml +++ b/prometheus-node-exporter/templates/daemonset.yaml @@ -57,12 +57,8 @@ spec: - name: node-exporter {{ tuple $envAll "node_exporter" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.node_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - args: - - --collector.ntp - - --collector.ntp.server={{ .Values.conf.ntp_server_ip }} - - --collector.meminfo_numa - - --collector.bonding - - --collector.mountstats + command: + - /tmp/node-exporter.sh ports: - name: metrics containerPort: {{ tuple "node_metrics" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} @@ -74,6 +70,10 @@ spec: - name: sys mountPath: /host/sys readOnly: true + - name: node-exporter-bin + mountPath: /tmp/node-exporter.sh + subPath: node-exporter.sh + readOnly: true volumes: - name: proc hostPath: @@ -81,4 +81,8 @@ spec: - name: sys hostPath: path: /sys + - name: node-exporter-bin + configMap: + name: node-exporter-bin + defaultMode: 0555 {{- end }}