Fixed compatibility issues with grafana-operator (#23)

This commit is contained in:
Richard Tippl 2022-01-04 11:01:11 +01:00 committed by GitHub
parent 2d35dc3577
commit 608c95109d
2 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,7 @@ function is_exec() {
print_welcome_page
if [[ "$1" = "/opt/bitnami/scripts/grafana/run.sh" ]]; then
if [[ "$1" = "/opt/bitnami/scripts/grafana/run.sh" ]] || ! is_exec "$1"; then
# This catches the error-code from libgrafana.sh for the immediate exit when the grafana-operator is used. And ensure that the exit code is kept silently.
/opt/bitnami/scripts/grafana/setup.sh || GRAFANA_OPERATOR_IMMEDIATE_EXIT=$?
if [[ "${GRAFANA_OPERATOR_IMMEDIATE_EXIT:-0}" -eq 255 ]]; then

View File

@ -23,12 +23,18 @@ info "Creating system user"
ensure_user_exists "$GRAFANA_DAEMON_USER" --group "$GRAFANA_DAEMON_GROUP" --system
info "Configuring file permissions"
for dir in "$(grafana_env_var_value PATHS_DATA)" "$(grafana_env_var_value PATHS_LOGS)" "$(grafana_env_var_value PATHS_PLUGINS)"; do
for dir in "$(grafana_env_var_value PATHS_DATA)" "$(grafana_env_var_value PATHS_LOGS)" "$(grafana_env_var_value PATHS_PLUGINS)" "$(grafana_env_var_value PATHS_PROVISIONING)"; do
ensure_dir_exists "$dir"
# Use grafana:root ownership for compatibility when running as a non-root user
configure_permissions_ownership "$dir" -d "775" -f "664" -u "$GRAFANA_DAEMON_USER" -g "root"
done
# Ensure permissions to parent directories of configs
# Used when replacing configs with symlinks for grafana-operator compatibility
for dir in "$(grafana_env_var_value PATHS_CONFIG)" "$(grafana_env_var_value PATHS_DATA)" "$(grafana_env_var_value PATHS_LOGS)" "$(grafana_env_var_value PATHS_PROVISIONING)"; do
chmod 775 "$(dirname "$dir")"
done
# Install well-known plugins
grafana_plugin_list=(
"grafana-clock-panel"