From 2695030b5b5df4d529634f3c597861e56aa9eb33 Mon Sep 17 00:00:00 2001 From: mtlljm Date: Tue, 5 Dec 2023 15:26:28 +0000 Subject: [PATCH] (ESPSTUDIO-8275) Plugin deployment option for different namespaces on Viya twaek it so that the user can pass the optional grafana namespace, if it differs from the esp namespace Change-Id: I4f588fb75b94e45e96bc24d126460c2e916541e0 --- README.md | 16 +++++++--------- install/configure-grafana.sh | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b3b3aa3..1e26d68 100644 --- a/README.md +++ b/README.md @@ -99,21 +99,19 @@ Installation scripts are provided to install the plug-in and configure Grafana. ``` export DRY_RUN=true ``` -4. (Optional) Set an environment variable to set the namespace in which Grafana is installed, if this differs from the namespace in which SAS Event Stream Processing is installed. - ``` - export GRAFANA_NAMESPACE=grafana - ``` -5. Run `configure-grafana.sh`, adjusting the command to specify the following variables: - - The Kubernetes _namespace_ in which SAS Event Stream Processing is installed. + +4. Run `configure-grafana.sh`, adjusting the command to specify the following variables: + - The Kubernetes _esp-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. - The _oauth-provider_ of the environment. Select one of the following options: `uaa`, `keycloak` or `viya`. + - (Optional) The Kubernetes namespace in which Grafana is installed, _grafana-namespace_ if this differs from the namespace in which SAS Event Stream Processing is installed. > **Caution**: Running the installation script might overwrite any existing Grafana configuration. ``` cd ./install - bash configure-grafana.sh + bash configure-grafana.sh ``` -6. Run one of the following three scripts, depending on your chosen OAuth provider. Adjust the command to specify the following variables. +5. Run one of the following three scripts, depending on your chosen OAuth provider. Adjust the command to specify the following variables. - The Kubernetes namespace in which SAS Event Stream Processing is installed, _esp-namespace_. - (Optional) The Kubernetes namespace in which Grafana is installed, _grafana-namespace_ if this differs from the namespace in which SAS Event Stream Processing is installed. ``` @@ -125,7 +123,7 @@ Installation scripts are provided to install the plug-in and configure Grafana. ``` bash register-oauth-client-viya.sh ``` -7. If your OAuth provider is the SAS Viya platform and Grafana is not running in the same namespace as the SAS Viya platform, you must update the Content Security Policy (CSP) for SAS Logon to allow the Grafana host name to be used as a target of form submission. +6. If your OAuth provider is the SAS Viya platform and Grafana is not running in the same namespace as the SAS Viya platform, you must update the Content Security Policy (CSP) for SAS Logon to allow the Grafana host name to be used as a target of form submission. If you do not update the CSP, the browser blocks the redirect. You can update the CSP in one of the following two ways: - Use SAS Environment Manager to update the _content-security-policy_ value under the _sas.commons.web.security_ section. - Update the _sas-logon-app_ deployment to add the _SAS_COMMONS_WEB_SECURITY_CONTENTSECURITYPOLICY_ environment variable. diff --git a/install/configure-grafana.sh b/install/configure-grafana.sh index 6d576c0..f2308c0 100644 --- a/install/configure-grafana.sh +++ b/install/configure-grafana.sh @@ -6,6 +6,7 @@ set -e -o pipefail -o nounset ESP_NAMESPACE="${1}"; export ESP_NAMESPACE ESP_PLUGIN_VERSION="${2}" OAUTH_TYPE="${3:-uaa}" +GRAFANA_NAMESPACE="${4:-${ESP_NAMESPACE}}" #optional environment variables - exported for use in other scripts OAUTH_CLIENT_ID="${OAUTH_CLIENT_ID:-sv_client}"; export OAUTH_CLIENT_ID @@ -16,7 +17,6 @@ KEYCLOAK_SUBPATH="${KEYCLOAK_SUBPATH:-auth}"; export KEYCLOAK_SUBPATH DRY_RUN="${DRY_RUN:-false}" INSTALL_GRAFANA="${INSTALL_GRAFANA:-false}" GRAFANA_VERSION="${GRAFANA_VERSION:-9.5.13}" -GRAFANA_NAMESPACE="${GRAFANA_NAMESPACE:-${ESP_NAMESPACE}}" function check_requirements() { [ -z "$KUBECONFIG" ] && {