k8s: Fix node-exporter manifest

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

Change-Id: I41be5c09890bd2c9a063d4942f03305ff690ec4b
Closes-Bug: #1716697
This commit is contained in:
Spyros Trigazis 2017-09-13 08:53:32 +00:00
parent 1fbb3a1b6c
commit fe6286e76f
1 changed files with 6 additions and 1 deletions

View File

@ -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
}