[Update] Grafana: Provision any dashboard as homepage
Grafana v7.3 has ability to add the customized dashboard as homepage. This removes the necessity to have explicit job to add a homepage. Clean up the explicit add_home-dashboard job. Change-Id: I68baa7693f545e2d91dba01ae61b4bdae8a26bee
This commit is contained in:
parent
b11fa5509b
commit
d5fb81b7f7
@ -15,7 +15,7 @@ apiVersion: v1
|
|||||||
appVersion: v7.3.6
|
appVersion: v7.3.6
|
||||||
description: OpenStack-Helm Grafana
|
description: OpenStack-Helm Grafana
|
||||||
name: grafana
|
name: grafana
|
||||||
version: 0.1.2
|
version: 0.1.3
|
||||||
home: https://grafana.com/
|
home: https://grafana.com/
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/grafana/grafana
|
- https://github.com/grafana/grafana
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright 2020 The Openstack-Helm Authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
set -xe
|
|
||||||
home_dashboard_id=[]
|
|
||||||
counter=0
|
|
||||||
|
|
||||||
#Loop until home_dashboard_id value is not null. If null sleep for 15s. Retry for 5 times.
|
|
||||||
until [ $home_dashboard_id != "[]" ]
|
|
||||||
do
|
|
||||||
echo "Waiting for Home Dashboard to load in Grafana"
|
|
||||||
sleep 15s
|
|
||||||
home_dashboard_id=$(curl -K- <<< "--user ${GF_SECURITY_ADMIN_USER}:${GF_SECURITY_ADMIN_PASSWORD}" -XGET "${GRAFANA_URI}api/search?query=OSH%20Home" | sed 's/\[{.id":"*\([0-9a-zA-Z]*\)*,*.*}[]]/\1/')
|
|
||||||
echo $home_dashboard_id
|
|
||||||
if [ $counter -ge 5 ]; then
|
|
||||||
echo "Exiting.. Exceeded the wait."
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
counter=$((counter + 1));
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $home_dashboard_id != "[]" ]
|
|
||||||
then
|
|
||||||
#Set Customized Home Dashboard id as Org preference
|
|
||||||
curl -K- <<< "--user ${GF_SECURITY_ADMIN_USER}:${GF_SECURITY_ADMIN_PASSWORD}" \
|
|
||||||
-XPUT "${GRAFANA_URI}api/org/preferences" -H "Content-Type: application/json" \
|
|
||||||
-d "{\"homeDashboardId\": $home_dashboard_id}"
|
|
||||||
echo "Successful"
|
|
||||||
fi
|
|
@ -30,8 +30,6 @@ data:
|
|||||||
{{ tuple "bin/_grafana.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
{{ tuple "bin/_grafana.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||||
selenium-tests.py: |
|
selenium-tests.py: |
|
||||||
{{ tuple "bin/_selenium-tests.py.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
{{ tuple "bin/_selenium-tests.py.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||||
add-home-dashboard.sh: |
|
|
||||||
{{ tuple "bin/_add-home-dashboard.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
|
||||||
set-admin-password.sh: |
|
set-admin-password.sh: |
|
||||||
{{ tuple "bin/_set-admin-password.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
{{ tuple "bin/_set-admin-password.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
{{/*
|
|
||||||
Copyright 2020 The Openstack-Helm Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/}}
|
|
||||||
|
|
||||||
{{- if .Values.manifests.job_add_home_dashboard }}
|
|
||||||
{{- $envAll := . }}
|
|
||||||
|
|
||||||
{{- $serviceAccountName := "add-home-dashboard" }}
|
|
||||||
{{ tuple $envAll "add_home_dashboard" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
|
||||||
---
|
|
||||||
apiVersion: batch/v1
|
|
||||||
kind: Job
|
|
||||||
metadata:
|
|
||||||
name: grafana-add-home-dashboard
|
|
||||||
annotations:
|
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
|
||||||
spec:
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
{{ tuple $envAll "grafana" "add_home_dashboard" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
|
||||||
annotations:
|
|
||||||
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
|
||||||
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
|
||||||
{{ dict "envAll" $envAll "podName" "grafana-add-home-dashboard" "containerNames" (list "add-home-dashboard" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
|
|
||||||
spec:
|
|
||||||
{{ dict "envAll" $envAll "application" "add_home_dashboard" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
|
||||||
serviceAccountName: {{ $serviceAccountName }}
|
|
||||||
restartPolicy: OnFailure
|
|
||||||
nodeSelector:
|
|
||||||
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value | quote }}
|
|
||||||
initContainers:
|
|
||||||
{{ tuple $envAll "add_home_dashboard" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
|
||||||
containers:
|
|
||||||
- name: add-home-dashboard
|
|
||||||
{{ tuple $envAll "add_home_dashboard" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
||||||
{{ tuple $envAll $envAll.Values.pod.resources.jobs.add_home_dashboard | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
||||||
{{ dict "envAll" $envAll "application" "add_home_dashboard" "container" "add_home_dashboard" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
|
||||||
env:
|
|
||||||
- name: GF_SECURITY_ADMIN_USER
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: grafana-admin-creds
|
|
||||||
key: GRAFANA_ADMIN_USERNAME
|
|
||||||
- name: GF_SECURITY_ADMIN_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: grafana-admin-creds
|
|
||||||
key: GRAFANA_ADMIN_PASSWORD
|
|
||||||
- name: GRAFANA_URI
|
|
||||||
value: {{ tuple "grafana" "internal" "grafana" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }}
|
|
||||||
command:
|
|
||||||
- /tmp/add-home-dashboard.sh
|
|
||||||
volumeMounts:
|
|
||||||
- name: pod-tmp
|
|
||||||
mountPath: /tmp
|
|
||||||
- name: grafana-bin
|
|
||||||
mountPath: /tmp/add-home-dashboard.sh
|
|
||||||
subPath: add-home-dashboard.sh
|
|
||||||
readOnly: true
|
|
||||||
volumes:
|
|
||||||
- name: pod-tmp
|
|
||||||
emptyDir: {}
|
|
||||||
- name: grafana-bin
|
|
||||||
configMap:
|
|
||||||
name: grafana-bin
|
|
||||||
defaultMode: 0555
|
|
||||||
{{- end }}
|
|
@ -22,7 +22,6 @@ images:
|
|||||||
db_init: docker.io/openstackhelm/heat:stein-ubuntu_bionic
|
db_init: docker.io/openstackhelm/heat:stein-ubuntu_bionic
|
||||||
grafana_db_session_sync: docker.io/openstackhelm/heat:stein-ubuntu_bionic
|
grafana_db_session_sync: docker.io/openstackhelm/heat:stein-ubuntu_bionic
|
||||||
selenium_tests: docker.io/openstackhelm/osh-selenium:latest-ubuntu_bionic
|
selenium_tests: docker.io/openstackhelm/osh-selenium:latest-ubuntu_bionic
|
||||||
add_home_dashboard: docker.io/openstackhelm/heat:stein-ubuntu_bionic
|
|
||||||
image_repo_sync: docker.io/docker:17.07.0
|
image_repo_sync: docker.io/docker:17.07.0
|
||||||
pull_policy: IfNotPresent
|
pull_policy: IfNotPresent
|
||||||
local_registry:
|
local_registry:
|
||||||
@ -77,13 +76,6 @@ pod:
|
|||||||
grafana_set_admin_password:
|
grafana_set_admin_password:
|
||||||
allowPrivilegeEscalation: false
|
allowPrivilegeEscalation: false
|
||||||
readOnlyRootFilesystem: true
|
readOnlyRootFilesystem: true
|
||||||
add_home_dashboard:
|
|
||||||
pod:
|
|
||||||
runAsUser: 104
|
|
||||||
container:
|
|
||||||
add_home_dashboard:
|
|
||||||
allowPrivilegeEscalation: false
|
|
||||||
readOnlyRootFilesystem: true
|
|
||||||
test:
|
test:
|
||||||
pod:
|
pod:
|
||||||
runAsUser: 104
|
runAsUser: 104
|
||||||
@ -161,13 +153,6 @@ pod:
|
|||||||
limits:
|
limits:
|
||||||
memory: "1024Mi"
|
memory: "1024Mi"
|
||||||
cpu: "2000m"
|
cpu: "2000m"
|
||||||
add_home_dashboard:
|
|
||||||
requests:
|
|
||||||
memory: "128Mi"
|
|
||||||
cpu: "100m"
|
|
||||||
limits:
|
|
||||||
memory: "1024Mi"
|
|
||||||
cpu: "2000m"
|
|
||||||
tests:
|
tests:
|
||||||
requests:
|
requests:
|
||||||
memory: "128Mi"
|
memory: "128Mi"
|
||||||
@ -343,10 +328,6 @@ dependencies:
|
|||||||
services:
|
services:
|
||||||
- endpoint: internal
|
- endpoint: internal
|
||||||
service: grafana
|
service: grafana
|
||||||
add_home_dashboard:
|
|
||||||
services:
|
|
||||||
- endpoint: internal
|
|
||||||
service: grafana
|
|
||||||
|
|
||||||
network:
|
network:
|
||||||
grafana:
|
grafana:
|
||||||
@ -394,7 +375,6 @@ manifests:
|
|||||||
job_db_session_sync: true
|
job_db_session_sync: true
|
||||||
job_image_repo_sync: true
|
job_image_repo_sync: true
|
||||||
job_set_admin_user: true
|
job_set_admin_user: true
|
||||||
job_add_home_dashboard: false
|
|
||||||
network_policy: false
|
network_policy: false
|
||||||
secret_db: true
|
secret_db: true
|
||||||
secret_db_session: true
|
secret_db_session: true
|
||||||
@ -492,6 +472,8 @@ conf:
|
|||||||
cookie_username: grafana_user
|
cookie_username: grafana_user
|
||||||
cookie_remember_name: grafana_remember
|
cookie_remember_name: grafana_remember
|
||||||
login_remember_days: 7
|
login_remember_days: 7
|
||||||
|
dashboards:
|
||||||
|
default_home_dashboard_path: /etc/grafana/dashboards/home_dashboard.json
|
||||||
users:
|
users:
|
||||||
allow_sign_up: false
|
allow_sign_up: false
|
||||||
allow_org_create: false
|
allow_org_create: false
|
||||||
|
@ -8,9 +8,6 @@ pod:
|
|||||||
grafana-db-init-session:
|
grafana-db-init-session:
|
||||||
grafana-db-init-session: runtime/default
|
grafana-db-init-session: runtime/default
|
||||||
init: runtime/default
|
init: runtime/default
|
||||||
grafana-add-home-dashboard:
|
|
||||||
add-home-dashboard: runtime/default
|
|
||||||
init: runtime/default
|
|
||||||
grafana-db-init:
|
grafana-db-init:
|
||||||
grafana-db-init: runtime/default
|
grafana-db-init: runtime/default
|
||||||
init: runtime/default
|
init: runtime/default
|
||||||
|
@ -105,7 +105,4 @@ conf:
|
|||||||
"title": "OSH Home",
|
"title": "OSH Home",
|
||||||
"version": 1
|
"version": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
manifests:
|
|
||||||
job_add_home_dashboard: true
|
|
||||||
...
|
...
|
||||||
|
@ -3,4 +3,5 @@ grafana:
|
|||||||
- 0.1.0 Initial Chart
|
- 0.1.0 Initial Chart
|
||||||
- 0.1.1 Change helm-toolkit dependency version to ">= 0.1.0"
|
- 0.1.1 Change helm-toolkit dependency version to ">= 0.1.0"
|
||||||
- 0.1.2 Update Grafana version
|
- 0.1.2 Update Grafana version
|
||||||
|
- 0.1.3 Provision any dashboard as homepage
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user