@@ -23,6 +23,15 @@ let downloadVictoriaLogsPluginScript = """
2323 rm /var/lib/grafana/plugins/plugin.tar.gz
2424 """
2525
26+ let downloadVictoriaMetricsPluginScript = """
27+ set -ex
28+ mkdir -p /var/lib/grafana/plugins/
29+ ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/grafana-datasource/releases/latest | grep -oE 'v[0-9]+\\ .[0-9]+\\ .[0-9]+' | head -1)
30+ curl -L https://github.com/VictoriaMetrics/grafana-datasource/releases/download/$ver/victoriametrics-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/plugin.tar.gz
31+ tar -xf /var/lib/grafana/plugins/plugin.tar.gz -C /var/lib/grafana/plugins/
32+ rm /var/lib/grafana/plugins/plugin.tar.gz
33+ """
34+
2635#StatefulSetList : items : [{
2736 spec : {
2837 selector : matchLabels : " app.kubernetes.io/name " : #Name
@@ -57,6 +66,27 @@ let downloadVictoriaLogsPluginScript = """
5766 readOnlyRootFilesystem : true
5867 allowPrivilegeEscalation : false
5968 }
69+ }, {
70+ // https://github.com/VictoriaMetrics/grafana-datasource/blob/5b8a0ba190e116bdebfdb51d11b4e0d03d86d766/README.md
71+ name : " download-victoria-metrics-plugin "
72+ image : " curlimages/curl:8.7.1 "
73+ command : [" /bin/sh " ]
74+ args : [" -c " , downloadVictoriaMetricsPluginScript ]
75+ workingDir : " /var/lib/grafana "
76+ resources : limits : {
77+ (v1 .#ResourceCPU ): " 1 "
78+ (v1 .#ResourceMemory ): " 1Gi "
79+ }
80+ volumeMounts : [{
81+ name : " data "
82+ mountPath : " /var/lib/grafana "
83+ }]
84+ imagePullPolicy : v1 .#PullIfNotPresent
85+ securityContext : {
86+ capabilities : drop : [" ALL " ]
87+ readOnlyRootFilesystem : true
88+ allowPrivilegeEscalation : false
89+ }
6090 }]
6191 containers : [{
6292 name : " grafana "
@@ -115,9 +145,9 @@ let downloadVictoriaLogsPluginScript = """
115145 }
116146 }]
117147 securityContext : {
118- runAsUser : 1000
119- runAsGroup : 3000
120- runAsNonRoot : true
148+ runAsUser : 1000
149+ runAsGroup : 3000
150+ runAsNonRoot : true
121151 fsGroup : 2000
122152 fsGroupChangePolicy : v1 .#FSGroupChangeOnRootMismatch
123153 seccompProfile : type : v1 .#SeccompProfileTypeRuntimeDefault
0 commit comments