Skip to content

Commit 69b4e03

Browse files
authored
fix(grafana): tmp dir permissions for plugin installation in grafana v12.4.0+ (#2574)
* fix(grafana): add emptyDir for tmp * chore(grafana): deprecate TMPDIR env
1 parent d96e43b commit 69b4e03

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

controllers/config/operator_constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const (
1010
GrafanaLogsPath = "/var/log/grafana"
1111
GrafanaPluginsPath = "/var/lib/grafana/plugins"
1212
GrafanaProvisioningPath = "/etc/grafana/provisioning/"
13+
GrafanaTmpPath = "/tmp"
1314
GrafanaDashboardsRuntimeBuild = "/tmp/dashboards"
1415

1516
// Default limits
@@ -40,6 +41,7 @@ const (
4041
GrafanaProvisionNotifierVolumeName = "grafana-provision-notifiers"
4142
GrafanaLogsVolumeName = "grafana-logs"
4243
GrafanaDataVolumeName = "grafana-data"
44+
GrafanaTmpVolumeName = "grafana-tmp"
4345
SecretsMountDir = "/etc/grafana-secrets/" // #nosec G101
4446
ConfigMapsMountDir = "/etc/grafana-configmaps/"
4547
)

controllers/reconcilers/grafana/deployment_reconciler.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ func getVolumes(cr *v1beta1.Grafana, scheme *runtime.Scheme) []corev1.Volume {
120120
EmptyDir: &corev1.EmptyDirVolumeSource{},
121121
},
122122
},
123+
{
124+
Name: config.GrafanaTmpVolumeName,
125+
VolumeSource: corev1.VolumeSource{
126+
EmptyDir: &corev1.EmptyDirVolumeSource{},
127+
},
128+
},
123129
}
124130

125131
return volumes
@@ -142,6 +148,10 @@ func getVolumeMounts(cr *v1beta1.Grafana, scheme *runtime.Scheme) []corev1.Volum
142148
Name: config.GrafanaLogsVolumeName,
143149
MountPath: config.GrafanaLogsPath,
144150
},
151+
{
152+
Name: config.GrafanaTmpVolumeName,
153+
MountPath: config.GrafanaTmpPath,
154+
},
145155
}
146156

147157
return mounts
@@ -173,11 +183,6 @@ func getContainers(cr *v1beta1.Grafana, scheme *runtime.Scheme, vars *v1beta1.Op
173183
Name: "GF_INSTALL_PLUGINS",
174184
Value: vars.Plugins,
175185
},
176-
{
177-
// sets location where temporary files can be written (e.g. plugin downloads)
178-
Name: "TMPDIR",
179-
Value: config.GrafanaDataPath,
180-
},
181186
{
182187
// useful for unified alerting gossiping in HA-enabled setups
183188
Name: "POD_IP",

0 commit comments

Comments
 (0)