Skip to content

Commit

Permalink
(ESPSTUDIO-8126) Update README to clarfiy how we integrate Grafana wi…
Browse files Browse the repository at this point in the history
…th sas (#2)

(ESPSTUDIO-8126) Update README to clarfiy how we integrate Grafana with SAS
Add a dry run option to the installation scripts
  • Loading branch information
mtlljm authored Nov 8, 2023
1 parent 9991495 commit ad4e83c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ Here is an example of a Grafana dashboard for an ESP project. This dashboard rel

## Install a Released Version of the Plug-in

Use the provided installation script to install the plug-in:
An installation script is provided to install the plug-in and configure Grafana. The installation script performs the following tasks:
* Modifies the Grafana deployment by adding the GF_INSTALL_PLUGINS environment variable to enable Grafana to install the plug-in.
* Configures a new `grafana.ini` file to enable OAuth authentication.
* Configures Grafana as an OAuth client with the supported OAuth provider (UAA). Users of Grafana are directed to use the OAuth login page.
* Optionally installs Grafana for you.

Use the installation script to install the plug-in:

1. Set the correct Kubernetes configuration file for your environment.
```
Expand All @@ -28,8 +34,12 @@ Use the provided installation script to install the plug-in:
2. (Optional) Set an environment variable to enable the script to install Grafana for you.
```
export INSTALL_GRAFANA=true
3. (Optional) Set an environment variable to run the script as a dry run to see the resulting configuration and apply the settings manually.
```
export DRY_RUN=true
```
3. Run the installation script, adjusting the command to specify the following variables:
4. Run the installation script, adjusting the command to specify the following variables:
- The Kubernetes _namespace_ in which SAS Event Stream Processing is installed.
- The _version_ of the plug-in that you want to install. Ensure that you specify a version of the plug-in that is compatible with your version of Grafana.
> **Caution**: Running the installation script might overwrite any existing Grafana configuration.
Expand Down
15 changes: 13 additions & 2 deletions install/configure-grafana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ ESP_NAMESPACE="${1}"
ESP_PLUGIN_SOURCE="${2}"
export ESP_PLUGIN_SOURCE

DRY_RUN="${DRY_RUN:-false}"
INSTALL_GRAFANA="${INSTALL_GRAFANA:-false}"

# Fetch access token to perform admin tasks:
function fetch_uaa_admin_token() {
_resp=$(curl "https://${ESP_DOMAIN}/uaa/oauth/token" -s -k -X POST \
Expand Down Expand Up @@ -102,9 +105,17 @@ find ./manifests/ -type f -name "*.yaml" -exec perl -pi -e 's/\QTEMPLATE_OAUTH_C
find ./manifests/ -type f -name "*.yaml" -exec perl -pi -e 's/\QTEMPLATE_OAUTH_CLIENT_SECRET/$ENV{"OAUTH_CLIENT_SECRET"}/g' '{}' +
find ./manifests/ -type f -name "*.yaml" -exec perl -pi -e 's/\QTEMPLATE_ESP_PLUGIN_SOURCE/$ENV{"ESP_PLUGIN_SOURCE"}/g' '{}' +

if [[ "${INSTALL_GRAFANA}" ]]; then
echo "Installing grafana"
if [[ "${DRY_RUN}" == true ]]; then
echo "Dry run specified. Printing manifests to be applied:"
echo "./manifests/config-map.yaml"
cat ./manifests/config-map.yaml
echo "./manifests/patch-grafana.yaml"
cat ./manifests/patch-grafana.yaml
exit 0
fi

if [[ "${INSTALL_GRAFANA}" == true ]]; then
echo "Installing grafana"
kubectl -n "${ESP_NAMESPACE}" apply -f ./manifests/grafana.yaml
fi

Expand Down

0 comments on commit ad4e83c

Please sign in to comment.