k8s: Fix node-exporter manifest

When writing the node-exporter manifest, make sure that
the directory exists.

Change-Id: I41be5c09890bd2c9a063d4942f03305ff690ec4b
Closes-Bug: #1716697
changes/65/503565/1
Spyros Trigazis 5 years ago
parent 1fbb3a1b6c
commit fe6286e76f
  1. 7
      magnum/drivers/common/templates/kubernetes/fragments/enable-node-exporter.sh

@ -7,7 +7,11 @@ if [ "$(echo $PROMETHEUS_MONITORING | tr '[:upper:]' '[:lower:]')" = "false" ];
fi
# Write node-exporter manifest as a regular pod
cat > /etc/kubernetes/manifests/node-exporter.yaml << EOF
node_exporter_file=/etc/kubernetes/manifests/node-exporter.yaml
[ -f ${node_exporter_file} ] || {
echo "Writing File: $node_exporter_file"
mkdir -p $(dirname ${node_exporter_file})
cat << EOF > ${node_exporter_file}
apiVersion: v1
kind: Pod
metadata:
@ -25,3 +29,4 @@ spec:
- containerPort: 9100
hostPort: 9100
EOF
}

Loading…
Cancel
Save