Skip to content

Commit

Permalink
OCPBUGS-13153: Limit the value of GOMAXPROCS on node-exporter.
Browse files Browse the repository at this point in the history
xxxxx

Signed-off-by: Ayoub Mrini <amrini@redhat.com>
  • Loading branch information
machine424 committed Jun 12, 2023
1 parent 076da3b commit 23c315a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/node-exporter/daemonset.yaml
Expand Up @@ -41,6 +41,7 @@ spec:
- --collector.cpu.info
- --collector.textfile.directory=/var/node_exporter/textfile
- --no-collector.btrfs
command: ["/bin/bash", "/entryponit"]
image: quay.io/prometheus/node-exporter:v1.5.0
name: node-exporter
resources:
Expand All @@ -61,6 +62,9 @@ spec:
- mountPath: /var/node_exporter/textfile
name: node-exporter-textfile
readOnly: true
- mountPath: /entryponit
name: node-exporter-entrypoint
readOnly: true
workingDir: /var/node_exporter/textfile
- args:
- --logtostderr
Expand Down Expand Up @@ -164,6 +168,9 @@ spec:
- name: node-exporter-kube-rbac-proxy-config
secret:
secretName: node-exporter-kube-rbac-proxy-config
- configMap:
name: node-exporter-entrypoint
name: node-exporter-entrypoint
updateStrategy:
rollingUpdate:
maxUnavailable: 10%
Expand Down
20 changes: 20 additions & 0 deletions assets/node-exporter/entrypoint.yaml
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: node-exporter-entrypoint
namespace: openshift-monitoring
data:
entrypoint: |
export GOMAXPROCS=4
# no affinity even when cpusets is set as requests is not integer
NUM_CPUS=$(grep -c '^processor' "/proc/cpuinfo" 2>/dev/null || echo "0")
if [ "$NUM_CPUS" -lt "$GOMAXPROCS" ]; then
export GOMAXPROCS="$NUM_CPUS"
fi
echo "Set GOMAXPROCS=$GOMAXPROCS"
# TODO: maybe get /bin/node_exporter somewhere? envvar?
exec /bin/node_exporter "$@"

0 comments on commit 23c315a

Please sign in to comment.