feat(ldap): adds ldap support for Grafana
This adds example configurations in the gate to leverage LDAP auth for Grafana dashboard. This patch also fixes up minor indentation errors in YAML. Signed-off-by: Tin Lam <tin@irrational.io> Change-Id: I0961ced71b8a4d1c4f639fd898bc70761f8de995
This commit is contained in:
parent
ea909370ed
commit
406c024b59
5
.gitignore
vendored
5
.gitignore
vendored
@ -9,4 +9,7 @@ doc/source/_build
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
tools/deployment/vagrant/.vagrant
|
||||
tools/deployment/vagrant/.vagrant
|
||||
|
||||
# Helm dependencies lock file
|
||||
Chart.lock
|
||||
|
1
charts/loki/.helmignore
Normal file
1
charts/loki/.helmignore
Normal file
@ -0,0 +1 @@
|
||||
values_overrides
|
10
charts/loki/Chart.yaml
Normal file
10
charts/loki/Chart.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
apiVersion: v2
|
||||
name: loki
|
||||
description: Loki
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.16.0"
|
||||
dependencies:
|
||||
- name: loki-stack
|
||||
version: "2.3.1"
|
||||
repository: "https://grafana.github.io/helm-charts"
|
21
charts/loki/bin/grafana-ldap-test.sh
Normal file
21
charts/loki/bin/grafana-ldap-test.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
|
||||
test_status() {
|
||||
curl --head --show-error --silent --fail --location --insecure --request GET \
|
||||
--netrc-file $1 \
|
||||
-H "accept: application/json" \
|
||||
-H "content-type: application/json" \
|
||||
${GRAFANA_URI}/api/org | head -n 1 | awk '{print $2}'
|
||||
}
|
||||
|
||||
if [ "$(test_status /etc/loki/good_ldap.rc)" -ne "200" ]; then
|
||||
echo "expected 200"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(test_status /etc/loki/bad_ldap.rc)" -ne "401" ]; then
|
||||
echo "expected 401"
|
||||
exit 1
|
||||
fi
|
12
charts/loki/templates/configmap-loki_ldap.yaml
Normal file
12
charts/loki/templates/configmap-loki_ldap.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
{{- define "configmap-loki_ldap" -}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: loki-ldap-bin
|
||||
data:
|
||||
grafana-ldap-test.sh: |
|
||||
{{- tpl (.Files.Get "bin/grafana-ldap-test.sh") . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- if (index $.Values "loki-stack" "grafana" "ldap" "enabled") }}
|
||||
{{- include "helpers.template.overlay" (dict "Global" $ "template_definition" "configmap-loki_ldap") }}
|
||||
{{- end }}
|
65
charts/loki/templates/helpers/_label.tpl
Normal file
65
charts/loki/templates/helpers/_label.tpl
Normal file
@ -0,0 +1,65 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "helpers.labels.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "helpers.labels.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "helpers.labels.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "helpers.labels.matchLabels" -}}
|
||||
{{- $Global := index . "Global" -}}
|
||||
{{- $Component := index . "Component" -}}
|
||||
app.kubernetes.io/name: {{ include "helpers.labels.name" $Global }}
|
||||
app.kubernetes.io/instance: {{ $Global.Values.release_group | default $Global.Release.Name }}
|
||||
{{- if $Component }}
|
||||
app.kubernetes.io/component: {{ $Component }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "helpers.labels.labels" -}}
|
||||
{{- $Global := index . "Global" -}}
|
||||
{{- $PartOf := index . "PartOf" -}}
|
||||
{{- $Component := index . "Component" -}}
|
||||
{{- $Version := index . "Version" -}}
|
||||
{{ include "helpers.labels.matchLabels" (dict "Global" $Global )}}
|
||||
app.kubernetes.io/managed-by: {{ $Global.Release.Service }}
|
||||
{{- if $PartOf }}
|
||||
app.kubernetes.io/part-of: {{ $PartOf }}
|
||||
{{- end }}
|
||||
{{- if $Component }}
|
||||
app.kubernetes.io/component: {{ $Component }}
|
||||
{{- end }}
|
||||
{{- if $Version }}
|
||||
app.kubernetes.io/version: {{ $Version }}
|
||||
{{- end }}
|
||||
helm.sh/chart: {{ include "helpers.labels.chart" $Global }}
|
||||
{{- end -}}
|
21
charts/loki/templates/helpers/_pod.tpl
Normal file
21
charts/loki/templates/helpers/_pod.tpl
Normal file
@ -0,0 +1,21 @@
|
||||
{{- define "helpers.pod.container.image" -}}
|
||||
{{- $Global := index . "Global" -}}
|
||||
{{- $Application := index . "Application" -}}
|
||||
{{- with index $.Global.Values.images.applications $Application -}}
|
||||
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "helpers.pod.node_selector" -}}
|
||||
{{- $Global := index . "Global" -}}
|
||||
{{- $Application := index . "Application" -}}
|
||||
{{- with index $.Global.Values.node_labels $Application -}}
|
||||
{{- if kindIs "slice" . -}}
|
||||
{{- range $k, $item := . }}
|
||||
{{ $item.key }}: {{ $item.value | quote }}
|
||||
{{- end }}
|
||||
{{- else -}}
|
||||
{{ .key }}: {{ .value | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
107
charts/loki/templates/helpers/_template.tpl
Normal file
107
charts/loki/templates/helpers/_template.tpl
Normal file
@ -0,0 +1,107 @@
|
||||
{{- define "helpers.template.overlay" -}}
|
||||
{{- $local := dict -}}
|
||||
{{/*
|
||||
By default we merge lists with a 'name' key's values
|
||||
*/}}
|
||||
{{- $_ := set $local "merge_same_named" true -}}
|
||||
{{- if kindIs "map" $ -}}
|
||||
{{- if hasKey $ "merge_same_named" -}}
|
||||
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
|
||||
{{- $target := dict -}}
|
||||
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
|
||||
{{- $_ := set $local "overlay" dict -}}
|
||||
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
|
||||
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
|
||||
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $item := tuple $local.input $local.overlay -}}
|
||||
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
|
||||
{{- $_ := include "helpers._merge" $call -}}
|
||||
{{- $_ := set $local "result" $call.result -}}
|
||||
{{- end -}}
|
||||
{{- if kindIs "map" $ -}}
|
||||
{{- $_ := set $ "result" $local.result -}}
|
||||
{{- end -}}
|
||||
{{ $target | toYaml }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "helpers._merge" -}}
|
||||
{{- $local := dict -}}
|
||||
{{- $_ := set $ "result" $.source -}}
|
||||
{{/*
|
||||
TODO: Should we `fail` when trying to merge a collection (map or slice) with
|
||||
either a different kind of collection or a scalar?
|
||||
*/}}
|
||||
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
|
||||
{{- range $key, $sourceValue := $.source -}}
|
||||
{{- if not (hasKey $.target $key) -}}
|
||||
{{- $_ := set $local "newTargetValue" $sourceValue -}}
|
||||
{{- if kindIs "map" $sourceValue -}}
|
||||
{{- $copy := dict -}}
|
||||
{{- $call := dict "target" $copy "source" $sourceValue -}}
|
||||
{{- $_ := include "helpers._merge.shallow" $call -}}
|
||||
{{- $_ := set $local "newTargetValue" $copy -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $targetValue := index $.target $key -}}
|
||||
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
|
||||
{{- $_ := include "helpers._merge" $call -}}
|
||||
{{- $_ := set $local "newTargetValue" $call.result -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $.target $key $local.newTargetValue -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $ "result" $.target -}}
|
||||
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
|
||||
{{- $call := dict "target" $.target "source" $.source -}}
|
||||
{{- $_ := include "helpers._merge.append_slice" $call -}}
|
||||
{{- if $.merge_same_named -}}
|
||||
{{- $_ := set $local "result" list -}}
|
||||
{{- $_ := set $local "named_items" dict -}}
|
||||
{{- range $item := $call.result -}}
|
||||
{{- $_ := set $local "has_name_key" false -}}
|
||||
{{- if kindIs "map" $item -}}
|
||||
{{- if hasKey $item "name" -}}
|
||||
{{- $_ := set $local "has_name_key" true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $local.has_name_key -}}
|
||||
{{- if hasKey $local.named_items $item.name -}}
|
||||
{{- $named_item := index $local.named_items $item.name -}}
|
||||
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
|
||||
{{- $_ := include "helpers._merge" $call -}}
|
||||
{{- else -}}
|
||||
{{- $copy := dict -}}
|
||||
{{- $copy_call := dict "target" $copy "source" $item -}}
|
||||
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
|
||||
{{- $_ := set $local.named_items $item.name $copy -}}
|
||||
{{- $_ := set $local "result" (append $local.result $copy) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $_ := set $local "result" (append $local.result $item) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $_ := set $local "result" $call.result -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $ "result" (uniq $local.result) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "helpers._merge.shallow" -}}
|
||||
{{- range $key, $value := $.source -}}
|
||||
{{- $_ := set $.target $key $value -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "helpers._merge.append_slice" -}}
|
||||
{{- $local := dict -}}
|
||||
{{- $_ := set $local "result" $.target -}}
|
||||
{{- range $value := $.source -}}
|
||||
{{- $_ := set $local "result" (append $local.result $value) -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $ "result" $local.result -}}
|
||||
{{- end -}}
|
14
charts/loki/templates/secret-netrc.yaml
Normal file
14
charts/loki/templates/secret-netrc.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- define "secret-netrc" -}}
|
||||
{{- $p := urlParse $.Values.config.test.grafana_uri -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
metadata:
|
||||
name: loki-netrc
|
||||
data:
|
||||
good_ldap.rc: {{ b64enc ( printf "machine %s login %s password %s" $p.host $.Values.config.test.ldap_username $.Values.config.test.ldap_password ) }}
|
||||
bad_ldap.rc: {{ b64enc ( printf "machine %s login %s password %s" $p.host $.Values.config.test.ldap_username ( randAlphaNum 10 ) ) }}
|
||||
{{- end -}}
|
||||
{{- if (index $.Values "loki-stack" "grafana" "ldap" "enabled") }}
|
||||
{{- include "helpers.template.overlay" (dict "Global" $ "template_definition" "secret-netrc") }}
|
||||
{{- end }}
|
43
charts/loki/templates/tests/test-grafana_ldap.yaml
Normal file
43
charts/loki/templates/tests/test-grafana_ldap.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
{{- define "test-grafana_ldap" -}}
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: grafana-ldap-test
|
||||
labels: {{- include "helpers.labels.labels" (dict "Global" $ "Component" "grafana" ) | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: grafana-ldap-test
|
||||
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "grafana_ldap_test" ) }}
|
||||
imagePullPolicy: {{ $.Values.images.pull.policy | quote }}
|
||||
env:
|
||||
- name: GRAFANA_URI
|
||||
value: {{ $.Values.config.test.grafana_uri | quote }}
|
||||
command:
|
||||
- /tmp/grafana-ldap-test.sh
|
||||
volumeMounts:
|
||||
- name: pod-tmp
|
||||
mountPath: /tmp
|
||||
- name: loki-bin
|
||||
mountPath: /tmp/grafana-ldap-test.sh
|
||||
subPath: grafana-ldap-test.sh
|
||||
readOnly: true
|
||||
- name: netrc
|
||||
mountPath: /etc/loki
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: pod-tmp
|
||||
emptyDir: {}
|
||||
- name: netrc
|
||||
secret:
|
||||
secretName: loki-netrc
|
||||
- name: loki-bin
|
||||
configMap:
|
||||
name: loki-ldap-bin
|
||||
defaultMode: 0555
|
||||
{{- end -}}
|
||||
{{- if (index $.Values "loki-stack" "grafana" "ldap" "enabled") }}
|
||||
{{- include "helpers.template.overlay" (dict "Global" $ "template_definition" "test-grafana_ldap") }}
|
||||
{{- end }}
|
18
charts/loki/values.yaml
Normal file
18
charts/loki/values.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
config:
|
||||
test:
|
||||
ldap_username: jarvis
|
||||
ldap_password: password
|
||||
grafana_uri: http://loki-grafana.loki.svc.cluster.local
|
||||
|
||||
params: {}
|
||||
|
||||
images:
|
||||
applications:
|
||||
grafana_ldap_test:
|
||||
name: curl
|
||||
repo: quay.io/stannum
|
||||
tag: 7.74.0
|
||||
pull:
|
||||
policy: IfNotPresent
|
||||
|
||||
over_rides: {}
|
@ -1,365 +1,390 @@
|
||||
loki:
|
||||
enabled: true
|
||||
persistence:
|
||||
loki-stack:
|
||||
loki:
|
||||
enabled: true
|
||||
ingress:
|
||||
enabled: true
|
||||
hosts:
|
||||
- host: loki.jarvis.local
|
||||
paths: ["/"]
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: jarvis-ca-issuer
|
||||
tls:
|
||||
- secretName: lokistack-loki-tls
|
||||
hosts:
|
||||
- loki.jarvis.local
|
||||
|
||||
promtail:
|
||||
enabled: true
|
||||
|
||||
grafana:
|
||||
adminPassword: password
|
||||
enabled: true
|
||||
persistence:
|
||||
enabled: true
|
||||
grafana.ini:
|
||||
auth.anonymous:
|
||||
persistence:
|
||||
enabled: true
|
||||
org_name: Main Org.
|
||||
org_role: Viewer
|
||||
ingress:
|
||||
ingress:
|
||||
enabled: true
|
||||
hosts:
|
||||
- host: loki.jarvis.local
|
||||
paths: ["/"]
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: jarvis-ca-issuer
|
||||
tls:
|
||||
- secretName: lokistack-loki-tls
|
||||
hosts:
|
||||
- loki.jarvis.local
|
||||
|
||||
promtail:
|
||||
enabled: true
|
||||
path: /
|
||||
hosts:
|
||||
- grafana.jarvis.local
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: jarvis-ca-issuer
|
||||
tls:
|
||||
- secretName: lokistack-grafana-tls
|
||||
hosts:
|
||||
- grafana.jarvis.local
|
||||
dashboardProviders:
|
||||
dashboardproviders.yaml:
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: 'default'
|
||||
orgId: 1
|
||||
folder: ''
|
||||
type: file
|
||||
disableDeletion: false
|
||||
editable: true
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards/default
|
||||
dashboards:
|
||||
default:
|
||||
tekton-pipelines:
|
||||
json: |
|
||||
{
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": "-- Grafana --",
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"description": "Tekton Logs Dashboard",
|
||||
"editable": true,
|
||||
"gnetId": null,
|
||||
"graphTooltip": 0,
|
||||
"id": null,
|
||||
"iteration": 1610656127596,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": true,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "Loki",
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 1,
|
||||
"fillGradient": 0,
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 6,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": false,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": false,
|
||||
"linewidth": 1,
|
||||
"nullPointMode": "null",
|
||||
"options": {
|
||||
"dataLinks": []
|
||||
},
|
||||
"percentage": false,
|
||||
"pointradius": 2,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
|
||||
grafana:
|
||||
adminPassword: password
|
||||
enabled: true
|
||||
persistence:
|
||||
enabled: true
|
||||
grafana.ini:
|
||||
auth.anonymous:
|
||||
enabled: true
|
||||
org_name: Main Org.
|
||||
org_role: Viewer
|
||||
auth.ldap:
|
||||
enabled: true
|
||||
ldap:
|
||||
enabled: true
|
||||
config: |-
|
||||
[[servers]]
|
||||
host = "ldap-openldap.ldap.svc.cluster.local"
|
||||
port = 389
|
||||
use_ssl = false
|
||||
start_tls = false
|
||||
ssl_skip_verify = false
|
||||
bind_dn = "cn=readonly,dc=jarvis,dc=local"
|
||||
bind_password = "readonly"
|
||||
search_base_dns = ["dc=jarvis,dc=local"]
|
||||
search_filter = "(uid=%s)"
|
||||
[[servers.group_mappings]]
|
||||
group_dn = "cn=jarvis-admins,ou=Groups,dc=jarvis,dc=local"
|
||||
org_role = "Admin"
|
||||
grafana_admin = true
|
||||
[[servers.group_mappings]]
|
||||
group_dn = "*"
|
||||
org_role = "Viewer"
|
||||
[servers.attributes]
|
||||
email = "mail"
|
||||
ingress:
|
||||
enabled: true
|
||||
path: /
|
||||
hosts:
|
||||
- grafana.jarvis.local
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: jarvis-ca-issuer
|
||||
tls:
|
||||
- secretName: lokistack-grafana-tls
|
||||
hosts:
|
||||
- grafana.jarvis.local
|
||||
dashboardProviders:
|
||||
dashboardproviders.yaml:
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: 'default'
|
||||
orgId: 1
|
||||
folder: ''
|
||||
type: file
|
||||
disableDeletion: false
|
||||
editable: true
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards/default
|
||||
dashboards:
|
||||
default:
|
||||
tekton-pipelines:
|
||||
json: |
|
||||
{
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"expr": "sum(count_over_time({namespace=~\"$namespace\", tekton_dev_pipeline=~\"$tekton_dev_pipeline\", tekton_dev_pipelineRun=~\"$tekton_dev_pipelineRun\", tekton_dev_taskRun=~\"$tekton_dev_taskRun\"} |~ \"$search\"[$__interval]))",
|
||||
"refId": "A"
|
||||
"builtIn": 1,
|
||||
"datasource": "-- Grafana --",
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "Timeline",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": false
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": false
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"datasource": "Loki",
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 25,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
},
|
||||
"id": 2,
|
||||
"maxDataPoints": "",
|
||||
"options": {
|
||||
"showLabels": true,
|
||||
"showTime": true,
|
||||
"sortOrder": "Descending",
|
||||
"wrapLogMessage": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "{namespace=~\"$namespace\", tekton_dev_pipeline=~\"$tekton_dev_pipeline\", tekton_dev_pipelineRun=~\"$tekton_dev_pipelineRun\", tekton_dev_taskRun=~\"$tekton_dev_taskRun\"} |~ \"$search\"",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"timeFrom": null,
|
||||
"timeShift": null,
|
||||
"title": "Logs",
|
||||
"type": "logs"
|
||||
}
|
||||
],
|
||||
"refresh": false,
|
||||
"schemaVersion": 22,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
"description": "Tekton Logs Dashboard",
|
||||
"editable": true,
|
||||
"gnetId": null,
|
||||
"graphTooltip": 0,
|
||||
"id": null,
|
||||
"iteration": 1610656127596,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"allValue": null,
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
},
|
||||
"aliasColors": {},
|
||||
"bars": true,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(kube_pod_info, namespace)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "namespace",
|
||||
"options": [],
|
||||
"query": "label_values(kube_pod_info, namespace)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 0,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_pipeline)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "tekton_dev_pipeline",
|
||||
"options": [],
|
||||
"query": "label_values(mixin_pod_workload{namespace=\"namespace\"}, tekton_dev_pipeline)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 5,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
"fill": 1,
|
||||
"fillGradient": 0,
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_pipelineRun)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "tekton_dev_pipelineRun",
|
||||
"options": [],
|
||||
"query": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_pipelineRun)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 5,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
"hiddenSeries": false,
|
||||
"id": 6,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": false,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_taskRun)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "tekton_dev_taskRun",
|
||||
"options": [],
|
||||
"query": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_taskRun)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 5,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "",
|
||||
"value": ""
|
||||
"lines": false,
|
||||
"linewidth": 1,
|
||||
"nullPointMode": "null",
|
||||
"options": {
|
||||
"dataLinks": []
|
||||
},
|
||||
"hide": 0,
|
||||
"label": null,
|
||||
"name": "search",
|
||||
"options": [
|
||||
"percentage": false,
|
||||
"pointradius": 2,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "",
|
||||
"value": ""
|
||||
"expr": "sum(count_over_time({namespace=~\"$namespace\", tekton_dev_pipeline=~\"$tekton_dev_pipeline\", tekton_dev_pipelineRun=~\"$tekton_dev_pipelineRun\", tekton_dev_taskRun=~\"$tekton_dev_taskRun\"} |~ \"$search\"[$__interval]))",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"query": "",
|
||||
"skipUrlSync": false,
|
||||
"type": "textbox"
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "Timeline",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": false
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": false
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"datasource": "Loki",
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 25,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
},
|
||||
"id": 2,
|
||||
"maxDataPoints": "",
|
||||
"options": {
|
||||
"showLabels": true,
|
||||
"showTime": true,
|
||||
"sortOrder": "Descending",
|
||||
"wrapLogMessage": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "{namespace=~\"$namespace\", tekton_dev_pipeline=~\"$tekton_dev_pipeline\", tekton_dev_pipelineRun=~\"$tekton_dev_pipelineRun\", tekton_dev_taskRun=~\"$tekton_dev_taskRun\"} |~ \"$search\"",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"timeFrom": null,
|
||||
"timeShift": null,
|
||||
"title": "Logs",
|
||||
"type": "logs"
|
||||
}
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-24h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": [
|
||||
"10s",
|
||||
"30s",
|
||||
"1m",
|
||||
"5m",
|
||||
"15m",
|
||||
"30m",
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Tekton Logs Dashboard",
|
||||
"uid": "tektonDash",
|
||||
"variables": {
|
||||
"list": []
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
],
|
||||
"refresh": false,
|
||||
"schemaVersion": 22,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"allValue": null,
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
},
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(kube_pod_info, namespace)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "namespace",
|
||||
"options": [],
|
||||
"query": "label_values(kube_pod_info, namespace)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 0,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
},
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_pipeline)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "tekton_dev_pipeline",
|
||||
"options": [],
|
||||
"query": "label_values(mixin_pod_workload{namespace=\"namespace\"}, tekton_dev_pipeline)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 5,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
},
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_pipelineRun)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "tekton_dev_pipelineRun",
|
||||
"options": [],
|
||||
"query": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_pipelineRun)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 5,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "All",
|
||||
"value": "$__all"
|
||||
},
|
||||
"datasource": "Loki",
|
||||
"definition": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_taskRun)",
|
||||
"hide": 0,
|
||||
"includeAll": true,
|
||||
"index": -1,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"name": "tekton_dev_taskRun",
|
||||
"options": [],
|
||||
"query": "label_values(mixin_pod_workload{namespace=\"$namespace\"}, tekton_dev_taskRun)",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 5,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
},
|
||||
{
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "",
|
||||
"value": ""
|
||||
},
|
||||
"hide": 0,
|
||||
"label": null,
|
||||
"name": "search",
|
||||
"options": [
|
||||
{
|
||||
"selected": true,
|
||||
"text": "",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"query": "",
|
||||
"skipUrlSync": false,
|
||||
"type": "textbox"
|
||||
}
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-24h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"refresh_intervals": [
|
||||
"10s",
|
||||
"30s",
|
||||
"1m",
|
||||
"5m",
|
||||
"15m",
|
||||
"30m",
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
]
|
||||
},
|
||||
"timezone": "",
|
||||
"title": "Tekton Logs Dashboard",
|
||||
"uid": "tektonDash",
|
||||
"variables": {
|
||||
"list": []
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
helm repo add grafana https://grafana.github.io/helm-charts
|
||||
cd ./charts/loki
|
||||
helm dep up
|
||||
cd -
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
helm upgrade \
|
||||
@ -9,7 +11,9 @@ helm upgrade \
|
||||
--install \
|
||||
--namespace=loki \
|
||||
loki \
|
||||
grafana/loki-stack \
|
||||
./charts/loki \
|
||||
$(./tools/deployment/common/get-values-overrides.sh loki)
|
||||
|
||||
./tools/deployment/common/wait-for-pods.sh loki
|
||||
./tools/deployment/common/wait-for-pods.sh loki
|
||||
|
||||
helm -n loki test loki --logs
|
||||
|
Loading…
x
Reference in New Issue
Block a user