kube-prometheus: Upgrade to grafana v5

This commit is contained in:
Frederic Branczyk
2018-02-07 10:09:41 +01:00
parent ba5192bcaf
commit 85f88025f3
24 changed files with 7510 additions and 7682 deletions

View File

@@ -70,7 +70,7 @@ DATE_EXEC="$(date "+%Y-%m-%d-%H%M%S")"
BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TOOL_HOME="$(dirname $BIN_DIR)"
SCRIPT_BASE=`basename $0 | sed "s/\.[Ss][Hh]//"`
CONFIGMAP_DASHBOARD_PREFIX="grafana-dashboards"
CONFIGMAP_DASHBOARD_PREFIX="grafana-dashboard-definitions"
TEMPLATES_DIR="$TOOL_HOME/templates"
DASHBOARD_HEADER_FILE="$TEMPLATES_DIR/dashboard.header"
@@ -327,7 +327,10 @@ initialize-bin-pack
bin-pack-files "$(find $DASHBOARDS_DIR -maxdepth 1 -type f -name "*-dashboard.json" | sort)"
# Continue processing datasources (maintaining the same queue)
bin-pack-files "$(find $DASHBOARDS_DIR -maxdepth 1 -type f -name "*-datasource.json" | sort )"
#
# Commented out, as datasources are provisionable by Grafana by default in Grafana v5, but from a separate directory, meaning a separate ConfigMap for us.
#
# bin-pack-files "$(find $DASHBOARDS_DIR -maxdepth 1 -type f -name "*-datasource.json" | sort )"
# Processing remaining data in the queue (or unique)
if [ "$to_process" ]; then
@@ -361,7 +364,7 @@ for (( i=0; i<$total_configmaps_created; i++ )); do
configmap="$CONFIGMAP_DASHBOARD_PREFIX-$i"
echo "# Preparing grafana deployment to support configmap: $configmap"
test "$VOLUME_MOUNTS" && VOLUME_MOUNTS="$VOLUME_MOUNTS\n- name: $configmap\n mountPath: /var/$configmap" || VOLUME_MOUNTS="- name: $configmap\n mountPath: /var/$configmap"
test "$VOLUME_MOUNTS" && VOLUME_MOUNTS="$VOLUME_MOUNTS\n- name: $configmap\n mountPath: /grafana-dashboard-definitions/$i" || VOLUME_MOUNTS="- name: $configmap\n mountPath: /grafana-dashboard-definitions/$i"
test "$VOLUMES" && VOLUMES="$VOLUMES\n- name: $configmap\n configMap:\n name: $configmap" || VOLUMES="- name: $configmap\n configMap:\n name: $configmap"
test "$WATCH_DIR" && WATCH_DIR="$WATCH_DIR\n- '--watch-dir=/var/$configmap'" || WATCH_DIR="- '--watch-dir=/var/$configmap'"
# echo "DEBUG:"

View File

@@ -1,5 +1,5 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboards
name: grafana-dashboard-definitions
data:

View File

@@ -1,11 +0,0 @@
,
"inputs": [
{
"name": "DS_PROMETHEUS",
"pluginId": "prometheus",
"type": "datasource",
"value": "prometheus"
}
],
"overwrite": true
}

View File

@@ -14,25 +14,15 @@ spec:
runAsUser: 65534
containers:
- name: grafana
image: quay.io/coreos/monitoring-grafana:4.6.3-non-root.1
env:
- name: GF_AUTH_BASIC_ENABLED
value: "true"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_SECURITY_ADMIN_USER
valueFrom:
secretKeyRef:
name: grafana-credentials
key: user
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: grafana-credentials
key: password
image: quay.io/coreos/monitoring-grafana:5.0.0-beta1
volumeMounts:
- name: grafana-storage
mountPath: /data
- name: grafana-datasources
mountPath: /grafana/conf/provisioning/datasources
- name: grafana-dashboards
mountPath: /grafana/conf/provisioning/dashboards
XXX_VOLUME_MOUNTS_XXX
ports:
- name: web
containerPort: 3000
@@ -43,32 +33,13 @@ spec:
limits:
memory: 200Mi
cpu: 200m
- name: grafana-watcher
image: quay.io/coreos/grafana-watcher:v0.0.8
args:
XXX_WATCH_DIR_XXX
- '--grafana-url=http://localhost:3000'
env:
- name: GRAFANA_USER
valueFrom:
secretKeyRef:
name: grafana-credentials
key: user
- name: GRAFANA_PASSWORD
valueFrom:
secretKeyRef:
name: grafana-credentials
key: password
resources:
requests:
memory: "16Mi"
cpu: "50m"
limits:
memory: "32Mi"
cpu: "100m"
volumeMounts:
XXX_VOLUME_MOUNTS_XXX
volumes:
- name: grafana-storage
emptyDir: {}
- name: grafana-datasources
configMap:
name: grafana-datasources
- name: grafana-dashboards
configMap:
name: grafana-dashboards
XXX_VOLUMES_XXX