Skip to content

Commit

Permalink
stable/kibana: Fix JSON test, clarify log messages (helm#8517)
Browse files Browse the repository at this point in the history
Add test values for dashboards to ci directory

Signed-off-by: Zack Williams <[email protected]>
  • Loading branch information
zdw authored and wgiddens committed Jan 18, 2019
1 parent 820c9d9 commit 7d52c7c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stable/kibana/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: kibana
version: 0.16.3
version: 0.16.4
appVersion: 6.4.2
description: Kibana is an open source data visualization plugin for Elasticsearch
icon: https://raw.githubusercontent.com/elastic/kibana/master/src/ui/public/icons/kibana-color.svg
Expand Down
21 changes: 21 additions & 0 deletions stable/kibana/ci/dashboard-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# enable the dashboard init container with dashboard embedded in configmap

dashboardImport:
dashboards:
1_create_index: |-
{
"version": "6.4.2",
"objects": [
{
"id": "a88738e0-d3c1-11e8-b38e-a37c21cf8c95",
"version": 2,
"attributes": {
"title": "logstash-*",
"timeFieldName": "@timestamp",
"fields": "[{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]"
}
}
]
}
6 changes: 6 additions & 0 deletions stable/kibana/ci/url_dashboard-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# enable the dashboard init container with dashboard retrieved from an URL

dashboardImport:
dashboards:
k8s: https://raw.githubusercontent.com/monotek/kibana-dashboards/master/k8s-fluentd-elasticsearch.json
6 changes: 3 additions & 3 deletions stable/kibana/templates/configmap-dashboardimport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ data:
for DASHBOARD_FILE in *; do
echo -e "Importing ${DASHBOARD_FILE} dashboard..."
if [ ! "$(python -c 'import sys, json; print json.load(sys.stdin)' < ${DASHBOARD_FILE} &> /dev/null)" ]; then
echo "${DASHBOARD_FILE} is no valid json. Trying to import from url..."
if ! python -c 'import sys, json; print json.load(sys.stdin)' < "${DASHBOARD_FILE}" &> /dev/null ; then
echo "${DASHBOARD_FILE} is not valid JSON, assuming it's an URL..."
TMP_FILE="$(mktemp)"
curl -s $(cat ${DASHBOARD_FILE}) > ${TMP_FILE}
curl -v {{ if .Values.dashboardImport.xpackauth.enabled }}--user {{ .Values.dashboardImport.xpackauth.username }}:{{ .Values.dashboardImport.xpackauth.password }}{{ end }} -s --connect-timeout 60 --max-time 60 -XPOST localhost:5601/api/kibana/dashboards/import?force=true -H 'kbn-xsrf:true' -H 'Content-type:application/json' -d @${TMP_FILE}
rm ${TMP_FILE}
else
echo "Importing from json file..."
echo "Valid JSON found in ${DASHBOARD_FILE}, importing..."
curl -v {{ if .Values.dashboardImport.xpackauth.enabled }}--user {{ .Values.dashboardImport.xpackauth.username }}:{{ .Values.dashboardImport.xpackauth.password }}{{ end }} -s --connect-timeout 60 --max-time 60 -XPOST localhost:5601/api/kibana/dashboards/import?force=true -H 'kbn-xsrf:true' -H 'Content-type:application/json' -d @./${DASHBOARD_FILE}
fi
Expand Down

0 comments on commit 7d52c7c

Please sign in to comment.