From 0ab7f68cd77ed5bf7d0b118dcf9ce78b4aa62095 Mon Sep 17 00:00:00 2001 From: Luan Gazin Date: Wed, 26 Jan 2022 22:59:42 -0300 Subject: [PATCH 1/8] create a script for gitlab operations --- vkpr/aws/eks/init/build.sh | 5 +- vkpr/aws/eks/init/src/main.sh | 2 + vkpr/aws/eks/init/src/unix/formula/formula.sh | 70 +++------------ vkpr/utils/gitlab-parameter-operations.sh | 90 +++++++++++++++++++ 4 files changed, 107 insertions(+), 60 deletions(-) create mode 100755 vkpr/utils/gitlab-parameter-operations.sh diff --git a/vkpr/aws/eks/init/build.sh b/vkpr/aws/eks/init/build.sh index 3f067481..1f38e6c7 100755 --- a/vkpr/aws/eks/init/build.sh +++ b/vkpr/aws/eks/init/build.sh @@ -4,8 +4,11 @@ BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +BIN_GITLAB_OPERATION=../../../utils/gitlab-parameter-operations.sh + #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/utils + cp $BIN_GITLAB_OPERATION $BIN_FOLDER/utils cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX diff --git a/vkpr/aws/eks/init/src/main.sh b/vkpr/aws/eks/init/src/main.sh index cf647088..d15b2e29 100755 --- a/vkpr/aws/eks/init/src/main.sh +++ b/vkpr/aws/eks/init/src/main.sh @@ -6,6 +6,8 @@ source $VKPR_SCRIPTS/log.sh source $VKPR_SCRIPTS/var.sh source $VKPR_SCRIPTS/helper.sh +source "$(dirname "$0")"/utils/gitlab-parameter-operations.sh + # shellcheck source=/dev/null . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/aws/eks/init/src/unix/formula/formula.sh b/vkpr/aws/eks/init/src/unix/formula/formula.sh index a6495b2e..afef3750 100755 --- a/vkpr/aws/eks/init/src/unix/formula/formula.sh +++ b/vkpr/aws/eks/init/src/unix/formula/formula.sh @@ -22,69 +22,21 @@ runFormula() { setVariablesGLAB - createBranch $EKS_CLUSTER_NAME + createBranch $PROJECT_ID $EKS_CLUSTER_NAME $GITLAB_TOKEN } ## Set all input into Gitlab environments setVariablesGLAB() { - [[ $TERRAFORM_STATE == "Terraform Cloud" ]] && createOrUpdateVariable "TF_CLOUD_TOKEN" $TF_CLOUD_TOKEN "yes" - createOrUpdateVariable "AWS_ACCESS_KEY" $AWS_ACCESS_KEY "yes" - createOrUpdateVariable "AWS_SECRET_KEY" $AWS_SECRET_KEY "yes" - createOrUpdateVariable "AWS_REGION" $AWS_REGION "no" - createOrUpdateVariable "EKS_CLUSTER_NAME" $EKS_CLUSTER_NAME "no" - createOrUpdateVariable "EKS_CLUSTER_NODE_INSTANCE_TYPE" $EKS_CLUSTER_NODE_INSTANCE_TYPE "no" - createOrUpdateVariable "EKS_K8S_VERSION" "$EKS_K8S_VERSION" "no" - createOrUpdateVariable "EKS_CLUSTER_SIZE" "$EKS_CLUSTER_SIZE" "no" - createOrUpdateVariable "EKS_CAPACITY_TYPE" "$EKS_CAPACITY_TYPE" "no" + [[ $TERRAFORM_STATE == "Terraform Cloud" ]] && + createOrUpdateVariable $PROJECT_ID "TF_CLOUD_TOKEN" $TF_CLOUD_TOKEN "yes" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "AWS_ACCESS_KEY" $AWS_ACCESS_KEY "yes" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "AWS_SECRET_KEY" $AWS_SECRET_KEY "yes" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "AWS_REGION" $AWS_REGION "no" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "EKS_CLUSTER_NAME" $EKS_CLUSTER_NAME "no" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "EKS_CLUSTER_NODE_INSTANCE_TYPE" $EKS_CLUSTER_NODE_INSTANCE_TYPE "no" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "EKS_K8S_VERSION" "$EKS_K8S_VERSION" "no" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "EKS_CLUSTER_SIZE" "$EKS_CLUSTER_SIZE" "no" $EKS_CLUSTER_NAME $GITLAB_TOKEN + createOrUpdateVariable $PROJECT_ID "EKS_CAPACITY_TYPE" "$EKS_CAPACITY_TYPE" "no" $EKS_CLUSTER_NAME $GITLAB_TOKEN } -## Create a new variable setting cluster-name as environment -## If var already exist, just update your value -createOrUpdateVariable(){ - # echo "VARIABLE $1 = $2" - local VARIABLE_RESPONSE_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables" \ - --form "key=$1" --form "value=$2" --form "masked=$3" --form "environment_scope=$EKS_CLUSTER_NAME" | head -n 1 | awk -F' ' '{print $2}') - # echo "VARIABLE_RESPONSE_CODE = $VARIABLE_RESPONSE_CODE" - - if [ $VARIABLE_RESPONSE_CODE = 201 ];then - echoColor yellow "Variable $1 created into ${EKS_CLUSTER_NAME} environment" - elif [ $VARIABLE_RESPONSE_CODE = 400 ];then - # echoColor yellow "Variable $1 already exists, updating..." - updateVariable $@ - else - echoColor red "Something wrong while saving $1" - fi - -} - -## Update gitlab variable -updateVariable(){ - local UPDATE_CODE=$(curl -s -i --request PUT --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables/${1}?filter\[environment_scope\]=${EKS_CLUSTER_NAME}" \ - --form "value=$2" --form "masked=$3" | head -n 1 | awk -F' ' '{print $2}') - # echo "UPDATE_CODE= $UPDATE_CODE" - if [ $UPDATE_CODE = 200 ];then - echoColor green "$1 updated" - else - echoColor red "error while updating $1, $UPDATE_CODE" - fi -} - -## Create a new branch using eks-cluster-name as branch's name, or just start a new pipeline -createBranch(){ - echoColor green "Creating branch named $1 or justing starting a new pipeline" - # echo "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$1&ref=master" - local CREATE_BRANCH_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$1&ref=master" | head -n 1 | awk -F' ' '{print $2}') - # echo "CREATE_BRANCH_CODE: $CREATE_BRANCH_CODE" - - if [ $CREATE_BRANCH_CODE = 400 ];then - createPipeline $1 - fi -} - -## create a new pipeline -createPipeline(){ - RESPONSE_PIPE=$(curl -s --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/pipeline?ref=$1") - # echo "RESPONSE_PIPE: $RESPONSE_PIPE" - echoColor green "Pipeline url: $(echo $RESPONSE_PIPE | $VKPR_JQ -r '.web_url')" -} \ No newline at end of file diff --git a/vkpr/utils/gitlab-parameter-operations.sh b/vkpr/utils/gitlab-parameter-operations.sh new file mode 100755 index 00000000..bdeb4412 --- /dev/null +++ b/vkpr/utils/gitlab-parameter-operations.sh @@ -0,0 +1,90 @@ + +## Create a new variable setting cluster-name as environment +## If var already exist, just update your value +# Parameters: +# 1 - PROJECT_ID +# 2 - PARAMETER_KEY +# 3 - PARAMETER_VALUE +# 4 - PARAMETER_MASKED +# 5 - ENVIRONMENT_SCOPE +# 6 - GITLAB_TOKEN +createOrUpdateVariable(){ + local PROJECT_ID=$1 + local PARAMETER_KEY=$2 + local PARAMETER_VALUE=$3 + local PARAMETER_MASKED=$4 + local ENVIRONMENT_SCOPE=$5 + local GITLAB_TOKEN=$6 + + local VARIABLE_RESPONSE_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables" \ + --form "key=$PARAMETER_KEY" --form "value=$PARAMETER_VALUE" --form "masked=$PARAMETER_MASKED" --form "environment_scope=$ENVIRONMENT_SCOPE" | head -n 1 | awk -F' ' '{print $2}') + # echo "VARIABLE_RESPONSE_CODE = $VARIABLE_RESPONSE_CODE" + + if [ $VARIABLE_RESPONSE_CODE = 201 ];then + echoColor yellow "Variable $PARAMETER_KEY created into ${EKS_CLUSTER_NAME} environment" + elif [ $VARIABLE_RESPONSE_CODE = 400 ];then + # echoColor yellow "Variable $PARAMETER_KEY already exists, updating..." + updateVariable $@ + else + echoColor red "Something wrong while saving $PARAMETER_KEY" + fi + +} + + +## Update gitlab variable +# Parameters: +# 1 - PROJECT_ID +# 2 - PARAMETER_KEY +# 3 - PARAMETER_VALUE +# 4 - PARAMETER_MASKED +# 5 - ENVIRONMENT_SCOPE +# 6 - GITLAB_TOKEN +updateVariable(){ + local PROJECT_ID=$1 + local PARAMETER_KEY=$2 + local PARAMETER_VALUE=$3 + local PARAMETER_MASKED=$4 + local ENVIRONMENT_SCOPE=$5 + local GITLAB_TOKEN=$6 + + local UPDATE_CODE=$(curl -s -i --request PUT --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables/${PARAMETER_KEY}?filter\[environment_scope\]=${ENVIRONMENT_SCOPE}" \ + --form "value=$PARAMETER_VALUE" --form "masked=$PARAMETER_MASKED" | head -n 1 | awk -F' ' '{print $2}') + # echo "UPDATE_CODE= $UPDATE_CODE" + if [ $UPDATE_CODE = 200 ];then + echoColor green "$PARAMETER_KEY updated" + else + echoColor red "error while updating $PARAMETER_KEY, $UPDATE_CODE" + fi +} + + +## Create a new branch using eks-cluster-name as branch's name, or just start a new pipeline +# Parameters: +# 1 - PROJECT_ID +# 2 - BRANCH_NAME +# 3 - GITLAB_TOKEN +createBranch(){ + local PROJECT_ID=$1 + local BRANCH_NAME=$2 + local GITLAB_TOKEN=$3 + + echoColor green "Creating branch named $BRANCH_NAME or justing starting a new pipeline" + # echo "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$1&ref=master" + local CREATE_BRANCH_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$BRANCH_NAME&ref=master" | head -n 1 | awk -F' ' '{print $2}') + # echo "CREATE_BRANCH_CODE: $CREATE_BRANCH_CODE" + + if [ $CREATE_BRANCH_CODE = 400 ];then + createPipeline $@ + fi +} + +## create a new pipeline +createPipeline(){ + local PROJECT_ID=$1 + local BRANCH_NAME=$2 + local GITLAB_TOKEN=$3 + local RESPONSE_PIPE=$(curl -s --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/pipeline?ref=$BRANCH_NAME") + # echo "RESPONSE_PIPE: $RESPONSE_PIPE" + echoColor green "Pipeline url: $(echo $RESPONSE_PIPE | $VKPR_JQ -r '.web_url')" +} From 2283b3ba5b9bc92ea1962714dc0d84edd88e51f4 Mon Sep 17 00:00:00 2001 From: Luan Gazin Date: Wed, 26 Jan 2022 23:02:20 -0300 Subject: [PATCH 2/8] create gitlab parameter add --- vkpr/gitlab/parameter/add/README.md | 1 + vkpr/gitlab/parameter/add/build.sh | 14 +++++ vkpr/gitlab/parameter/add/config.json | 58 +++++++++++++++++++ vkpr/gitlab/parameter/add/help.json | 4 ++ vkpr/gitlab/parameter/add/metadata.json | 18 ++++++ vkpr/gitlab/parameter/add/src/main.sh | 13 +++++ .../parameter/add/src/unix/formula/formula.sh | 15 +++++ 7 files changed, 123 insertions(+) create mode 100755 vkpr/gitlab/parameter/add/README.md create mode 100755 vkpr/gitlab/parameter/add/build.sh create mode 100755 vkpr/gitlab/parameter/add/config.json create mode 100644 vkpr/gitlab/parameter/add/help.json create mode 100755 vkpr/gitlab/parameter/add/metadata.json create mode 100755 vkpr/gitlab/parameter/add/src/main.sh create mode 100755 vkpr/gitlab/parameter/add/src/unix/formula/formula.sh diff --git a/vkpr/gitlab/parameter/add/README.md b/vkpr/gitlab/parameter/add/README.md new file mode 100755 index 00000000..8b137891 --- /dev/null +++ b/vkpr/gitlab/parameter/add/README.md @@ -0,0 +1 @@ + diff --git a/vkpr/gitlab/parameter/add/build.sh b/vkpr/gitlab/parameter/add/build.sh new file mode 100755 index 00000000..1f38e6c7 --- /dev/null +++ b/vkpr/gitlab/parameter/add/build.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +BIN_FOLDER=bin +BINARY_NAME_UNIX=run.sh +ENTRY_POINT_UNIX=main.sh + +BIN_GITLAB_OPERATION=../../../utils/gitlab-parameter-operations.sh + +#bash-build: + mkdir -p $BIN_FOLDER/utils + cp $BIN_GITLAB_OPERATION $BIN_FOLDER/utils + cp -r src/* $BIN_FOLDER + mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX diff --git a/vkpr/gitlab/parameter/add/config.json b/vkpr/gitlab/parameter/add/config.json new file mode 100755 index 00000000..506eeda6 --- /dev/null +++ b/vkpr/gitlab/parameter/add/config.json @@ -0,0 +1,58 @@ +{ + "inputs": [ + { + "label": "Gitlab Project Name:", + "name": "project_name", + "type": "text", + "cache": { + "active": true, + "qty": 10, + "newLabel": "Type another gitlab project name: " + } + }, + { + "label": "Parameter Name:", + "name": "parameter_name", + "type": "text", + "required": true + }, + { + "label": "Parameter Value:", + "name": "parameter_value", + "type": "text", + "required": true + }, + { + "label": "Parameter Masked:", + "name": "parameter_masked", + "type": "bool", + "default": "false", + "items": [ + "true", + "false" + ], + "required": true + }, + { + "label": "Environment Scope:", + "name": "environment_scope", + "type": "text", + "required": true, + "cache": { + "active": true, + "qty": 4, + "newLabel": "Type another environment scope: " + } + }, + { + "name": "gitlab_username", + "type": "CREDENTIAL_GITLAB_USERNAME" + }, + { + "name": "gitlab_token", + "type": "CREDENTIAL_GITLAB_TOKEN" + } + ], + "template": "shell-bat", + "templateRelease": "{tag}" +} \ No newline at end of file diff --git a/vkpr/gitlab/parameter/add/help.json b/vkpr/gitlab/parameter/add/help.json new file mode 100644 index 00000000..cef6e9b6 --- /dev/null +++ b/vkpr/gitlab/parameter/add/help.json @@ -0,0 +1,4 @@ +{ + "short": "Add parameter to gitlab CI/CD pipeline", + "long": "" +} diff --git a/vkpr/gitlab/parameter/add/metadata.json b/vkpr/gitlab/parameter/add/metadata.json new file mode 100755 index 00000000..dcc2aabf --- /dev/null +++ b/vkpr/gitlab/parameter/add/metadata.json @@ -0,0 +1,18 @@ +{ + "execution": [ + "local" + ], + "os": { + "deps": [], + "support": [ + "mac", + "linux" + ] + }, + "tags": [ + "vkpr", + "gitlab", + "parameter", + "add" + ] +} diff --git a/vkpr/gitlab/parameter/add/src/main.sh b/vkpr/gitlab/parameter/add/src/main.sh new file mode 100755 index 00000000..e2c1f563 --- /dev/null +++ b/vkpr/gitlab/parameter/add/src/main.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +VKPR_SCRIPTS=~/.vkpr/src + +source $VKPR_SCRIPTS/log.sh +source $VKPR_SCRIPTS/var.sh +source $VKPR_SCRIPTS/helper.sh + +source "$(dirname "$0")"/utils/gitlab-parameter-operations.sh + +. "$(dirname "$0")"/unix/formula/formula.sh --source-only + +runFormula diff --git a/vkpr/gitlab/parameter/add/src/unix/formula/formula.sh b/vkpr/gitlab/parameter/add/src/unix/formula/formula.sh new file mode 100755 index 00000000..f1123b43 --- /dev/null +++ b/vkpr/gitlab/parameter/add/src/unix/formula/formula.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +runFormula() { + PROJECT_ID=$(rawUrlEncode "$GITLAB_USERNAME/${PROJECT_NAME}") + echoColor blue "Creating new parameter ${PARAMETER_NAME}" + # echo "Hello World! ${PROJECT_ID}" + # echo ${PROJECT_NAME} + # echo ${PARAMETER_NAME} + # echo ${PARAMETER_VALUE} + # echo ${PARAMETER_MASKED} + # echo ${ENVIRONMENT_SCOPE} + # echo $(cat ./utils/gitlab-parameter-operations.sh) + createOrUpdateVariable $PROJECT_ID $PARAMETER_NAME $PARAMETER_VALUE $PARAMETER_MASKED $ENVIRONMENT_SCOPE $GITLAB_TOKEN +} + \ No newline at end of file From a7b7e9c6507f4815632ff2b594ac01472a09b5dc Mon Sep 17 00:00:00 2001 From: Jpeedroza Date: Tue, 8 Feb 2022 10:53:52 -0300 Subject: [PATCH 3/8] updated formula apply and fix formula bugs --- vkpr/apply/config.json | 4 +- vkpr/apply/src/unix/formula/formula.sh | 231 +- vkpr/argocd/install/config.json | 11 - .../install/src/unix/formula/formula.sh | 13 +- vkpr/aws/eks/tfc/src/unix/formula/formula.sh | 2 +- vkpr/cert-manager/install/config.json | 2 +- .../install/src/unix/formula/formula.sh | 29 +- .../install/src/unix/formula/formula.sh | 1 + vkpr/external-dns/install/config.json | 1 - .../install/src/unix/formula/formula.sh | 25 +- vkpr/infra/start/src/unix/formula/formula.sh | 4 +- vkpr/infra/up/src/unix/formula/formula.sh | 2 +- vkpr/init/src/utils/validate.sh | 2 +- .../install/src/unix/formula/formula.sh | 2 +- vkpr/keycloak/install/src/utils/realm.json | 2288 ----------------- vkpr/kong/install/config.json | 5 + vkpr/kong/install/src/unix/formula/formula.sh | 16 +- vkpr/loki/install/src/unix/formula/formula.sh | 4 +- .../install/src/unix/formula/formula.sh | 28 +- 19 files changed, 193 insertions(+), 2477 deletions(-) delete mode 100644 vkpr/keycloak/install/src/utils/realm.json diff --git a/vkpr/apply/config.json b/vkpr/apply/config.json index 421c1164..0ff56437 100755 --- a/vkpr/apply/config.json +++ b/vkpr/apply/config.json @@ -1,8 +1,8 @@ { "inputs": [ { - "label": "Path to config file: ", - "name": "pathtofile", + "label": "Path to config file:", + "name": "path_to_file", "required": true, "type": "text" } diff --git a/vkpr/apply/src/unix/formula/formula.sh b/vkpr/apply/src/unix/formula/formula.sh index 28ea2e48..007f10fc 100755 --- a/vkpr/apply/src/unix/formula/formula.sh +++ b/vkpr/apply/src/unix/formula/formula.sh @@ -1,159 +1,186 @@ #!/bin/sh -runFormula() { - VKPR_GLOBAL_CONFIG=$CURRENT_PWD/vkpr.yaml + runFormula() { + [[ ! -f $PATH_TO_FILE ]] && echoColor "red" "Wrong file" && exit + cp $PATH_TO_FILE "$(dirname "$0")" + VKPR_GLOBAL_CONFIG="$(dirname "$0")"/vkpr.yaml - checkIfFileExists $PATHTOFILE applyConfig - -} - -checkIfFileExists(){ - FILE=$1 - if [[ -f "$FILE" ]]; then - cp $FILE $VKPR_GLOBAL_CONFIG - else - echoColor "red" "Wrong file!" - exit 1 - fi } applyConfig(){ #Order matters in this part! -#1 - installIngress +#0 + infraUp -#2 - installWhoami +#1 + installLoki + +#2 + installPrometheusGrafana #3 - installCertManagerDO + installPostgres #4 - installExternalDNS + installKong #5 - installPostgres + installIngress #6 - installKeycloak + installExternalDNS #7 - installPrometheusGrafana + installCertManager #8 - installLoki + installConsul + +#9 + installVault +#10 + installKeycloak + +#11 + installArgoCD + +#12 + installWhoami } -installIngress(){ - INGRESSEXISTS=$($VKPR_YQ eval .global.ingress.enabled $VKPR_GLOBAL_CONFIG) - if [ "$INGRESSEXISTS" = true ]; then - rit vkpr ingress install +installArgoCD(){ + ARGO_EXISTS=$($VKPR_YQ eval .global.argocd.enabled $VKPR_GLOBAL_CONFIG) + if [ "$ARGO_EXISTS" = true ]; then + rit vkpr argocd install --default fi - } -installWhoami(){ - WHOAMIEXISTS=$($VKPR_YQ eval .global.whoami.enabled $VKPR_GLOBAL_CONFIG) - if [ "$WHOAMIEXISTS" = true ]; then - checkGlobalConfig $DOMAIN "localhost" "domain" "DOMAIN" - rit vkpr whoami install --default +installCertManager(){ + local CERT_MANAGER_EXISTS=$($VKPR_YQ eval .global.cert-manager.enabled $VKPR_GLOBAL_CONFIG) + if [ "$CERT_MANAGER_EXISTS" = true ]; then + local CERT_MANAGER_PROVIDER=$($VKPR_YQ eval .global.cert-manager.provider $VKPR_GLOBAL_CONFIG) + local CERT_MANAGER_SOLVER=$($VKPR_YQ eval .global.cert-manager.solver $VKPR_GLOBAL_CONFIG) + [[ $CERT_MANAGER_SOLVER = "HTTP01" ]] && CERT_MANAGER_PROVIDER="" + local AVAILABLE_CERT_MANAGER_HOSTEDZONE="" + case $CERT_MANAGER_PROVIDER in + aws) + local CERT_MANAGER_ACCESS_KEY=$($VKPR_YQ eval .global.cert-manager.aws.accessKey $VKPR_GLOBAL_CONFIG) + local CERT_MANAGER_SECRET_KEY=$($VKPR_YQ eval .global.cert-manager.aws.secretKey $VKPR_GLOBAL_CONFIG) + local CERT_MANAGER_REGION=$($VKPR_YQ eval .global.cert-manager.aws.region $VKPR_GLOBAL_CONFIG) + AVAILABLE_CERT_MANAGER_HOSTEDZONE="--cloud_provider aws --aws_hostedzone_id=$($VKPR_YQ eval .global.cert-manager.aws.hostedZoneID $VKPR_GLOBAL_CONFIG)" + rit set credential --provider="aws" \ + --fields="accesskeyid,secretaccesskey,region" \ + --values="$CERT_MANAGER_ACCESS_KEY,$CERT_MANAGER_SECRET_KEY,$CERT_MANAGER_REGION" + ;; + digitalocean) + local CERT_MANAGER_API_TOKEN=$($VKPR_YQ eval .global.cert-manager.digitalocean.apiToken $VKPR_GLOBAL_CONFIG) + rit set credential --provider="digitalocean" --fields="token" --values="$CERT_MANAGER_API_TOKEN" + ;; + esac + rit vkpr cert-manager install --issuer_solver $CERT_MANAGER_SOLVER $AVAILABLE_CERT_MANAGER_HOSTEDZONE --default fi } -installExternalDNS(){ - PROVIDER_=$($VKPR_YQ eval .global.external-dns.provider $VKPR_GLOBAL_CONFIG) - case $PROVIDER_ in - digitalocean) - installExternalDNSDO - ;; - aws) - installExternalDNSAWS - ;; - PowerDNS) - echoColor "red" "PowerDns in Apply fomula is a working in progress." - ;; - esac +installConsul(){ + CONSUL_EXISTS=$($VKPR_YQ eval .global.consul.enabled $VKPR_GLOBAL_CONFIG) + if [ "$CONSUL_EXISTS" = true ]; then + rit vkpr consul install --default + fi } -installCertManagerDO(){ - CERTMANAGEREXISTS=$($VKPR_YQ eval .global.cert-manager.enabled $VKPR_GLOBAL_CONFIG) - if [ "$CERTMANAGEREXISTS" = true ]; then - DO_CREDENTIAL=$($VKPR_YQ eval .global.cert-manager.provider.digitalocean.digitalocean_token $VKPR_GLOBAL_CONFIG) - if [ ! -z $DO_CREDENTIAL ]; then - echoColor "yellow" "Setting Digital Ocean Credential..." - rit set credential --provider digitalocean --fields=token --values=$DO_CREDENTIAL - fi - DO_TOKEN_EXISTS=$(rit list credential | grep digitalocean) - if [ ! -z "$DO_TOKEN_EXISTS" ]; then - rit vkpr cert-manager install do --default - else - echoColor "red" "Skipping CERT_MANAGER installing due the digitalocean token missing..." - echoColor "red" "Run rit set credentials or fill up the config file properly ..." - fi +installExternalDNS(){ + local EXTERNAL_DNS_EXISTS=$($VKPR_YQ eval .global.external-dns.enabled $VKPR_GLOBAL_CONFIG) + if [ "$EXTERNAL_DNS_EXISTS" = true ]; then + local EXTERNAL_DNS_PROVIDER=$($VKPR_YQ eval .global.external-dns.provider $VKPR_GLOBAL_CONFIG) + case $EXTERNAL_DNS_PROVIDER in + aws) + local EXTERNAL_DNS_ACCESS_KEY=$($VKPR_YQ eval .global.external-dns.aws.accessKey $VKPR_GLOBAL_CONFIG) + local EXTERNAL_DNS_SECRET_KEY=$($VKPR_YQ eval .global.external-dns.aws.secretKey $VKPR_GLOBAL_CONFIG) + local EXTERNAL_DNS_REGION=$($VKPR_YQ eval .global.external-dns.aws.region $VKPR_GLOBAL_CONFIG) + rit set credential --provider="aws" \ + --fields="accesskeyid,secretaccesskey,region" \ + --values="$EXTERNAL_DNS_ACCESS_KEY,$EXTERNAL_DNS_SECRET_KEY,$EXTERNAL_DNS_REGION" + ;; + digitalocean) + local EXTERNAL_DNS_API_TOKEN=$($VKPR_YQ eval .global.external-dns.digitalocean.apiToken $VKPR_GLOBAL_CONFIG) + rit set credential --provider="digitalocean" --fields="token" --values="$EXTERNAL_DNS_API_TOKEN" + ;; + powerDNS) + local EXTERNAL_DNS_API_TOKEN=$($VKPR_YQ eval .global.external-dns.powerDNS.apiKey $VKPR_GLOBAL_CONFIG) + rit set credential --provider="powerDNS" --fields="apikey" --values="$EXTERNAL_DNS_API_TOKEN" + ;; + esac + rit vkpr external-dns install --provider $EXTERNAL_DNS_PROVIDER --default fi } -installExternalDNSDO(){ - EXTERNALDNSEXISTS=$($VKPR_YQ eval .global.external-dns.enabled $VKPR_GLOBAL_CONFIG) - if [ "$EXTERNALDNSEXISTS" = true ]; then - DO_CREDENTIAL=$($VKPR_YQ eval .global.external-dns.provider_token $VKPR_GLOBAL_CONFIG) - if [ ! -z $DO_CREDENTIAL ]; then - echoColor "yellow" "Setting Digital Ocean Credential..." - rit set credential --provider digitalocean --fields=token --values=$DO_CREDENTIAL - fi - DO_TOKEN_EXISTS=$(rit list credential | grep digitalocean) - if [ ! -z "$DO_TOKEN_EXISTS" ]; then - rit vkpr external-dns install --provider digitalocean --default - else - echoColor "red" "Skipping EXTERNAL-DNS installing due the digitalocean token missing..." - echoColor "red" "Run rit set credentials or fill up the config file properly ..." - fi +infraUp(){ + INFRA_EXISTS=$($VKPR_YQ eval .global.infra.enabled $VKPR_GLOBAL_CONFIG) + if [ "$INFRA_EXISTS" = true ]; then + rit vkpr infra start --default fi } -installExternalDNSAWS(){ - echoColor "red" "Cert-Manager with AWS is a work in progress." +installIngress(){ + INGRESS_EXISTS=$($VKPR_YQ eval .global.ingress.enabled $VKPR_GLOBAL_CONFIG) + if [ "$INGRESS_EXISTS" = true ]; then + rit vkpr ingress install --default + fi } installKeycloak(){ - KEYCLOAKEXISTS=$($VKPR_YQ eval .global.keycloak.enabled $VKPR_GLOBAL_CONFIG) - echoColor "yellow" "teste: $KEYCLOAKEXISTS" - if [ "$KEYCLOAKEXISTS" = true ]; then + KEYCLOAK_EXISTS=$($VKPR_YQ eval .global.keycloak.enabled $VKPR_GLOBAL_CONFIG) + if [ "$KEYCLOAK_EXISTS" = true ]; then rit vkpr keycloak install --default fi +} +installKong(){ + KONG_EXISTS=$($VKPR_YQ eval .global.kong.enabled $VKPR_GLOBAL_CONFIG) + if [ "$KONG_EXISTS" = true ]; then + KONG_ENTERPRISE="" + KONG_ENTERPRISE_LICENSE="" + if [[ $($VKPR_YQ eval '.global.kong | has("enterprise")' $VKPR_GLOBAL_CONFIG) ]]; then + KONG_ENTERPRISE=$($VKPR_YQ eval .global.kong.enterprise.enabled $VKPR_GLOBAL_CONFIG) + KONG_ENTERPRISE_LICENSE=$($VKPR_YQ eval .global.kong.enterprise.license $VKPR_GLOBAL_CONFIG) + fi + rit vkpr kong install --enterprise $KONG_ENTERPRISE --license $KONG_ENTERPRISE_LICENSE --default + fi +} + +installLoki(){ + LOKI_EXISTS=$($VKPR_YQ eval .global.loki.enabled $VKPR_GLOBAL_CONFIG) + if [ "$LOKI_EXISTS" = true ]; then + rit vkpr loki install --default + fi } installPostgres(){ - POSTGRESEXISTS=$($VKPR_YQ eval .global.postgres.enabled $VKPR_GLOBAL_CONFIG) - if [ "$POSTGRESEXISTS" = true ]; then - PASSWORD=$($VKPR_YQ eval .global.postgres.admin_password $VKPR_GLOBAL_CONFIG) - if [ ! -z $PASSWORD ]; then - echoColor "yellow" "Setting Postgres password..." - rit set credential --provider postgres --fields=password --values=$PASSWORD - fi - PASSWORD_EXISTS=$(rit list credential | grep postgres) - if [ ! -z "$PASSWORD_EXISTS" ]; then - rit vkpr postgres install --default - else - echoColor "red" "Skipping POSTGRES installing due the password missing..." - echoColor "red" "Run rit set credentials or fill up the config file properly ..." - fi + POSTGRES_EXISTS=$($VKPR_YQ eval .global.postgresql.enabled $VKPR_GLOBAL_CONFIG) + if [ "$POSTGRES_EXISTS" = true ]; then + rit vkpr postgres install --default fi } installPrometheusGrafana(){ - PROMETHEUSGRAFANAEXISTS=$($VKPR_YQ eval .global.grafana.enabled $VKPR_GLOBAL_CONFIG) - if [ "$PROMETHEUSGRAFANAEXISTS" = true ]; then + PROMETHEUS_STACK_EXISTS=$($VKPR_YQ eval .global.prometheus-stack.enabled $VKPR_GLOBAL_CONFIG) + if [ "$PROMETHEUS_STACK_EXISTS" = true ]; then rit vkpr prometheus-stack install --default fi } -installLoki(){ - LOKIEXISTS=$($VKPR_YQ eval .global.loki.enabled $VKPR_GLOBAL_CONFIG) - if [ "$LOKIEXISTS" = true ]; then - rit vkpr loki install --default +installVault(){ + VAULT_EXISTS=$($VKPR_YQ eval .global.vault.enabled $VKPR_GLOBAL_CONFIG) + if [ "$VAULT_EXISTS" = true ]; then + rit vkpr vault install --default fi } + +installWhoami(){ + WHOAMI_EXISTS=$($VKPR_YQ eval .global.whoami.enabled $VKPR_GLOBAL_CONFIG) + if [ "$WHOAMI_EXISTS" = true ]; then + rit vkpr whoami install --default + fi +} \ No newline at end of file diff --git a/vkpr/argocd/install/config.json b/vkpr/argocd/install/config.json index 3762d99a..0966ad68 100755 --- a/vkpr/argocd/install/config.json +++ b/vkpr/argocd/install/config.json @@ -18,17 +18,6 @@ "false" ] }, - { - "tutorial": "Specifies the Super Admin password.", - "label": "Type the user Password:", - "name": "admin_password", - "type": "password", - "default": "vkpr123", - "pattern": { - "regex": "^([A-Za-z0-9-]{7,})$", - "mismatchText": "Password too weak" - } - }, { "tutorial": "Specifies if the application will have High Availability.", "label": "HA ?", diff --git a/vkpr/argocd/install/src/unix/formula/formula.sh b/vkpr/argocd/install/src/unix/formula/formula.sh index 74351071..7093cd58 100755 --- a/vkpr/argocd/install/src/unix/formula/formula.sh +++ b/vkpr/argocd/install/src/unix/formula/formula.sh @@ -6,7 +6,6 @@ runFormula() { checkGlobalConfig $DOMAIN "localhost" "domain" "DOMAIN" checkGlobalConfig $SECURE "false" "secure" "SECURE" checkGlobalConfig $HA "false" "argocd.HA" "HA" - checkGlobalConfig $ADMIN_PASSWORD "vkpr123" "argocd.adminPassword" "ARGOCD_ADMIN_PASSWORD" checkGlobalConfig "nginx" "nginx" "argocd.ingressClassName" "ARGOCD_INGRESS" checkGlobalConfig "false" "false" "argocd.metrics" "METRICS" checkGlobalConfig "false" "false" "argocd.addons.applicationset" "ARGO_ADDONS_APPLICATIONSET" @@ -25,7 +24,6 @@ startInfos() { echoColor "bold" "$(echoColor "blue" "ArgoCD HTTPS:") ${VKPR_ENV_SECURE}" echoColor "bold" "$(echoColor "blue" "HA:") ${VKPR_ENV_HA}" echoColor "bold" "$(echoColor "blue" "ArgoCD Admin Username:") admin" - echoColor "bold" "$(echoColor "blue" "ArgoCD Admin Password:") ${VKPR_ENV_ARGOCD_ADMIN_PASSWORD}" echoColor "bold" "$(echoColor "blue" "Ingress Controller:") ${VKPR_ENV_ARGOCD_INGRESS}" echo "==============================" } @@ -43,16 +41,19 @@ installArgoCD(){ --create-namespace -n argocd \ --wait --timeout 10m -f - argocd argo/argo-cd settingArgoAddons + printArgoPassword +} + +printArgoPassword(){ + PASSWORD=$($VKPR_KUBECTL -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d) + echoColor "blue" "Your ArgoCD Super Admin password is $PASSWORD, we recommend that it be changed after the first login" } settingArgoCD(){ - local ARGO_PASSWORD=$(htpasswd -nbBC 10 "" $VKPR_ENV_ARGOCD_ADMIN_PASSWORD | tr -d ':\n' | sed 's/$2y/$2a/') YQ_VALUES=''$YQ_VALUES' | .server.ingress.hosts[0] = "'$VKPR_ENV_ARGOCD_DOMAIN'" | .server.config.url = "'$VKPR_ENV_ARGOCD_DOMAIN'" | - .server.ingress.annotations.["'kubernetes.io/ingress.class'"] = "'$VKPR_ENV_ARGOCD_INGRESS'" | - .configs.secret.createSecret = "false" | - .configs.secret.argocdServerAdminPassword = "'$ARGO_PASSWORD'" + .server.ingress.annotations.["'kubernetes.io/ingress.class'"] = "'$VKPR_ENV_ARGOCD_INGRESS'" ' if [[ $VKPR_ENV_SECURE = true ]]; then YQ_VALUES=''$YQ_VALUES' | diff --git a/vkpr/aws/eks/tfc/src/unix/formula/formula.sh b/vkpr/aws/eks/tfc/src/unix/formula/formula.sh index 677929ba..ca1c9cfa 100755 --- a/vkpr/aws/eks/tfc/src/unix/formula/formula.sh +++ b/vkpr/aws/eks/tfc/src/unix/formula/formula.sh @@ -1,7 +1,7 @@ #!/bin/bash runFormula() { - cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" + [[ -f $CURRENT_PWD/vkpr.yaml ]] && cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" rit vkpr aws eks init --terraform_state="Terraform Cloud" --terraformcloud_api_token="$TERRAFORMCLOUD_API_TOKEN" --default createOrganizationInTFCloud diff --git a/vkpr/cert-manager/install/config.json b/vkpr/cert-manager/install/config.json index 76335f32..3772ab77 100755 --- a/vkpr/cert-manager/install/config.json +++ b/vkpr/cert-manager/install/config.json @@ -36,7 +36,7 @@ "label": "What solver do you want to use ?", "name": "issuer_solver", "type": "text", - "default": "HTTP01", + "default": "DNS01", "required": true, "items": [ "HTTP01", diff --git a/vkpr/cert-manager/install/src/unix/formula/formula.sh b/vkpr/cert-manager/install/src/unix/formula/formula.sh index c4f5c444..2e3ac377 100755 --- a/vkpr/cert-manager/install/src/unix/formula/formula.sh +++ b/vkpr/cert-manager/install/src/unix/formula/formula.sh @@ -3,11 +3,10 @@ runFormula() { local VKPR_ISSUER_VALUES=$(dirname "$0")/utils/issuer.yaml local VKPR_CERT_MANAGER_VALUES=$(dirname "$0")/utils/cert-manager.yaml - local VKPR_ENV_CERT_ISSUER="$ISSUER" checkGlobalConfig $EMAIL "default@vkpr.com" "cert-manager.email" "EMAIL" - checkGlobalConfig $ISSUER_SOLVER "HTTP01" "cert-manager.solver" "ISSUER_SOLVER" - checkGlobalConfig $CLOUD_PROVIDER "aws" "cert-manager.provider" "CLOUD_PROVIDER" + checkGlobalConfig $ISSUER "staging" "cert-manager.issuer" "CERT_ISSUER" + checkGlobalConfig $ISSUER_SOLVER "DNS01" "cert-manager.solver" "ISSUER_SOLVER" checkGlobalConfig "nginx" "nginx" "cert-manager.ingress" "HTTP01_INGRESS" startInfos @@ -20,9 +19,9 @@ runFormula() { startInfos() { echo "==============================" echoColor "bold" "$(echoColor "green" "VKPR Cert-manager Install Routine")" - echoColor "bold" "$(echoColor "blue" "Provider:") ${VKPR_ENV_CLOUD_PROVIDER}" - echoColor "bold" "$(echoColor "blue" "Issuer Solver:") ${VKPR_ENV_ISSUER_SOLVER}" echoColor "bold" "$(echoColor "blue" "Email:") ${VKPR_ENV_EMAIL}" + echoColor "bold" "$(echoColor "blue" "Issuer Solver:") ${VKPR_ENV_ISSUER_SOLVER}" + echoColor "bold" "$(echoColor "blue" "Provider:") ${CLOUD_PROVIDER}" echo "==============================" } @@ -50,11 +49,11 @@ installCertManager() { settingCertmanager() { if [[ $VKPR_ENV_CERT_ISSUER = "custom-acme" ]]; then YQ_VALUES=''$YQ_VALUES' | - volumes[0].name = "custom-ca" | - volumes[0].secret.secretName = "custom-ca-secret" | - volumeMounts[0].name: "custom-ca" | - volumeMounts[0].mountPath: "/etc/ssl/certs" | - volumeMounts[0].readOnly: "true" + .volumes[0].name = "custom-ca" | + .volumes[0].secret.secretName = "custom-ca-secret" | + .volumeMounts[0].name = "custom-ca" | + .volumeMounts[0].mountPath = "/etc/ssl/certs" | + .volumeMounts[0].readOnly = "true" ' fi @@ -104,14 +103,14 @@ settingIssuer() { } configureDNS01() { - case $VKPR_ENV_CLOUD_PROVIDER in + case $CLOUD_PROVIDER in aws) - validateAwsSecretKey $AWS_SECRET_KEY - validateAwsAccessKey $AWS_ACCESS_KEY - validateAwsRegion $AWS_REGION AWS_REGION=$(cat ~/.rit/credentials/default/aws | $VKPR_JQ -r .credential.region) AWS_ACCESS_KEY=$(cat ~/.rit/credentials/default/aws | $VKPR_JQ -r .credential.accesskeyid) AWS_SECRET_KEY=$(cat ~/.rit/credentials/default/aws | $VKPR_JQ -r .credential.secretaccesskey) + validateAwsAccessKey $AWS_ACCESS_KEY + validateAwsSecretKey $AWS_SECRET_KEY + validateAwsRegion $AWS_REGION $VKPR_KUBECTL create secret generic route53-secret -n cert-manager --from-literal="secret-access-key=$AWS_SECRET_KEY" YQ_ISSUER_VALUES=''$YQ_ISSUER_VALUES' | .spec.acme.solvers[0].dns01.route53.region = "'$AWS_REGION'" | @@ -122,8 +121,8 @@ configureDNS01() { ' ;; digitalocean) - validateDigitalOceanApiToken $DO_TOKEN DO_TOKEN=$(cat ~/.rit/credentials/default/digitalocean | $VKPR_JQ -r .credential.token) + validateDigitalOceanApiToken $DO_TOKEN $VKPR_KUBECTL create secret generic digitalocean-secret -n cert-manager --from-literal="access-token=$DO_TOKEN" YQ_ISSUER_VALUES=''$YQ_ISSUER_VALUES' | .spec.acme.solvers[0].dns01.digitalocean.tokenSecretRef.name = "digitalocean-secret" | diff --git a/vkpr/consul/install/src/unix/formula/formula.sh b/vkpr/consul/install/src/unix/formula/formula.sh index 611ce22f..c4dc7abf 100755 --- a/vkpr/consul/install/src/unix/formula/formula.sh +++ b/vkpr/consul/install/src/unix/formula/formula.sh @@ -10,6 +10,7 @@ runFormula() { local VKPR_ENV_CONSUL_DOMAIN="consul.${VKPR_ENV_DOMAIN}" + startInfos configureRepository installConsul } diff --git a/vkpr/external-dns/install/config.json b/vkpr/external-dns/install/config.json index d3511562..aaaeb594 100755 --- a/vkpr/external-dns/install/config.json +++ b/vkpr/external-dns/install/config.json @@ -5,7 +5,6 @@ "label": "Type your provider:", "name": "provider", "type": "text", - "default": "aws", "required": true, "items": [ "aws", diff --git a/vkpr/external-dns/install/src/unix/formula/formula.sh b/vkpr/external-dns/install/src/unix/formula/formula.sh index 355b0a33..84b071bc 100755 --- a/vkpr/external-dns/install/src/unix/formula/formula.sh +++ b/vkpr/external-dns/install/src/unix/formula/formula.sh @@ -5,7 +5,6 @@ runFormula() { local RIT_CREDENTIALS_PATH=~/.rit/credentials/default [[ $PDNS_APIURL == "" ]] && PDNS_APIURL="example.com" - checkGlobalConfig $PROVIDER "aws" "external-dns.provider" "EXTERNAL_DNS_PROVIDER" checkGlobalConfig $PDNS_APIURL "example.com" "external-dns.powerDNS.apiUrl" "EXTERNAL_DNS_PDNS_APIURL" checkGlobalConfig "false" "false" "external-dns.metrics" "METRICS" @@ -17,7 +16,7 @@ runFormula() { startInfos() { echo "==============================" echoColor "bold" "$(echoColor "green" "VKPR External-DNS Install Routine")" - echoColor "bold" "$(echoColor "blue" "Provider:") ${VKPR_ENV_EXTERNAL_DNS_PROVIDER}" + echoColor "bold" "$(echoColor "blue" "Provider:") ${PROVIDER}" echo "==============================" } @@ -27,8 +26,8 @@ addRepoExternalDNS() { installExternalDNS() { local YQ_VALUES='.rbac.create = true' - if [[ ! -f $RIT_CREDENTIALS_PATH/$VKPR_ENV_EXTERNAL_DNS_PROVIDER ]]; then - echoColor "red" "Doesn't exists credential $VKPR_ENV_EXTERNAL_DNS_PROVIDER to use in formula, create her or use the provider flag." + if [[ ! -f $RIT_CREDENTIALS_PATH/$PROVIDER ]]; then + echoColor "red" "Doesn't exists credential $PROVIDER to use in formula, create her or use the provider flag." else echoColor "bold" "$(echoColor "green" "Installing External-DNS...")" settingExternalDNS @@ -41,23 +40,27 @@ installExternalDNS() { settingExternalDNS() { - case $VKPR_ENV_EXTERNAL_DNS_PROVIDER in + case $PROVIDER in aws) - validateAwsSecretKey $AWS_SECRET_KEY + AWS_REGION=$(cat ~/.rit/credentials/default/aws | $VKPR_JQ -r .credential.region) + AWS_ACCESS_KEY=$(cat ~/.rit/credentials/default/aws | $VKPR_JQ -r .credential.accesskeyid) + AWS_SECRET_KEY=$(cat ~/.rit/credentials/default/aws | $VKPR_JQ -r .credential.secretaccesskey) validateAwsAccessKey $AWS_ACCESS_KEY + validateAwsSecretKey $AWS_SECRET_KEY validateAwsRegion $AWS_REGION YQ_VALUES=''$YQ_VALUES' | .provider = "aws" | - .aws.credentials.accessKey = "'$($VKPR_JQ -r .credential.accesskeyid $RIT_CREDENTIALS_PATH/aws)'" | - .aws.credentials.secretKey = "'$($VKPR_JQ -r .credential.secretaccesskey $RIT_CREDENTIALS_PATH/aws)'" | - .aws.region = "'$($VKPR_JQ -r .credential.region $RIT_CREDENTIALS_PATH/aws)'" + .aws.credentials.accessKey = "'$AWS_ACCESS_KEY'" | + .aws.credentials.secretKey = "'$AWS_SECRET_KEY'" | + .aws.region = "'$AWS_REGION'" ' ;; digitalocean) + DO_TOKEN=$(cat ~/.rit/credentials/default/digitalocean | $VKPR_JQ -r .credential.token) validateDigitalOceanApiToken $DO_TOKEN YQ_VALUES=''$YQ_VALUES' | .provider = "digitalocean" | - .digitalocean.apiToken = "'$($VKPR_JQ -r .credential.token $RIT_CREDENTIALS_PATH/digitalocean)'" + .digitalocean.apiToken = "'$DO_TOKEN'" ' ;; powerDNS) @@ -78,5 +81,5 @@ settingExternalDNS() { ' fi - mergeVkprValuesHelmArgs "external-dns" $VKPR_INGRESS_VALUES + mergeVkprValuesHelmArgs "external-dns" $VKPR_EXTERNAL_DNS_VALUES } \ No newline at end of file diff --git a/vkpr/infra/start/src/unix/formula/formula.sh b/vkpr/infra/start/src/unix/formula/formula.sh index 46fadb59..d3c6da25 100755 --- a/vkpr/infra/start/src/unix/formula/formula.sh +++ b/vkpr/infra/start/src/unix/formula/formula.sh @@ -7,8 +7,8 @@ runFormula() { checkGlobalConfig $HTTP_PORT "8000" "infra.httpPort" "HTTP_PORT" checkGlobalConfig $HTTPS_PORT "8001" "infra.httpsPort" "HTTPS_PORT" checkGlobalConfig $ENABLE_TRAEFIK "false" "infra.traefik.enabled" "TRAEFIK" - checkGlobalConfig $SERVERS "1" "infra.resources.servers" "K3D_SERVERS" - checkGlobalConfig $AGENTS "1" "infra.resources.agents" "K3D_AGENTS" + checkGlobalConfig $SERVERS "1" "infra.resources.masters" "K3D_SERVERS" + checkGlobalConfig $AGENTS "1" "infra.resources.workers" "K3D_AGENTS" startInfos configRegistry diff --git a/vkpr/infra/up/src/unix/formula/formula.sh b/vkpr/infra/up/src/unix/formula/formula.sh index 62492821..8e5aadb6 100755 --- a/vkpr/infra/up/src/unix/formula/formula.sh +++ b/vkpr/infra/up/src/unix/formula/formula.sh @@ -1,7 +1,7 @@ #!/bin/sh runFormula() { - cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" + [[ -f $CURRENT_PWD/vkpr.yaml ]] && cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" rit vkpr infra start --default } diff --git a/vkpr/init/src/utils/validate.sh b/vkpr/init/src/utils/validate.sh index c5309654..d9ad8c79 100644 --- a/vkpr/init/src/utils/validate.sh +++ b/vkpr/init/src/utils/validate.sh @@ -39,7 +39,7 @@ validateDigitalOceanApiToken() { if [[ "$1" =~ ^([A-Za-z0-9]{64})$ ]]; then return else - echoColor "red" "Invalid AWS Region, fix the credential with the command $(echoColor "bold" "rit set credential")." + echoColor "red" "Invalid Digital Ocean API Token, fix the credential with the command $(echoColor "bold" "rit set credential")." exit fi } diff --git a/vkpr/keycloak/install/src/unix/formula/formula.sh b/vkpr/keycloak/install/src/unix/formula/formula.sh index 429082bd..d240c4bb 100755 --- a/vkpr/keycloak/install/src/unix/formula/formula.sh +++ b/vkpr/keycloak/install/src/unix/formula/formula.sh @@ -92,7 +92,7 @@ configureKeycloakDB(){ [[ $VKPR_ENV_HA == true ]] && PG_HA="true" if [[ $(checkPodName "postgres-postgresql") != "true" ]]; then echoColor "green" "Initializing postgresql to Keycloak" - cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" + [[ -f $CURRENT_PWD/vkpr.yaml ]] && cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" rit vkpr postgres install --HA=$PG_HA --password=$PASSWORD --default fi if [[ $(checkExistingDatabase $PG_USER $PG_PASSWORD $PG_DATABASE_NAME) != "keycloak" ]]; then diff --git a/vkpr/keycloak/install/src/utils/realm.json b/vkpr/keycloak/install/src/utils/realm.json deleted file mode 100644 index c3a78d4f..00000000 --- a/vkpr/keycloak/install/src/utils/realm.json +++ /dev/null @@ -1,2288 +0,0 @@ -{ - "id": "grafana", - "realm": "grafana", - "notBefore": 0, - "defaultSignatureAlgorithm": "RS256", - "revokeRefreshToken": false, - "refreshTokenMaxReuse": 0, - "accessTokenLifespan": 300, - "accessTokenLifespanForImplicitFlow": 900, - "ssoSessionIdleTimeout": 1800, - "ssoSessionMaxLifespan": 36000, - "ssoSessionIdleTimeoutRememberMe": 0, - "ssoSessionMaxLifespanRememberMe": 0, - "offlineSessionIdleTimeout": 2592000, - "offlineSessionMaxLifespanEnabled": false, - "offlineSessionMaxLifespan": 5184000, - "clientSessionIdleTimeout": 0, - "clientSessionMaxLifespan": 0, - "clientOfflineSessionIdleTimeout": 0, - "clientOfflineSessionMaxLifespan": 0, - "accessCodeLifespan": 60, - "accessCodeLifespanUserAction": 300, - "accessCodeLifespanLogin": 1800, - "actionTokenGeneratedByAdminLifespan": 43200, - "actionTokenGeneratedByUserLifespan": 300, - "oauth2DeviceCodeLifespan": 600, - "oauth2DevicePollingInterval": 5, - "enabled": true, - "sslRequired": "external", - "registrationAllowed": false, - "registrationEmailAsUsername": false, - "rememberMe": true, - "verifyEmail": false, - "loginWithEmailAllowed": true, - "duplicateEmailsAllowed": false, - "resetPasswordAllowed": true, - "editUsernameAllowed": true, - "bruteForceProtected": false, - "permanentLockout": false, - "maxFailureWaitSeconds": 900, - "minimumQuickLoginWaitSeconds": 60, - "waitIncrementSeconds": 60, - "quickLoginCheckMilliSeconds": 1000, - "maxDeltaTimeSeconds": 43200, - "failureFactor": 30, - "users": [ - { - "username": "sample-user", - "enabled": true, - "email": "sample-user@example", - "firstName": "Sample", - "lastName": "User", - "credentials": [ - { - "type": "password", - "value": "password" - } - ], - "realmRoles": [], - "clientRoles": { - "grafana": [ - "viewer" - ] - } - }, - { - "username": "sample-editor", - "enabled": true, - "email": "sample-editor@example", - "firstName": "Sample", - "lastName": "Editor", - "credentials": [ - { - "type": "password", - "value": "password" - } - ], - "realmRoles": [], - "clientRoles": { - "grafana": [ - "editor" - ] - } - }, - { - "username": "sample-admin", - "enabled": true, - "email": "sample-admin@example", - "firstName": "Sample", - "lastName": "Admin", - "credentials": [ - { - "type": "password", - "value": "password" - } - ], - "realmRoles": [], - "clientRoles": { - "grafana": [ - "admin" - ] - } - } - ], - "roles": { - "realm": [ - { - "id": "d45f461e-4a3b-453d-8ace-d85935827c13", - "name": "uma_authorization", - "description": "${role_uma_authorization}", - "composite": false, - "clientRole": false, - "containerId": "grafana", - "attributes": {} - }, - { - "id": "a101b744-1eb5-4292-be30-73c08c15a747", - "name": "default-roles-grafana", - "description": "${role_default-roles}", - "composite": true, - "composites": { - "realm": [ - "offline_access", - "uma_authorization" - ], - "client": { - "account": [ - "view-profile", - "manage-account" - ] - } - }, - "clientRole": false, - "containerId": "grafana", - "attributes": {} - }, - { - "id": "4cadcde2-0f5d-4bc5-abe7-6d5979461e6c", - "name": "offline_access", - "description": "${role_offline-access}", - "composite": false, - "clientRole": false, - "containerId": "grafana", - "attributes": {} - } - ], - "client": { - "realm-management": [ - { - "id": "5614e73b-e60a-4c69-8856-19bb2e586f7e", - "name": "manage-identity-providers", - "description": "${role_manage-identity-providers}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "e82438f1-1ebd-46a3-a17a-d959455a5105", - "name": "query-clients", - "description": "${role_query-clients}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "9763c7a6-86c9-409c-8263-921e675c02ac", - "name": "query-realms", - "description": "${role_query-realms}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "d101f236-92e0-4a61-ad33-00a53739fe92", - "name": "view-events", - "description": "${role_view-events}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "700df67d-ce21-474f-8ccc-0130d5c20132", - "name": "view-authorization", - "description": "${role_view-authorization}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "1fed04e0-0a79-4778-88bd-127ecdc81c3b", - "name": "view-identity-providers", - "description": "${role_view-identity-providers}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "6370186e-aa8c-4b39-bc87-18da93cf228d", - "name": "impersonation", - "description": "${role_impersonation}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "5a7c63aa-b7cd-447c-b34e-e30418ea454e", - "name": "manage-events", - "description": "${role_manage-events}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "65e8ca04-473b-406f-aba7-e3eda57ef968", - "name": "realm-admin", - "description": "${role_realm-admin}", - "composite": true, - "composites": { - "client": { - "realm-management": [ - "manage-identity-providers", - "query-clients", - "query-realms", - "view-events", - "view-authorization", - "view-identity-providers", - "impersonation", - "manage-events", - "manage-realm", - "manage-users", - "manage-authorization", - "manage-clients", - "view-clients", - "query-groups", - "view-users", - "query-users", - "create-client", - "view-realm" - ] - } - }, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "31468aa8-6e40-4fc6-8045-ef32c2e7bf4e", - "name": "manage-realm", - "description": "${role_manage-realm}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "e3b83706-d979-45a8-98e2-59511909afb7", - "name": "manage-users", - "description": "${role_manage-users}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "a3cb583c-1141-4978-b32d-41123f0eb5fb", - "name": "manage-authorization", - "description": "${role_manage-authorization}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "11d9509b-75ea-49f1-b2f0-f39d937d1af1", - "name": "manage-clients", - "description": "${role_manage-clients}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "93299d6e-60cc-4238-a64a-9cac290bc863", - "name": "query-groups", - "description": "${role_query-groups}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "77e4ecea-106e-4b97-b635-f9defa0f7d72", - "name": "view-clients", - "description": "${role_view-clients}", - "composite": true, - "composites": { - "client": { - "realm-management": [ - "query-clients" - ] - } - }, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "07ce5860-9999-4560-b026-41a4ab66c74c", - "name": "view-users", - "description": "${role_view-users}", - "composite": true, - "composites": { - "client": { - "realm-management": [ - "query-groups", - "query-users" - ] - } - }, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "937b31b6-162b-489c-8939-ca609fee74e7", - "name": "query-users", - "description": "${role_query-users}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "0c726842-8d68-4113-bf89-51cacdd2d0ee", - "name": "create-client", - "description": "${role_create-client}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - }, - { - "id": "988b3708-e43d-446e-800f-f6b34df541d3", - "name": "view-realm", - "description": "${role_view-realm}", - "composite": false, - "clientRole": true, - "containerId": "10cad019-4630-4513-889e-22402a739ae4", - "attributes": {} - } - ], - "grafana": [ - { - "id": "1a63f1e8-fd49-49d4-8bb0-75f840e43b33", - "name": "viewer", - "composite": false, - "clientRole": true, - "containerId": "8b825ecf-4367-48d4-ad4b-8faa4cd636f0", - "attributes": {} - }, - { - "id": "6f2a8898-5358-482a-83f0-9bbd948896d4", - "name": "editor", - "composite": false, - "clientRole": true, - "containerId": "8b825ecf-4367-48d4-ad4b-8faa4cd636f0", - "attributes": {} - }, - { - "id": "6ee1c61c-6105-433d-9407-893957494da8", - "name": "admin", - "composite": false, - "clientRole": true, - "containerId": "8b825ecf-4367-48d4-ad4b-8faa4cd636f0", - "attributes": {} - } - ], - "security-admin-console": [], - "admin-cli": [], - "account-console": [], - "broker": [ - { - "id": "2fa8a3e0-f745-4a28-b732-b5004f1bfe58", - "name": "read-token", - "description": "${role_read-token}", - "composite": false, - "clientRole": true, - "containerId": "3a833679-c2b8-47ec-938f-97fb450e8de6", - "attributes": {} - } - ], - "account": [ - { - "id": "38336a54-5404-492b-8d94-f0c69187f30d", - "name": "view-profile", - "description": "${role_view-profile}", - "composite": false, - "clientRole": true, - "containerId": "ae675ff1-eb36-4751-816b-d34b41300669", - "attributes": {} - }, - { - "id": "cdc4d3e5-06d1-42ec-8a93-3c7a4795cb50", - "name": "manage-account", - "description": "${role_manage-account}", - "composite": true, - "composites": { - "client": { - "account": [ - "manage-account-links" - ] - } - }, - "clientRole": true, - "containerId": "ae675ff1-eb36-4751-816b-d34b41300669", - "attributes": {} - }, - { - "id": "4c29ed52-3285-46b5-aad9-c37fe6b2cc18", - "name": "manage-account-links", - "description": "${role_manage-account-links}", - "composite": false, - "clientRole": true, - "containerId": "ae675ff1-eb36-4751-816b-d34b41300669", - "attributes": {} - }, - { - "id": "bb4b9a06-042c-4bfb-ac28-73511528fc43", - "name": "delete-account", - "description": "${role_delete-account}", - "composite": false, - "clientRole": true, - "containerId": "ae675ff1-eb36-4751-816b-d34b41300669", - "attributes": {} - }, - { - "id": "b3ca8809-bb3d-4898-ba8d-b1e0ae8e2e12", - "name": "view-consent", - "description": "${role_view-consent}", - "composite": false, - "clientRole": true, - "containerId": "ae675ff1-eb36-4751-816b-d34b41300669", - "attributes": {} - }, - { - "id": "4a52c1d2-5db7-47ac-9003-3a76679fd7fb", - "name": "manage-consent", - "description": "${role_manage-consent}", - "composite": true, - "composites": { - "client": { - "account": [ - "view-consent" - ] - } - }, - "clientRole": true, - "containerId": "ae675ff1-eb36-4751-816b-d34b41300669", - "attributes": {} - }, - { - "id": "9b9c3036-2083-4e61-a0da-faf9470dcb36", - "name": "view-applications", - "description": "${role_view-applications}", - "composite": false, - "clientRole": true, - "containerId": "ae675ff1-eb36-4751-816b-d34b41300669", - "attributes": {} - } - ] - } - }, - "groups": [], - "defaultRole": { - "id": "a101b744-1eb5-4292-be30-73c08c15a747", - "name": "default-roles-grafana", - "description": "${role_default-roles}", - "composite": true, - "clientRole": false, - "containerId": "grafana" - }, - "requiredCredentials": [ - "password" - ], - "otpPolicyType": "totp", - "otpPolicyAlgorithm": "HmacSHA1", - "otpPolicyInitialCounter": 0, - "otpPolicyDigits": 6, - "otpPolicyLookAheadWindow": 1, - "otpPolicyPeriod": 30, - "otpSupportedApplications": [ - "FreeOTP", - "Google Authenticator" - ], - "webAuthnPolicyRpEntityName": "keycloak", - "webAuthnPolicySignatureAlgorithms": [ - "ES256" - ], - "webAuthnPolicyRpId": "", - "webAuthnPolicyAttestationConveyancePreference": "not specified", - "webAuthnPolicyAuthenticatorAttachment": "not specified", - "webAuthnPolicyRequireResidentKey": "not specified", - "webAuthnPolicyUserVerificationRequirement": "not specified", - "webAuthnPolicyCreateTimeout": 0, - "webAuthnPolicyAvoidSameAuthenticatorRegister": false, - "webAuthnPolicyAcceptableAaguids": [], - "webAuthnPolicyPasswordlessRpEntityName": "keycloak", - "webAuthnPolicyPasswordlessSignatureAlgorithms": [ - "ES256" - ], - "webAuthnPolicyPasswordlessRpId": "", - "webAuthnPolicyPasswordlessAttestationConveyancePreference": "not specified", - "webAuthnPolicyPasswordlessAuthenticatorAttachment": "not specified", - "webAuthnPolicyPasswordlessRequireResidentKey": "not specified", - "webAuthnPolicyPasswordlessUserVerificationRequirement": "not specified", - "webAuthnPolicyPasswordlessCreateTimeout": 0, - "webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister": false, - "webAuthnPolicyPasswordlessAcceptableAaguids": [], - "scopeMappings": [ - { - "clientScope": "offline_access", - "roles": [ - "offline_access" - ] - } - ], - "clientScopeMappings": { - "account": [ - { - "client": "account-console", - "roles": [ - "manage-account" - ] - } - ] - }, - "clients": [ - { - "id": "ae675ff1-eb36-4751-816b-d34b41300669", - "clientId": "account", - "name": "${client_account}", - "rootUrl": "${authBaseUrl}", - "baseUrl": "/realms/grafana/account/", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "redirectUris": [ - "/realms/grafana/account/*" - ], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "web-origins", - "profile", - "roles", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "e9761577-27c3-45a9-8d84-5dbddf761297", - "clientId": "account-console", - "name": "${client_account-console}", - "rootUrl": "${authBaseUrl}", - "baseUrl": "/realms/grafana/account/", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "redirectUris": [ - "/realms/grafana/account/*" - ], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "pkce.code.challenge.method": "S256" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "protocolMappers": [ - { - "id": "c390a361-d830-49eb-b7eb-a8eed1dcfd3b", - "name": "audience resolve", - "protocol": "openid-connect", - "protocolMapper": "oidc-audience-resolve-mapper", - "consentRequired": false, - "config": {} - } - ], - "defaultClientScopes": [ - "web-origins", - "profile", - "roles", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "4a48b3f3-3b15-4154-9147-ee0a8e60a3b1", - "clientId": "admin-cli", - "name": "${client_admin-cli}", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "redirectUris": [], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": false, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": true, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "web-origins", - "profile", - "roles", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "3a833679-c2b8-47ec-938f-97fb450e8de6", - "clientId": "broker", - "name": "${client_broker}", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "redirectUris": [], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": true, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": false, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "web-origins", - "profile", - "roles", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "8b825ecf-4367-48d4-ad4b-8faa4cd636f0", - "clientId": "grafana", - "rootUrl": "http://grafana.localhost/", - "adminUrl": "http://grafana.localhost/", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "secret": "3162d962-c3d1-498e-8cb3-a1ae0005c4d9", - "redirectUris": [ - "http://grafana.localhost/*" - ], - "webOrigins": [ - "http://grafana.localhost" - ], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": true, - "serviceAccountsEnabled": false, - "publicClient": false, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "id.token.as.detached.signature": "false", - "saml.assertion.signature": "false", - "saml.force.post.binding": "false", - "saml.multivalued.roles": "false", - "saml.encrypt": "false", - "oauth2.device.authorization.grant.enabled": "false", - "backchannel.logout.revoke.offline.tokens": "false", - "saml.server.signature": "false", - "saml.server.signature.keyinfo.ext": "false", - "use.refresh.tokens": "true", - "exclude.session.state.from.auth.response": "false", - "oidc.ciba.grant.enabled": "false", - "saml.artifact.binding": "false", - "backchannel.logout.session.required": "true", - "client_credentials.use_refresh_token": "false", - "saml_force_name_id_format": "false", - "require.pushed.authorization.requests": "false", - "saml.client.signature": "false", - "tls.client.certificate.bound.access.tokens": "false", - "saml.authnstatement": "false", - "display.on.consent.screen": "false", - "saml.onetimeuse.condition": "false" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": true, - "nodeReRegistrationTimeout": -1, - "protocolMappers": [ - { - "id": "eae824f5-5e82-4218-9abd-c435084e415e", - "name": "client roles", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-client-role-mapper", - "consentRequired": false, - "config": { - "multivalued": "true", - "userinfo.token.claim": "true", - "user.attribute": "foo", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "roles", - "jsonType.label": "String", - "usermodel.clientRoleMapping.clientId": "grafana" - } - } - ], - "defaultClientScopes": [ - "web-origins", - "profile", - "roles", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "10cad019-4630-4513-889e-22402a739ae4", - "clientId": "realm-management", - "name": "${client_realm-management}", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "redirectUris": [], - "webOrigins": [], - "notBefore": 0, - "bearerOnly": true, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": false, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": {}, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "defaultClientScopes": [ - "web-origins", - "profile", - "roles", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - }, - { - "id": "ef30f758-e951-41a6-952a-ea107ca19737", - "clientId": "security-admin-console", - "name": "${client_security-admin-console}", - "rootUrl": "${authAdminUrl}", - "baseUrl": "/admin/grafana/console/", - "surrogateAuthRequired": false, - "enabled": true, - "alwaysDisplayInConsole": false, - "clientAuthenticatorType": "client-secret", - "redirectUris": [ - "/admin/grafana/console/*" - ], - "webOrigins": [ - "+" - ], - "notBefore": 0, - "bearerOnly": false, - "consentRequired": false, - "standardFlowEnabled": true, - "implicitFlowEnabled": false, - "directAccessGrantsEnabled": false, - "serviceAccountsEnabled": false, - "publicClient": true, - "frontchannelLogout": false, - "protocol": "openid-connect", - "attributes": { - "pkce.code.challenge.method": "S256" - }, - "authenticationFlowBindingOverrides": {}, - "fullScopeAllowed": false, - "nodeReRegistrationTimeout": 0, - "protocolMappers": [ - { - "id": "e8656801-2304-4538-b56f-c6a6361ab729", - "name": "locale", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "locale", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "locale", - "jsonType.label": "String" - } - } - ], - "defaultClientScopes": [ - "web-origins", - "profile", - "roles", - "email" - ], - "optionalClientScopes": [ - "address", - "phone", - "offline_access", - "microprofile-jwt" - ] - } - ], - "clientScopes": [ - { - "id": "617fc671-37df-4b58-ad0f-cc648febe5a4", - "name": "admin", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "true", - "display.on.consent.screen": "true" - } - }, - { - "id": "d35985e1-a4c6-4302-87ba-95d7e68df22c", - "name": "profile", - "description": "OpenID Connect built-in scope: profile", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "true", - "display.on.consent.screen": "true", - "consent.screen.text": "${profileScopeConsentText}" - }, - "protocolMappers": [ - { - "id": "00ece6d0-ed15-4ce4-ae11-ac3451915a0a", - "name": "profile", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "profile", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "profile", - "jsonType.label": "String" - } - }, - { - "id": "a0818f1d-c632-4ae2-9438-cc94a9be865a", - "name": "locale", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "locale", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "locale", - "jsonType.label": "String" - } - }, - { - "id": "803b58ce-43ff-481b-bf50-826f8739d9a3", - "name": "website", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "website", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "website", - "jsonType.label": "String" - } - }, - { - "id": "2800067e-e0ca-40c0-a888-3cac6dc72395", - "name": "updated at", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "updatedAt", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "updated_at", - "jsonType.label": "String" - } - }, - { - "id": "ea0cc9b3-9ec0-4ca4-a930-de577b500dc5", - "name": "family name", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "lastName", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "family_name", - "jsonType.label": "String" - } - }, - { - "id": "e46eb455-eb00-49e8-9c06-3bc4da9e395e", - "name": "middle name", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "middleName", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "middle_name", - "jsonType.label": "String" - } - }, - { - "id": "7164993f-79c3-4df8-8086-387b10f0ed20", - "name": "nickname", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "nickname", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "nickname", - "jsonType.label": "String" - } - }, - { - "id": "a72f3d9d-cc50-4536-a445-b9163750003e", - "name": "gender", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "gender", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "gender", - "jsonType.label": "String" - } - }, - { - "id": "bc9ea09c-7216-4a7d-9477-184361caeac0", - "name": "username", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "username", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "preferred_username", - "jsonType.label": "String" - } - }, - { - "id": "716e7c4b-6b96-43db-ba7b-105f8986567b", - "name": "picture", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "picture", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "picture", - "jsonType.label": "String" - } - }, - { - "id": "c5864e0d-351f-4d37-bd69-0561a9d04226", - "name": "zoneinfo", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "zoneinfo", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "zoneinfo", - "jsonType.label": "String" - } - }, - { - "id": "4e5ea461-fd04-4689-9faa-f99e82ed27ca", - "name": "birthdate", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "birthdate", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "birthdate", - "jsonType.label": "String" - } - }, - { - "id": "e4bb55a4-f63e-403d-9b05-426f493543d8", - "name": "given name", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "firstName", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "given_name", - "jsonType.label": "String" - } - }, - { - "id": "ced56409-43fa-4662-86b6-2eaad1b21a91", - "name": "full name", - "protocol": "openid-connect", - "protocolMapper": "oidc-full-name-mapper", - "consentRequired": false, - "config": { - "id.token.claim": "true", - "access.token.claim": "true", - "userinfo.token.claim": "true" - } - } - ] - }, - { - "id": "7e9aa422-173c-4705-ace2-976b8590ea60", - "name": "offline_access", - "description": "OpenID Connect built-in scope: offline_access", - "protocol": "openid-connect", - "attributes": { - "consent.screen.text": "${offlineAccessScopeConsentText}", - "display.on.consent.screen": "true" - } - }, - { - "id": "2b9a2bea-1cb3-4419-99e1-1fd4a7d1489c", - "name": "roles", - "description": "OpenID Connect scope for add user roles to the access token", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "false", - "display.on.consent.screen": "true", - "consent.screen.text": "${rolesScopeConsentText}" - }, - "protocolMappers": [ - { - "id": "89e4baed-9fe8-46ab-b71b-d9f7a0a195a5", - "name": "audience resolve", - "protocol": "openid-connect", - "protocolMapper": "oidc-audience-resolve-mapper", - "consentRequired": false, - "config": {} - }, - { - "id": "b4aeffbd-669d-439e-89d9-b583d6c8aa11", - "name": "client roles", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-client-role-mapper", - "consentRequired": false, - "config": { - "user.attribute": "foo", - "access.token.claim": "true", - "claim.name": "resource_access.${client_id}.roles", - "jsonType.label": "String", - "multivalued": "true" - } - }, - { - "id": "8bd45880-16fa-4eaf-95ab-910b2c10e111", - "name": "realm roles", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-realm-role-mapper", - "consentRequired": false, - "config": { - "user.attribute": "foo", - "access.token.claim": "true", - "claim.name": "realm_access.roles", - "jsonType.label": "String", - "multivalued": "true" - } - } - ] - }, - { - "id": "fa620eba-617a-4d18-9130-8ca471f99086", - "name": "microprofile-jwt", - "description": "Microprofile - JWT built-in scope", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "true", - "display.on.consent.screen": "false" - }, - "protocolMappers": [ - { - "id": "ac75a515-4f92-4e64-8698-9abd2e1526ff", - "name": "groups", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-realm-role-mapper", - "consentRequired": false, - "config": { - "multivalued": "true", - "user.attribute": "foo", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "groups", - "jsonType.label": "String" - } - }, - { - "id": "8e2148af-3ddc-4cee-a343-8e8782cd0551", - "name": "upn", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "username", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "upn", - "jsonType.label": "String" - } - } - ] - }, - { - "id": "bad67cd6-398f-4ec4-976e-65b50dabf78f", - "name": "role_list", - "description": "SAML role list", - "protocol": "saml", - "attributes": { - "consent.screen.text": "${samlRoleListScopeConsentText}", - "display.on.consent.screen": "true" - }, - "protocolMappers": [ - { - "id": "cc97377b-0cbd-472d-aee7-14e48c7f0e3d", - "name": "role list", - "protocol": "saml", - "protocolMapper": "saml-role-list-mapper", - "consentRequired": false, - "config": { - "single": "false", - "attribute.nameformat": "Basic", - "attribute.name": "Role" - } - } - ] - }, - { - "id": "bc92108c-a6c8-4029-80d6-169085d34645", - "name": "web-origins", - "description": "OpenID Connect scope for add allowed web origins to the access token", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "false", - "display.on.consent.screen": "false", - "consent.screen.text": "" - }, - "protocolMappers": [ - { - "id": "ed1140ea-cff0-4871-bf4b-2809a816dca0", - "name": "allowed web origins", - "protocol": "openid-connect", - "protocolMapper": "oidc-allowed-origins-mapper", - "consentRequired": false, - "config": {} - } - ] - }, - { - "id": "5f762b17-3387-445f-92e2-49f9b9869cbb", - "name": "phone", - "description": "OpenID Connect built-in scope: phone", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "true", - "display.on.consent.screen": "true", - "consent.screen.text": "${phoneScopeConsentText}" - }, - "protocolMappers": [ - { - "id": "a2cb5031-d12f-421c-bb6a-9f356f9803a0", - "name": "phone number", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "phoneNumber", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "phone_number", - "jsonType.label": "String" - } - }, - { - "id": "b5726e75-a8f1-44fd-8b5f-715919362b5a", - "name": "phone number verified", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-attribute-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "phoneNumberVerified", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "phone_number_verified", - "jsonType.label": "boolean" - } - } - ] - }, - { - "id": "aa180721-dd50-470a-ba4a-0042838df605", - "name": "email", - "description": "OpenID Connect built-in scope: email", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "true", - "display.on.consent.screen": "true", - "consent.screen.text": "${emailScopeConsentText}" - }, - "protocolMappers": [ - { - "id": "7a4ee4d7-face-4c32-843c-58178bd0ed2e", - "name": "email", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "email", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "email", - "jsonType.label": "String" - } - }, - { - "id": "e06d3f44-f97a-4b43-ac6d-7141ab6b746e", - "name": "email verified", - "protocol": "openid-connect", - "protocolMapper": "oidc-usermodel-property-mapper", - "consentRequired": false, - "config": { - "userinfo.token.claim": "true", - "user.attribute": "emailVerified", - "id.token.claim": "true", - "access.token.claim": "true", - "claim.name": "email_verified", - "jsonType.label": "boolean" - } - } - ] - }, - { - "id": "bd0baefd-29a8-454c-ade6-d909f3b186b4", - "name": "address", - "description": "OpenID Connect built-in scope: address", - "protocol": "openid-connect", - "attributes": { - "include.in.token.scope": "true", - "display.on.consent.screen": "true", - "consent.screen.text": "${addressScopeConsentText}" - }, - "protocolMappers": [ - { - "id": "29668122-c5dd-4e4d-97f7-d9c7f68f7dd7", - "name": "address", - "protocol": "openid-connect", - "protocolMapper": "oidc-address-mapper", - "consentRequired": false, - "config": { - "user.attribute.formatted": "formatted", - "user.attribute.country": "country", - "user.attribute.postal_code": "postal_code", - "userinfo.token.claim": "true", - "user.attribute.street": "street", - "id.token.claim": "true", - "user.attribute.region": "region", - "access.token.claim": "true", - "user.attribute.locality": "locality" - } - } - ] - } - ], - "defaultDefaultClientScopes": [ - "role_list", - "profile", - "email", - "roles", - "web-origins" - ], - "defaultOptionalClientScopes": [ - "offline_access", - "address", - "phone", - "microprofile-jwt" - ], - "browserSecurityHeaders": { - "contentSecurityPolicyReportOnly": "", - "xContentTypeOptions": "nosniff", - "xRobotsTag": "none", - "xFrameOptions": "SAMEORIGIN", - "contentSecurityPolicy": "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", - "xXSSProtection": "1; mode=block", - "strictTransportSecurity": "max-age=31536000; includeSubDomains" - }, - "smtpServer": {}, - "eventsEnabled": false, - "eventsListeners": [ - "jboss-logging" - ], - "enabledEventTypes": [], - "adminEventsEnabled": false, - "adminEventsDetailsEnabled": false, - "identityProviders": [], - "identityProviderMappers": [], - "components": { - "org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy": [ - { - "id": "5cac5ab3-cb05-48b1-992a-596b7df38496", - "name": "Max Clients Limit", - "providerId": "max-clients", - "subType": "anonymous", - "subComponents": {}, - "config": { - "max-clients": [ - "200" - ] - } - }, - { - "id": "284ad989-ef59-40ef-98b4-b8df99f2ea9d", - "name": "Trusted Hosts", - "providerId": "trusted-hosts", - "subType": "anonymous", - "subComponents": {}, - "config": { - "host-sending-registration-request-must-match": [ - "true" - ], - "client-uris-must-match": [ - "true" - ] - } - }, - { - "id": "7412fbff-c596-427a-a449-f184d1903a54", - "name": "Allowed Client Scopes", - "providerId": "allowed-client-templates", - "subType": "anonymous", - "subComponents": {}, - "config": { - "allow-default-scopes": [ - "true" - ] - } - }, - { - "id": "93db20ec-14ca-4c63-b998-8f41edfff035", - "name": "Consent Required", - "providerId": "consent-required", - "subType": "anonymous", - "subComponents": {}, - "config": {} - }, - { - "id": "073aa3ff-14f2-4199-970c-65815d9fd350", - "name": "Allowed Client Scopes", - "providerId": "allowed-client-templates", - "subType": "authenticated", - "subComponents": {}, - "config": { - "allow-default-scopes": [ - "true" - ] - } - }, - { - "id": "444995de-f230-498c-acf2-bf1686757bd8", - "name": "Allowed Protocol Mapper Types", - "providerId": "allowed-protocol-mappers", - "subType": "authenticated", - "subComponents": {}, - "config": { - "allowed-protocol-mapper-types": [ - "saml-user-property-mapper", - "oidc-usermodel-property-mapper", - "oidc-usermodel-attribute-mapper", - "saml-user-attribute-mapper", - "oidc-address-mapper", - "oidc-full-name-mapper", - "oidc-sha256-pairwise-sub-mapper", - "saml-role-list-mapper" - ] - } - }, - { - "id": "11c13883-1935-46d4-b937-089888bca107", - "name": "Full Scope Disabled", - "providerId": "scope", - "subType": "anonymous", - "subComponents": {}, - "config": {} - }, - { - "id": "c9fe9901-1acf-44b9-8dcb-4b97a2dbbb40", - "name": "Allowed Protocol Mapper Types", - "providerId": "allowed-protocol-mappers", - "subType": "anonymous", - "subComponents": {}, - "config": { - "allowed-protocol-mapper-types": [ - "oidc-sha256-pairwise-sub-mapper", - "oidc-usermodel-property-mapper", - "oidc-address-mapper", - "saml-user-attribute-mapper", - "oidc-full-name-mapper", - "oidc-usermodel-attribute-mapper", - "saml-user-property-mapper", - "saml-role-list-mapper" - ] - } - } - ], - "org.keycloak.userprofile.UserProfileProvider": [ - { - "id": "14e74ef4-dd01-4e81-8513-189cb3c89eba", - "providerId": "declarative-user-profile", - "subComponents": {}, - "config": {} - } - ], - "org.keycloak.keys.KeyProvider": [ - { - "id": "25e677d7-9e65-4d43-be39-e778bd42b51c", - "name": "rsa-generated", - "providerId": "rsa-generated", - "subComponents": {}, - "config": { - "keyUse": [ - "sig" - ], - "priority": [ - "100" - ] - } - }, - { - "id": "c1dec6fb-bbf8-4478-bb6d-1e42edf3a2f7", - "name": "hmac-generated", - "providerId": "hmac-generated", - "subComponents": {}, - "config": { - "priority": [ - "100" - ], - "algorithm": [ - "HS256" - ] - } - }, - { - "id": "b4ae26b5-fd53-4a5c-89fa-43bcd9bd04c8", - "name": "rsa-enc-generated", - "providerId": "rsa-generated", - "subComponents": {}, - "config": { - "keyUse": [ - "enc" - ], - "priority": [ - "100" - ] - } - }, - { - "id": "19a79c20-93f0-4fe4-b0d3-7f15e68fe833", - "name": "aes-generated", - "providerId": "aes-generated", - "subComponents": {}, - "config": { - "priority": [ - "100" - ] - } - } - ] - }, - "internationalizationEnabled": false, - "supportedLocales": [], - "authenticationFlows": [ - { - "id": "728c9acc-6d0c-4e1c-97fe-cf7635f2120f", - "alias": "Account verification options", - "description": "Method with which to verity the existing account", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "idp-email-verification", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "ALTERNATIVE", - "priority": 20, - "flowAlias": "Verify Existing Account by Re-authentication", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "287d088f-bf78-4165-bcd4-f76dd21447ee", - "alias": "Authentication Options", - "description": "Authentication options.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "basic-auth", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "basic-auth-otp", - "authenticatorFlow": false, - "requirement": "DISABLED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-spnego", - "authenticatorFlow": false, - "requirement": "DISABLED", - "priority": 30, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "02e02097-f33d-434b-9147-49717b823798", - "alias": "Browser - Conditional OTP", - "description": "Flow to determine if the OTP is required for the authentication", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-otp-form", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "80e92b69-796e-4542-8f9f-e71475783488", - "alias": "Direct Grant - Conditional OTP", - "description": "Flow to determine if the OTP is required for the authentication", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "direct-grant-validate-otp", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "f9b06fa1-d27b-446d-8188-894e16aca199", - "alias": "First broker login - Conditional OTP", - "description": "Flow to determine if the OTP is required for the authentication", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-otp-form", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "9fa9e2e5-ac6a-48b8-9d7e-bf159ab978bc", - "alias": "Handle Existing Account", - "description": "Handle what to do if there is existing account with same email/username like authenticated identity provider", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "idp-confirm-link", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "REQUIRED", - "priority": 20, - "flowAlias": "Account verification options", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "f3c6a353-3bcc-49c7-9e78-dea320c9ef3f", - "alias": "Reset - Conditional OTP", - "description": "Flow to determine if the OTP should be reset or not. Set to REQUIRED to force.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "conditional-user-configured", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "reset-otp", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "45990575-8595-4133-9949-ea22d462c61a", - "alias": "User creation or linking", - "description": "Flow for the existing/non-existing user alternatives", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticatorConfig": "create unique user config", - "authenticator": "idp-create-user-if-unique", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "ALTERNATIVE", - "priority": 20, - "flowAlias": "Handle Existing Account", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "6fd2976b-3b7a-4fcf-813e-b14cad71b8d2", - "alias": "Verify Existing Account by Re-authentication", - "description": "Reauthentication of existing account", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "idp-username-password-form", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "CONDITIONAL", - "priority": 20, - "flowAlias": "First broker login - Conditional OTP", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "6ceb5379-5e36-4e98-8f40-da23b10c2e9f", - "alias": "browser", - "description": "browser based authentication", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "auth-cookie", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "auth-spnego", - "authenticatorFlow": false, - "requirement": "DISABLED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "identity-provider-redirector", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 25, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "ALTERNATIVE", - "priority": 30, - "flowAlias": "forms", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "5e75fdd1-cbbf-4bea-a931-3276a94b8416", - "alias": "clients", - "description": "Base authentication for clients", - "providerId": "client-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "client-secret", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "client-jwt", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "client-secret-jwt", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 30, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "client-x509", - "authenticatorFlow": false, - "requirement": "ALTERNATIVE", - "priority": 40, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "7623edb3-b765-4c05-9f9a-f255c9404f56", - "alias": "direct grant", - "description": "OpenID Connect Resource Owner Grant", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "direct-grant-validate-username", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "direct-grant-validate-password", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "CONDITIONAL", - "priority": 30, - "flowAlias": "Direct Grant - Conditional OTP", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "ef5d4823-16f2-4c49-8670-50a894ac13c5", - "alias": "docker auth", - "description": "Used by Docker clients to authenticate against the IDP", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "docker-http-basic-authenticator", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "95cba2aa-1216-4c77-9f10-ecc307ede016", - "alias": "first broker login", - "description": "Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticatorConfig": "review profile config", - "authenticator": "idp-review-profile", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "REQUIRED", - "priority": 20, - "flowAlias": "User creation or linking", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "a16d2efe-2741-4290-b25a-48c5c1cf72af", - "alias": "forms", - "description": "Username, password, otp and other auth forms.", - "providerId": "basic-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "auth-username-password-form", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "CONDITIONAL", - "priority": 20, - "flowAlias": "Browser - Conditional OTP", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "7565fb59-5e85-4196-abdc-8591b2552deb", - "alias": "http challenge", - "description": "An authentication flow based on challenge-response HTTP Authentication Schemes", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "no-cookie-redirect", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "REQUIRED", - "priority": 20, - "flowAlias": "Authentication Options", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "4dcf8941-ac89-45f4-9e27-e9ee8263ce34", - "alias": "registration", - "description": "registration flow", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "registration-page-form", - "authenticatorFlow": true, - "requirement": "REQUIRED", - "priority": 10, - "flowAlias": "registration form", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "429c466a-ca47-427f-96c4-a7d8742fced9", - "alias": "registration form", - "description": "registration form", - "providerId": "form-flow", - "topLevel": false, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "registration-user-creation", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "registration-profile-action", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 40, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "registration-password-action", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 50, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "registration-recaptcha-action", - "authenticatorFlow": false, - "requirement": "DISABLED", - "priority": 60, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - }, - { - "id": "1493af9e-97d6-4e15-86d3-cd0fee5c98cb", - "alias": "reset credentials", - "description": "Reset credentials for a user if they forgot their password or something", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "reset-credentials-choose-user", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "reset-credential-email", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 20, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticator": "reset-password", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 30, - "userSetupAllowed": false, - "autheticatorFlow": false - }, - { - "authenticatorFlow": true, - "requirement": "CONDITIONAL", - "priority": 40, - "flowAlias": "Reset - Conditional OTP", - "userSetupAllowed": false, - "autheticatorFlow": true - } - ] - }, - { - "id": "3bed4d70-574e-48cb-8741-ac8cd182b406", - "alias": "saml ecp", - "description": "SAML ECP Profile Authentication Flow", - "providerId": "basic-flow", - "topLevel": true, - "builtIn": true, - "authenticationExecutions": [ - { - "authenticator": "http-basic-authenticator", - "authenticatorFlow": false, - "requirement": "REQUIRED", - "priority": 10, - "userSetupAllowed": false, - "autheticatorFlow": false - } - ] - } - ], - "authenticatorConfig": [ - { - "id": "b0fe51d6-9bea-438f-a706-9aeea2fefa59", - "alias": "create unique user config", - "config": { - "require.password.update.after.registration": "false" - } - }, - { - "id": "d539cffd-cb28-453c-93bb-a6e128e2e735", - "alias": "review profile config", - "config": { - "update.profile.on.first.login": "missing" - } - } - ], - "requiredActions": [ - { - "alias": "CONFIGURE_TOTP", - "name": "Configure OTP", - "providerId": "CONFIGURE_TOTP", - "enabled": true, - "defaultAction": false, - "priority": 10, - "config": {} - }, - { - "alias": "terms_and_conditions", - "name": "Terms and Conditions", - "providerId": "terms_and_conditions", - "enabled": false, - "defaultAction": false, - "priority": 20, - "config": {} - }, - { - "alias": "UPDATE_PASSWORD", - "name": "Update Password", - "providerId": "UPDATE_PASSWORD", - "enabled": true, - "defaultAction": false, - "priority": 30, - "config": {} - }, - { - "alias": "UPDATE_PROFILE", - "name": "Update Profile", - "providerId": "UPDATE_PROFILE", - "enabled": true, - "defaultAction": false, - "priority": 40, - "config": {} - }, - { - "alias": "VERIFY_EMAIL", - "name": "Verify Email", - "providerId": "VERIFY_EMAIL", - "enabled": true, - "defaultAction": false, - "priority": 50, - "config": {} - }, - { - "alias": "delete_account", - "name": "Delete Account", - "providerId": "delete_account", - "enabled": false, - "defaultAction": false, - "priority": 60, - "config": {} - }, - { - "alias": "update_user_locale", - "name": "Update User Locale", - "providerId": "update_user_locale", - "enabled": true, - "defaultAction": false, - "priority": 1000, - "config": {} - } - ], - "browserFlow": "browser", - "registrationFlow": "registration", - "directGrantFlow": "direct grant", - "resetCredentialsFlow": "reset credentials", - "clientAuthenticationFlow": "clients", - "dockerAuthenticationFlow": "docker auth", - "attributes": { - "cibaBackchannelTokenDeliveryMode": "poll", - "cibaExpiresIn": "120", - "cibaAuthRequestedUserHint": "login_hint", - "oauth2DeviceCodeLifespan": "600", - "oauth2DevicePollingInterval": "5", - "clientOfflineSessionMaxLifespan": "0", - "clientSessionIdleTimeout": "0", - "clientSessionMaxLifespan": "0", - "parRequestUriLifespan": "60", - "clientOfflineSessionIdleTimeout": "0", - "cibaInterval": "5" - }, - "keycloakVersion": "15.0.2", - "userManagedAccessAllowed": false, - "clientProfiles": { - "profiles": [] - }, - "clientPolicies": { - "policies": [] - } -} \ No newline at end of file diff --git a/vkpr/kong/install/config.json b/vkpr/kong/install/config.json index 0f58bbc5..7e4630ac 100755 --- a/vkpr/kong/install/config.json +++ b/vkpr/kong/install/config.json @@ -85,6 +85,11 @@ "true", "false" ] + }, + { + "tutorial": "Specifies the Postgresql password.", + "name": "password", + "type": "CREDENTIAL_POSTGRES_PASSWORD" } ], "template": "shell-bat", diff --git a/vkpr/kong/install/src/unix/formula/formula.sh b/vkpr/kong/install/src/unix/formula/formula.sh index 096dc859..d53bb8a2 100755 --- a/vkpr/kong/install/src/unix/formula/formula.sh +++ b/vkpr/kong/install/src/unix/formula/formula.sh @@ -8,7 +8,7 @@ runFormula() { checkGlobalConfig $SECURE "false" "secure" "SECURE" checkGlobalConfig $HA "false" "kong.HA" "HA" checkGlobalConfig "false" "false" "kong.metrics" "METRICS" - checkGlobalConfig $KONG_MODE "kong" "kong.mode" "KONG_DEPLOY" + checkGlobalConfig $KONG_MODE "dbless" "kong.mode" "KONG_DEPLOY" checkGlobalConfig $RBAC_PASSWORD "vkpr123" "kong.rbac.adminPassword" "KONG_RBAC" startInfos @@ -35,8 +35,8 @@ addRepoKong(){ addDependencies(){ mkdir -p config/ - echo '{"cookie_name":"admin_session","cookie_samesite":"Strict","secret":"admin-cookie-secret","cookie_secure":false,"storage":"kong","cookie_domain":"manager.'$VKPR_ENV_DOMAIN'"}' > config/admin_gui_session_conf - echo '{"cookie_name":"portal_session","cookie_samesite":"Strict","secret":"portal-cookie-secret","cookie_secure":false,"storage":"kong","cookie_domain":"portal.'$VKPR_ENV_DOMAIN'"}' > config/portal_session_conf + echo '{"cookie_name":"admin_session","cookie_samesite":"Strict","secret":"'$(openssl rand -base64 32)'","cookie_secure":false,"storage":"kong","cookie_domain":"manager.'$VKPR_ENV_DOMAIN'"}' > config/admin_gui_session_conf + echo '{"cookie_name":"portal_session","cookie_samesite":"Strict","secret":"'$(openssl rand -base64 32)'","cookie_secure":false,"storage":"kong","cookie_domain":"portal.'$VKPR_ENV_DOMAIN'"}' > config/portal_session_conf if [[ $VKPR_ENV_KONG_DEPLOY = "hybrid" ]]; then openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp384r1) \ -keyout config/cluster.key -out config/cluster.crt \ @@ -45,7 +45,8 @@ addDependencies(){ } createKongSecrets() { - local LICENSE_CONTENT=$(cat $LICENSE) + [[ $LICENSE = " " ]] && LICENSE="license" + local LICENSE_CONTENT=$(cat $LICENSE 2> /dev/null) echoColor "green" "Creating the Kong Secrets..." $VKPR_KUBECTL create ns vkpr 2> /dev/null $VKPR_KUBECTL create secret generic kong-enterprise-license --from-literal="license=$LICENSE_CONTENT" -n $VKPR_K8S_NAMESPACE @@ -98,7 +99,10 @@ installKong(){ $VKPR_YQ eval "$YQ_VALUES" "$VKPR_KONG_VALUES" \ | $VKPR_HELM upgrade -i --wait --create-namespace -n $VKPR_K8S_NAMESPACE \ --version $VKPR_KONG_VERSION -f - kong kong/kong - [[ $VKPR_ENV_METRICS == "true" ]] && $VKPR_KUBECTL apply -f $(dirname "$0")/utils/prometheus-plugin.yaml + + if [[ $VKPR_ENV_METRICS = true ]]; then + $VKPR_KUBECTL apply -f $(dirname "$0")/utils/prometheus-plugin.yaml + fi } settingKongDefaults() { @@ -157,7 +161,7 @@ settingKongDefaults() { .ingressController.env.leader_elect = "true" ' fi - if [[ $ENTERPRISE = true ]]; then + if [[ $ENTERPRISE = true ]] && [[ $VKPR_ENV_KONG_DEPLOY != "dbless" ]]; then YQ_VALUES=''$YQ_VALUES' | .env.password.valueFrom.secretKeyRef.name = "kong-enterprise-superuser-password" | .env.password.valueFrom.secretKeyRef.key = "password" | diff --git a/vkpr/loki/install/src/unix/formula/formula.sh b/vkpr/loki/install/src/unix/formula/formula.sh index 8e516f15..4a96f28a 100755 --- a/vkpr/loki/install/src/unix/formula/formula.sh +++ b/vkpr/loki/install/src/unix/formula/formula.sh @@ -22,7 +22,7 @@ addRepLoki(){ } installLoki(){ - local YQ_VALUES="grafana.enabled = false" + local YQ_VALUES=".grafana.enabled = false" echoColor "bold" "$(echoColor "green" "Installing Loki...")" settingLoki $VKPR_YQ eval "$YQ_VALUES" "$VKPR_LOKI_VALUES" \ @@ -60,7 +60,7 @@ existGrafana() { settingLoki() { if [[ $VKPR_ENV_METRICS = "true" ]]; then - YQ_VALUES=''$YQ_VALUES' | + YQ_VALUES=''$YQ_VALUES' | .loki.serviceMonitor.enabled = true | .loki.serviceMonitor.interval = "30s" | .loki.serviceMonitor.additionalLabels.release = "prometheus-stack" | diff --git a/vkpr/prometheus-stack/install/src/unix/formula/formula.sh b/vkpr/prometheus-stack/install/src/unix/formula/formula.sh index 1829ca48..f40fe659 100755 --- a/vkpr/prometheus-stack/install/src/unix/formula/formula.sh +++ b/vkpr/prometheus-stack/install/src/unix/formula/formula.sh @@ -74,8 +74,8 @@ settingStack() { fi if [[ $VKPR_ENV_PROMETHEUS_INGRESS != "nginx" ]]; then YQ_VALUES=''$YQ_VALUES' | - .alertmanager.ingress.ingressClassName = "traefik" | - .grafana.ingress.ingressClassName = "traefik" + .alertmanager.ingress.ingressClassName = "'$VKPR_ENV_PROMETHEUS_INGRESS'" | + .grafana.ingress.ingressClassName = "'$VKPR_ENV_PROMETHEUS_INGRESS'" ' fi if [[ $VKPR_ENV_K8S_EXPORTERS = "true" ]]; then @@ -102,30 +102,6 @@ settingStack() { .grafana.additionalDataSources[0].editable = true ' fi - if [[ $(checkPodName "keycloak") = "true" ]]; then - # addapt to use https (only find http) - local K3D_PORTS=":$($VKPR_K3D cluster ls vkpr-local -o yaml | $VKPR_YQ eval '.[].cluster.nodes[0].portMappings.80/tcp[0].hostport' -)" - local KEYCLOAK_DOMAIN="keycloak.$($VKPR_YQ eval .global.domain $VKPR_GLOBAL)${K3D_PORTS}/auth/realms/grafana/protocol/openid-connect" - local ROLES="contains(roles[], 'admin') && 'Admin' || contains(roles[], 'editor') && 'Editor' || 'Viewer'" - YQ_VALUES=''$YQ_VALUES' | - .grafana.env.GF_SERVER_ROOT_URL = "http://'${VKPR_ENV_GRAFANA_DOMAIN}${K3D_PORTS}'/" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_ENABLED = true | - .grafana.env.GF_AUTH_DISABLE_LOGIN_FORM = true | - .grafana.env.GF_AUTH_GENERIC_OAUTH_NAME = "Keycloak" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_CLIENT_ID = "grafana" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET = "3162d962-c3d1-498e-8cb3-a1ae0005c4d9" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_SCOPES = "openid profile email" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_ALLOW_SIGN_UP = true | - .grafana.env.GF_AUTH_GENERIC_OAUTH_AUTO_LOGIN = false | - .grafana.env.GF_AUTH_GENERIC_OAUTH_TLS_SKIP_VERIFY_INSECURE = true | - .grafana.env.GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH = "'${ROLES}'" | - .grafana.env.GF_SERVER_ROOT_URL = "http://'${VKPR_ENV_GRAFANA_DOMAIN}'/" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_AUTH_URL = "http://'${KEYCLOAK_DOMAIN}'/auth" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_TOKEN_URL = "http://'${KEYCLOAK_DOMAIN}'/token" | - .grafana.env.GF_AUTH_GENERIC_OAUTH_API_URL = "http://'${KEYCLOAK_DOMAIN}'/usernfo" | - .grafana.env.GF_AUTH_SIGNOUT_REDIRECT_URL = "http://'${KEYCLOAK_DOMAIN}'/logout?redirect_uri=http%3A%2F%2F'${VKPR_ENV_GRAFANA_DOMAIN}${K3D_PORTS}'%2Flogin" - ' - fi mergeVkprValuesHelmArgs "prometheus-stack" $VKPR_PROMETHEUS_VALUES } \ No newline at end of file From f6d2aba26216a04dd8550e72148e87970a6ff486 Mon Sep 17 00:00:00 2001 From: Jpeedroza Date: Wed, 9 Feb 2022 16:00:39 -0300 Subject: [PATCH 4/8] Add KV to change the namespace from the applications --- .../install/src/unix/formula/formula.sh | 18 ++++--- .../src/utils/argocd-applicationset.yaml | 4 ++ vkpr/argocd/install/src/utils/argocd.yaml | 3 ++ .../argocd/remove/src/unix/formula/formula.sh | 14 ++++-- .../src/unix/formula/formula.sh | 7 ++- .../src/utils/applicationset.yaml | 2 +- .../repository/src/unix/formula/formula.sh | 4 +- .../set/repository/src/utils/repository.yaml | 1 + .../install/src/unix/formula/formula.sh | 16 ++++-- .../install/src/utils/cert-manager.yaml | 3 ++ .../install/src/utils/issuer.yaml | 2 + .../remove/src/unix/formula/formula.sh | 9 ++-- .../install/src/unix/formula/formula.sh | 15 +++--- vkpr/consul/install/src/utils/consul.yaml | 12 +++-- .../consul/remove/src/unix/formula/formula.sh | 3 +- .../install/src/unix/formula/formula.sh | 5 +- .../install/src/utils/external-dns.yaml | 2 + .../remove/src/unix/formula/formula.sh | 4 +- .../install/src/unix/formula/formula.sh | 7 ++- vkpr/ingress/install/src/utils/ingress.yaml | 5 ++ .../remove/src/unix/formula/formula.sh | 6 ++- vkpr/init/src/utils/helper.sh | 11 +++-- vkpr/init/src/utils/var.sh | 2 +- .../clients/src/unix/formula/formula.sh | 9 ++-- .../export/realm/src/unix/formula/formula.sh | 9 ++-- .../export/users/src/unix/formula/formula.sh | 9 ++-- .../clients/src/unix/formula/formula.sh | 7 ++- .../import/realm/src/unix/formula/formula.sh | 7 ++- .../import/users/src/unix/formula/formula.sh | 7 ++- .../install/src/unix/formula/formula.sh | 20 +++++--- vkpr/keycloak/install/src/utils/keycloak.yaml | 2 + .../remove/src/unix/formula/formula.sh | 4 +- vkpr/kong/install/src/unix/formula/formula.sh | 49 +++++++++++++++---- vkpr/kong/install/src/utils/kong-cp.yaml | 2 + vkpr/kong/install/src/utils/kong-dbless.yaml | 2 + vkpr/kong/install/src/utils/kong-dp.yaml | 2 + vkpr/kong/install/src/utils/kong.yaml | 2 + .../install/src/utils/prometheus-plugin.yaml | 3 +- vkpr/kong/remove/src/unix/formula/formula.sh | 7 ++- vkpr/loki/install/src/unix/formula/formula.sh | 14 ++++-- vkpr/loki/install/src/utils/loki.yaml | 2 + vkpr/loki/remove/src/unix/formula/formula.sh | 6 ++- .../createdb/src/unix/formula/formula.sh | 10 ++-- .../install/src/unix/formula/formula.sh | 9 ++-- vkpr/postgres/install/src/utils/postgres.yaml | 3 ++ .../remove/src/unix/formula/formula.sh | 7 +-- .../import/src/unix/formula/formula.sh | 5 +- .../import/src/utils/dashboard.yaml | 1 + .../install/src/unix/formula/formula.sh | 10 ++-- .../install/src/utils/prometheus-stack.yaml | 2 + .../remove/src/unix/formula/formula.sh | 6 ++- .../vault/install/src/unix/formula/formula.sh | 19 +++++-- vkpr/vault/install/src/utils/auto-unseal.yaml | 3 ++ vkpr/vault/install/src/utils/vault.yaml | 2 + vkpr/vault/remove/src/unix/formula/formula.sh | 8 +-- .../install/src/unix/formula/formula.sh | 3 +- vkpr/whoami/install/src/utils/whoami.yaml | 2 + .../whoami/remove/src/unix/formula/formula.sh | 12 ++--- 58 files changed, 294 insertions(+), 126 deletions(-) create mode 100644 vkpr/argocd/install/src/utils/argocd-applicationset.yaml diff --git a/vkpr/argocd/install/src/unix/formula/formula.sh b/vkpr/argocd/install/src/unix/formula/formula.sh index 7093cd58..a60f3f39 100755 --- a/vkpr/argocd/install/src/unix/formula/formula.sh +++ b/vkpr/argocd/install/src/unix/formula/formula.sh @@ -6,6 +6,7 @@ runFormula() { checkGlobalConfig $DOMAIN "localhost" "domain" "DOMAIN" checkGlobalConfig $SECURE "false" "secure" "SECURE" checkGlobalConfig $HA "false" "argocd.HA" "HA" + checkGlobalConfig "argocd" "argocd" "argocd.namespace" "NAMESPACE" checkGlobalConfig "nginx" "nginx" "argocd.ingressClassName" "ARGOCD_INGRESS" checkGlobalConfig "false" "false" "argocd.metrics" "METRICS" checkGlobalConfig "false" "false" "argocd.addons.applicationset" "ARGO_ADDONS_APPLICATIONSET" @@ -38,14 +39,14 @@ installArgoCD(){ echoColor "bold" "$(echoColor "green" "Installing ArgoCD...")" $VKPR_YQ eval "$YQ_VALUES" "$VKPR_ARGOCD_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_ARGOCD_VERSION" \ - --create-namespace -n argocd \ + --create-namespace -n $VKPR_ENV_NAMESPACE \ --wait --timeout 10m -f - argocd argo/argo-cd settingArgoAddons printArgoPassword } printArgoPassword(){ - PASSWORD=$($VKPR_KUBECTL -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d) + PASSWORD=$($VKPR_KUBECTL -n $VKPR_ENV_NAMESPACE get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d) echoColor "blue" "Your ArgoCD Super Admin password is $PASSWORD, we recommend that it be changed after the first login" } @@ -79,13 +80,13 @@ settingArgoCD(){ YQ_VALUES=''$YQ_VALUES' | .controller.metrics.enabled = true | .controller.metrics.serviceMonitor.enabled = true | - .controller.metrics.serviceMonitor.namespace = "vkpr" | + .controller.metrics.serviceMonitor.namespace = "'$VKPR_ENV_NAMESPACE'" | .controller.metrics.serviceMonitor.interval = "30s" | .controller.metrics.serviceMonitor.scrapeTimeout = "30s" | .controller.metrics.serviceMonitor.additionalLabels.release = "prometheus-stack" | .server.metrics.enabled = true | .server.metrics.serviceMonitor.enabled = true | - .server.metrics.serviceMonitor.namespace = "vkpr" | + .server.metrics.serviceMonitor.namespace = "'$VKPR_ENV_NAMESPACE'" | .server.metrics.serviceMonitor.interval = "30s" | .server.metrics.serviceMonitor.scrapeTimeout = "30s" | .server.metrics.serviceMonitor.additionalLabels.release = "prometheus-stack" @@ -97,8 +98,13 @@ settingArgoCD(){ settingArgoAddons(){ if [[ $VKPR_ENV_ARGO_ADDONS_APPLICATIONSET = true ]]; then + local VKPR_ARGOCD_APPLICATIONSET_VALUES=$(dirname "$0")/utils/argocd-applicationset.yaml + local YQ_APPLICATIONSET_VALUES='.args.namespace = "'$VKPR_ENV_NAMESPACE'"' + echoColor "bold" "$(echoColor "green" "Installing ArgoCD Addon Applicationset...")" - $VKPR_KUBECTL apply -n argocd \ - -f https://raw.githubusercontent.com/argoproj-labs/applicationset/$VKPR_ARGOCD_ADDON_APPLICATIONSET_VERSION/manifests/install.yaml + $VKPR_YQ eval "$YQ_APPLICATIONSET_VALUES" "$VKPR_ARGOCD_APPLICATIONSET_VALUES" \ + | $VKPR_HELM upgrade -i --version "$VKPR_ARGOCD_ADDON_APPLICATIONSET_VERSION" \ + -n $VKPR_ENV_NAMESPACE \ + --wait --timeout 10m -f - argocd-applicationset argo/argocd-applicationset fi } \ No newline at end of file diff --git a/vkpr/argocd/install/src/utils/argocd-applicationset.yaml b/vkpr/argocd/install/src/utils/argocd-applicationset.yaml new file mode 100644 index 00000000..16e3e323 --- /dev/null +++ b/vkpr/argocd/install/src/utils/argocd-applicationset.yaml @@ -0,0 +1,4 @@ +args: + policy: "sync" +podLabels: + vkpr: "true" diff --git a/vkpr/argocd/install/src/utils/argocd.yaml b/vkpr/argocd/install/src/utils/argocd.yaml index d38d5ff9..3de94dd4 100644 --- a/vkpr/argocd/install/src/utils/argocd.yaml +++ b/vkpr/argocd/install/src/utils/argocd.yaml @@ -1,3 +1,6 @@ +global: + podLabels: + vkpr: "true" server: extraArgs: - --insecure diff --git a/vkpr/argocd/remove/src/unix/formula/formula.sh b/vkpr/argocd/remove/src/unix/formula/formula.sh index c2d180f6..9bd9160b 100755 --- a/vkpr/argocd/remove/src/unix/formula/formula.sh +++ b/vkpr/argocd/remove/src/unix/formula/formula.sh @@ -2,9 +2,13 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing ArgoCD...")" - $VKPR_HELM uninstall -n argocd argocd - $VKPR_KUBECTL delete secret -n argocd -l argocd.argoproj.io/secret-type=repository 2> /dev/null - $VKPR_KUBECTL delete ApplicationSet -n argocd -l argo-setup=vkpr 2> /dev/null - $VKPR_KUBECTL delete -n argocd \ - -f https://raw.githubusercontent.com/argoproj-labs/applicationset/$VKPR_ARGOCD_ADDON_APPLICATIONSET_VERSION/manifests/install.yaml 2> /dev/null + + ARGOCD_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=argocd,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall argocd -n $ARGOCD_NAMESPACE 2> /dev/null + + ARGOCD_APPLICATIONSET_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=argocd-applicationset,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall argocd-applicationset -n $ARGOCD_APPLICATIONSET_NAMESPACE 2> /dev/null + + $VKPR_KUBECTL delete secret -A -l argocd.argoproj.io/secret-type=repository,vkpr=true > /dev/null + $VKPR_KUBECTL delete ApplicationSet -A -l vkpr=true > /dev/null } diff --git a/vkpr/argocd/set/applicationset/src/unix/formula/formula.sh b/vkpr/argocd/set/applicationset/src/unix/formula/formula.sh index bc0e50b8..3cf5629f 100755 --- a/vkpr/argocd/set/applicationset/src/unix/formula/formula.sh +++ b/vkpr/argocd/set/applicationset/src/unix/formula/formula.sh @@ -3,12 +3,15 @@ runFormula() { local VKPR_APPLICATIONSET_VALUES=$(dirname "$0")/utils/applicationset.yaml local REPO_NAME=$(echo $REPO_URL | awk -F "/" '{ print $NF }' | cut -d "." -f1) - if [[ -z $($VKPR_KUBECTL get deployment argocd-applicationset-controller -n argocd --ignore-not-found | awk 'NR>1{print $1}') ]]; then + + checkGlobalConfig "argocd" "argocd" "argocd.namespace" "NAMESPACE" + + if [[ -z $($VKPR_KUBECTL get deployment argocd-application-controller -n $VKPR_ENV_NAMESPACE --ignore-not-found | awk 'NR>1{print $1}') ]]; then echoColor "red" "Dont have Addon applicationset installed in this cluster" else echoColor "green" "Creating Applicationset in Argocd" $VKPR_YQ eval ' .metadata.name = "'$REPO_NAME-applicationset'" | - .metadata.namespace = "argocd" | + .metadata.namespace = "'$VKPR_ENV_NAMESPACE'" | .spec.generators[0].git.repoURL = "'$REPO_URL'" | .spec.template.spec.source.repoURL = "'$REPO_URL'" ' $VKPR_APPLICATIONSET_VALUES | $VKPR_KUBECTL apply -f - diff --git a/vkpr/argocd/set/applicationset/src/utils/applicationset.yaml b/vkpr/argocd/set/applicationset/src/utils/applicationset.yaml index 085164f0..7e8687fc 100644 --- a/vkpr/argocd/set/applicationset/src/utils/applicationset.yaml +++ b/vkpr/argocd/set/applicationset/src/utils/applicationset.yaml @@ -3,7 +3,7 @@ kind: ApplicationSet metadata: namespace: argocd labels: - argo-setup: vkpr + vkpr: "true" spec: generators: - git: diff --git a/vkpr/argocd/set/repository/src/unix/formula/formula.sh b/vkpr/argocd/set/repository/src/unix/formula/formula.sh index 08252724..c4272c10 100755 --- a/vkpr/argocd/set/repository/src/unix/formula/formula.sh +++ b/vkpr/argocd/set/repository/src/unix/formula/formula.sh @@ -4,12 +4,14 @@ runFormula() { local VKPR_REPO_VALUES=$(dirname "$0")/utils/repository.yaml local REPO_NAME=$(echo $REPO_URL | awk -F "/" '{ print $NF }' | cut -d "." -f1) + checkGlobalConfig "argocd" "argocd" "argocd.namespace" "NAMESPACE" + validateGitlabUsername $GITLAB_USERNAME validateGitlabToken $GITLAB_TOKEN echoColor "green" "Connecting repository in Argocd" $VKPR_YQ eval ' .metadata.name = "'$REPO_NAME-repo'" | - .metadata.namespace = "argocd" | + .metadata.namespace = "'$VKPR_ENV_NAMESPACE'" | .stringData.url = "'$REPO_URL'" | .stringData.username = "'$GITLAB_USERNAME'" | .stringData.password = "'$GITLAB_TOKEN'" diff --git a/vkpr/argocd/set/repository/src/utils/repository.yaml b/vkpr/argocd/set/repository/src/utils/repository.yaml index c795e47a..238ebdd8 100644 --- a/vkpr/argocd/set/repository/src/utils/repository.yaml +++ b/vkpr/argocd/set/repository/src/utils/repository.yaml @@ -4,3 +4,4 @@ metadata: namespace: argocd labels: argocd.argoproj.io/secret-type: repository + vkpr: "true" diff --git a/vkpr/cert-manager/install/src/unix/formula/formula.sh b/vkpr/cert-manager/install/src/unix/formula/formula.sh index 2e3ac377..ed85929e 100755 --- a/vkpr/cert-manager/install/src/unix/formula/formula.sh +++ b/vkpr/cert-manager/install/src/unix/formula/formula.sh @@ -8,6 +8,10 @@ runFormula() { checkGlobalConfig $ISSUER "staging" "cert-manager.issuer" "CERT_ISSUER" checkGlobalConfig $ISSUER_SOLVER "DNS01" "cert-manager.solver" "ISSUER_SOLVER" checkGlobalConfig "nginx" "nginx" "cert-manager.ingress" "HTTP01_INGRESS" + checkGlobalConfig "cert-manager" "cert-manager" "cert-manager.namespace" "NAMESPACE" + + # Todo: find why cert-manager doesnt work in another namespace + VKPR_ENV_NAMESPACE="cert-manager" startInfos installCRDS @@ -36,11 +40,11 @@ addCertManager() { installCertManager() { echoColor "bold" "$(echoColor "green" "Installing cert-manager...")" - local YQ_VALUES='.ingressShim.defaultIssuerName = "certmanager-issuer"' + local YQ_VALUES='.ingressShim.defaultIssuerName = "certmanager-issuer" | .clusterResourceNamespace = "'$VKPR_ENV_NAMESPACE'"' settingCertmanager $VKPR_YQ eval "$YQ_VALUES" "$VKPR_CERT_MANAGER_VALUES" \ | $VKPR_HELM upgrade -i -f - \ - -n cert-manager --create-namespace \ + -n $VKPR_ENV_NAMESPACE --create-namespace \ --version "$VKPR_CERT_VERSION" \ --wait \ cert-manager jetstack/cert-manager @@ -62,7 +66,7 @@ settingCertmanager() { installIssuer() { echoColor "bold" "$(echoColor "green" "Installing Issuers and/or ClusterIssuers...")" - local YQ_ISSUER_VALUES='.spec.acme.email = "'$VKPR_ENV_EMAIL'"' + local YQ_ISSUER_VALUES='.spec.acme.email = "'$VKPR_ENV_EMAIL'" | .metadata.namespace = "'$VKPR_ENV_NAMESPACE'"' case $VKPR_ENV_CERT_ISSUER in staging) YQ_ISSUER_VALUES=''$YQ_ISSUER_VALUES' | @@ -111,7 +115,8 @@ configureDNS01() { validateAwsAccessKey $AWS_ACCESS_KEY validateAwsSecretKey $AWS_SECRET_KEY validateAwsRegion $AWS_REGION - $VKPR_KUBECTL create secret generic route53-secret -n cert-manager --from-literal="secret-access-key=$AWS_SECRET_KEY" + $VKPR_KUBECTL create secret generic route53-secret -n $VKPR_ENV_NAMESPACE --from-literal="secret-access-key=$AWS_SECRET_KEY" + $VKPR_KUBECTL label secret route53-secret -n $VKPR_ENV_NAMESPACE vkpr=true app.kubernetes.io/instance=cert-manager YQ_ISSUER_VALUES=''$YQ_ISSUER_VALUES' | .spec.acme.solvers[0].dns01.route53.region = "'$AWS_REGION'" | .spec.acme.solvers[0].dns01.route53.accessKeyID = "'$AWS_ACCESS_KEY'" | @@ -123,7 +128,8 @@ configureDNS01() { digitalocean) DO_TOKEN=$(cat ~/.rit/credentials/default/digitalocean | $VKPR_JQ -r .credential.token) validateDigitalOceanApiToken $DO_TOKEN - $VKPR_KUBECTL create secret generic digitalocean-secret -n cert-manager --from-literal="access-token=$DO_TOKEN" + $VKPR_KUBECTL create secret generic digitalocean-secret -n $VKPR_ENV_NAMESPACE --from-literal="access-token=$DO_TOKEN" + $VKPR_KUBECTL label secret digitalocean-secret -n $VKPR_ENV_NAMESPACE vkpr=true app.kubernetes.io/instance=cert-manager YQ_ISSUER_VALUES=''$YQ_ISSUER_VALUES' | .spec.acme.solvers[0].dns01.digitalocean.tokenSecretRef.name = "digitalocean-secret" | .spec.acme.solvers[0].dns01.digitalocean.tokenSecretRef.key = "access-token" diff --git a/vkpr/cert-manager/install/src/utils/cert-manager.yaml b/vkpr/cert-manager/install/src/utils/cert-manager.yaml index 5a298e5e..78f91fa5 100644 --- a/vkpr/cert-manager/install/src/utils/cert-manager.yaml +++ b/vkpr/cert-manager/install/src/utils/cert-manager.yaml @@ -5,3 +5,6 @@ ingressShim: defaultIssuerGroup: cert-manager.io prometheus: enabled: false +podLabels: + vkpr: "true" +clusterResourceNamespace: cert diff --git a/vkpr/cert-manager/install/src/utils/issuer.yaml b/vkpr/cert-manager/install/src/utils/issuer.yaml index b46ed028..2bd1f855 100755 --- a/vkpr/cert-manager/install/src/utils/issuer.yaml +++ b/vkpr/cert-manager/install/src/utils/issuer.yaml @@ -3,6 +3,8 @@ kind: ClusterIssuer metadata: name: certmanager-issuer namespace: cert-manager + labels: + vkpr: "true" spec: acme: solvers: diff --git a/vkpr/cert-manager/remove/src/unix/formula/formula.sh b/vkpr/cert-manager/remove/src/unix/formula/formula.sh index 23328184..c7234962 100755 --- a/vkpr/cert-manager/remove/src/unix/formula/formula.sh +++ b/vkpr/cert-manager/remove/src/unix/formula/formula.sh @@ -2,7 +2,10 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing cert-manager...")" - #$VKPR_KUBECTL delete clusterissuer certmanager-issuer -n cert-manager - $VKPR_HELM uninstall cert-manager -n cert-manager - $VKPR_KUBECTL delete ns cert-manager + + CERT_MANAGER_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=cert-manager,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall cert-manager -n $CERT_MANAGER_NAMESPACE 2> /dev/null + + $VKPR_KUBECTL delete secret -A -l app.kubernetes.io/instance=cert-manager,vkpr=true > /dev/null + $VKPR_KUBECTL delete ClusterIssuer -A -l vkpr=true > /dev/null } diff --git a/vkpr/consul/install/src/unix/formula/formula.sh b/vkpr/consul/install/src/unix/formula/formula.sh index c4dc7abf..0bd6e159 100755 --- a/vkpr/consul/install/src/unix/formula/formula.sh +++ b/vkpr/consul/install/src/unix/formula/formula.sh @@ -7,6 +7,7 @@ runFormula() { checkGlobalConfig $DOMAIN "localhost" "domain" "DOMAIN" checkGlobalConfig $SECURE "false" "secure" "SECURE" checkGlobalConfig $INGRESS_CONTROLLER "nginx" "consul.ingressClassName" "CONSUL_INGRESS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "consul.namespace" "NAMESPACE" local VKPR_ENV_CONSUL_DOMAIN="consul.${VKPR_ENV_DOMAIN}" @@ -29,26 +30,26 @@ configureRepository() { } settingConsul() { - YQ_VALUES=''$YQ_VALUES' | - .ui.ingress.ingressClassName = "'$VKPR_ENV_CONSUL_INGRESS'" - ' if [[ $VKPR_ENV_SECURE == true ]]; then YQ_VALUES=''$YQ_VALUES' | - .ui.ingress.annotations.["'kubernetes.io/tls-acme'"] = "'true'" | .ui.ingress.tls[0].hosts[0] = "'$VKPR_ENV_CONSUL_DOMAIN'" | .ui.ingress.tls[0].secretName = "'consul-cert'" ' + else + YQ_VALUES=''$YQ_VALUES' | + .ui.ingress.annotations = "" + ' fi mergeVkprValuesHelmArgs "consul" $VKPR_CONSUL_VALUES } installConsul() { - echoColor "bold" "$(echoColor "green" "Installing Consul...")" - local YQ_VALUES='.ui.ingress.hosts[0].host = "'$VKPR_ENV_CONSUL_DOMAIN'"' + echoColor "bold" "$(echoColor "green" "Installing Consul...")" + local YQ_VALUES='.ui.ingress.hosts[0].host = "'$VKPR_ENV_CONSUL_DOMAIN'" | .ui.ingress.ingressClassName = "'$VKPR_ENV_CONSUL_INGRESS'"' settingConsul $VKPR_YQ eval "$YQ_VALUES" "$VKPR_CONSUL_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_CONSUL_VERSION" \ - --namespace $VKPR_K8S_NAMESPACE --create-namespace \ + --namespace $VKPR_ENV_NAMESPACE --create-namespace \ --wait -f - consul hashicorp/consul } \ No newline at end of file diff --git a/vkpr/consul/install/src/utils/consul.yaml b/vkpr/consul/install/src/utils/consul.yaml index 13470825..869c2436 100644 --- a/vkpr/consul/install/src/utils/consul.yaml +++ b/vkpr/consul/install/src/utils/consul.yaml @@ -3,6 +3,7 @@ global: gossipEncryption: autoGenerate: true server: + enabled: true replicas: 3 extraConfig: | { @@ -10,11 +11,16 @@ server: "raft_multiplier": 1 } } + extraLabels: + vkpr: "true" ui: enabled: true + service: + type: ClusterIP ingress: enabled: true + annotations: | + kubernetes.io/tls-acme: true hosts: - - path: "/" - tls: - - secretName: consul.localhost + - paths: + - / diff --git a/vkpr/consul/remove/src/unix/formula/formula.sh b/vkpr/consul/remove/src/unix/formula/formula.sh index cda0da24..8113ce0a 100755 --- a/vkpr/consul/remove/src/unix/formula/formula.sh +++ b/vkpr/consul/remove/src/unix/formula/formula.sh @@ -2,5 +2,6 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing Consul...")" - $VKPR_HELM uninstall consul -n $VKPR_K8S_NAMESPACE + CONSUL_NAMESPACE=$($VKPR_KUBECTL get po -A -l app=consul,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall consul -n $CONSUL_NAMESPACE 2> /dev/null } diff --git a/vkpr/external-dns/install/src/unix/formula/formula.sh b/vkpr/external-dns/install/src/unix/formula/formula.sh index 84b071bc..f30459c8 100755 --- a/vkpr/external-dns/install/src/unix/formula/formula.sh +++ b/vkpr/external-dns/install/src/unix/formula/formula.sh @@ -6,6 +6,7 @@ runFormula() { [[ $PDNS_APIURL == "" ]] && PDNS_APIURL="example.com" checkGlobalConfig $PDNS_APIURL "example.com" "external-dns.powerDNS.apiUrl" "EXTERNAL_DNS_PDNS_APIURL" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "external-dns.namespace" "NAMESPACE" checkGlobalConfig "false" "false" "external-dns.metrics" "METRICS" startInfos @@ -33,7 +34,7 @@ installExternalDNS() { settingExternalDNS $VKPR_YQ eval "$YQ_VALUES" "$VKPR_EXTERNAL_DNS_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_EXTERNAL_DNS_VERSION" \ - --create-namespace --namespace "$VKPR_K8S_NAMESPACE" \ + --create-namespace --namespace "$VKPR_ENV_NAMESPACE" \ --wait -f - external-dns bitnami/external-dns fi } @@ -76,7 +77,7 @@ settingExternalDNS() { YQ_VALUES=''$YQ_VALUES' | .metrics.enabled = true | .metrics.serviceMonitor.enabled = true | - .metrics.serviceMonitor.namespace = "vkpr" | + .metrics.serviceMonitor.namespace = "'$VKPR_ENV_NAMESPACE'" | .metrics.serviceMonitor.interval = "1m" ' fi diff --git a/vkpr/external-dns/install/src/utils/external-dns.yaml b/vkpr/external-dns/install/src/utils/external-dns.yaml index 724f1024..c44c3929 100644 --- a/vkpr/external-dns/install/src/utils/external-dns.yaml +++ b/vkpr/external-dns/install/src/utils/external-dns.yaml @@ -3,3 +3,5 @@ sources: - service interval: "1m" policy: sync +podLabels: + vkpr: "true" diff --git a/vkpr/external-dns/remove/src/unix/formula/formula.sh b/vkpr/external-dns/remove/src/unix/formula/formula.sh index d824b6cd..473fcac3 100755 --- a/vkpr/external-dns/remove/src/unix/formula/formula.sh +++ b/vkpr/external-dns/remove/src/unix/formula/formula.sh @@ -2,5 +2,7 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing External-DNS...")" - $VKPR_HELM uninstall -n $VKPR_K8S_NAMESPACE external-dns + + EXTERNAL_DNS_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=external-dns,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall external-dns -n $EXTERNAL_DNS_NAMESPACE } diff --git a/vkpr/ingress/install/src/unix/formula/formula.sh b/vkpr/ingress/install/src/unix/formula/formula.sh index 64a48ee1..62060ff3 100755 --- a/vkpr/ingress/install/src/unix/formula/formula.sh +++ b/vkpr/ingress/install/src/unix/formula/formula.sh @@ -6,6 +6,7 @@ runFormula() { checkGlobalConfig $LB_TYPE "Classic" "ingress.loadBalancerType" "LB_TYPE" checkGlobalConfig "false" "false" "ingress.metrics" "METRICS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "ingress.namespace" "NAMESPACE" startInfos configureRepository @@ -24,10 +25,11 @@ configureRepository() { installIngress() { echoColor "bold" "$(echoColor "green" "Installing ngnix ingress...")" + local YQ_VALUES=".rbac.create = true" settingIngress $VKPR_YQ eval "$YQ_VALUES" "$VKPR_INGRESS_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_INGRESS_NGINX_VERSION" \ - --namespace $VKPR_K8S_NAMESPACE --create-namespace \ + --namespace $VKPR_ENV_NAMESPACE --create-namespace \ --wait --timeout 5m0s -f - ingress-nginx ingress-nginx/ingress-nginx } @@ -46,9 +48,10 @@ settingIngress() { .controller.metrics.service.annotations.["'prometheus.io/scrape'"] = "true" | .controller.metrics.service.annotations.["'prometheus.io/port'"] = "10254" | .controller.metrics.serviceMonitor.enabled = "true" | - .controller.metrics.serviceMonitor.namespace = "vkpr" | + .controller.metrics.serviceMonitor.namespace = "'$VKPR_ENV_NAMESPACE'" | .controller.metrics.serviceMonitor.additionalLabels.release = "prometheus-stack" ' fi + mergeVkprValuesHelmArgs "ingress" $VKPR_INGRESS_VALUES } \ No newline at end of file diff --git a/vkpr/ingress/install/src/utils/ingress.yaml b/vkpr/ingress/install/src/utils/ingress.yaml index e69de29b..c5a93134 100644 --- a/vkpr/ingress/install/src/utils/ingress.yaml +++ b/vkpr/ingress/install/src/utils/ingress.yaml @@ -0,0 +1,5 @@ +controller: + labels: + vkpr: "true" +rbac: + create: true diff --git a/vkpr/ingress/remove/src/unix/formula/formula.sh b/vkpr/ingress/remove/src/unix/formula/formula.sh index 28a27d16..3cfb2d84 100755 --- a/vkpr/ingress/remove/src/unix/formula/formula.sh +++ b/vkpr/ingress/remove/src/unix/formula/formula.sh @@ -1,6 +1,8 @@ #!/bin/sh -runFormula() { +runFormula() { echoColor "bold" "$(echoColor "green" "Removing nginx ingress...")" - $VKPR_HELM uninstall --namespace $VKPR_K8S_NAMESPACE ingress-nginx || echoColor "red" "VKPR Ingress not found" + + INGRESS_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=ingress-nginx,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall --namespace $INGRESS_NAMESPACE ingress-nginx || echoColor "red" "VKPR Ingress not found" } diff --git a/vkpr/init/src/utils/helper.sh b/vkpr/init/src/utils/helper.sh index 7fc55f65..a64cb7e6 100644 --- a/vkpr/init/src/utils/helper.sh +++ b/vkpr/init/src/utils/helper.sh @@ -20,10 +20,11 @@ checkGlobalConfig(){ } # Check if any Pod is already up to use and match with another tools -# $1: name of the pod +# $1: pod namespace +# $2: name of the pod checkPodName(){ - for pod in $($VKPR_KUBECTL get pods -n $VKPR_K8S_NAMESPACE --ignore-not-found | awk 'NR>1{print $1}'); do - if [[ "$pod" == "$1"* ]]; then + for pod in $($VKPR_KUBECTL get pods -n $1 --ignore-not-found | awk 'NR>1{print $1}'); do + if [[ "$pod" == "$2"* ]]; then echo true # pod name found a match, then returns True return fi @@ -32,7 +33,7 @@ checkPodName(){ } # Create a new instance of DB in Postgres; -# $1: Postgres User / $2: Postgres Password / $3: Name of DB to create +# $1: Postgres User / $2: Postgres Password / $3: Name of DB to create / $4: Namespace createDatabase(){ local PG_HOST="postgres-postgresql" [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_K8S_NAMESPACE | grep pgpool) ]] && PG_HOST="postgres-postgresql-pgpool" @@ -40,7 +41,7 @@ createDatabase(){ } # Check if exist some instace of DB with specified name in Postgres -# $1: Postgres User / $2: Postgres Password / $3: Name of DB to search +# $1: Postgres User / $2: Postgres Password / $3: Name of DB to search / $4: Namespace checkExistingDatabase(){ local PG_HOST="postgres-postgresql" [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_K8S_NAMESPACE | grep pgpool) ]] && PG_HOST="postgres-postgresql-pgpool" diff --git a/vkpr/init/src/utils/var.sh b/vkpr/init/src/utils/var.sh index cae698e5..cc5ce6cf 100644 --- a/vkpr/init/src/utils/var.sh +++ b/vkpr/init/src/utils/var.sh @@ -27,4 +27,4 @@ VKPR_KONG_VERSION="2.6.4" VKPR_CONSUL_VERSION="0.38.0" VKPR_VAULT_VERSION="0.18.0" VKPR_ARGOCD_VERSION="3.29.4" -VKPR_ARGOCD_ADDON_APPLICATIONSET_VERSION="v0.3.0" \ No newline at end of file +VKPR_ARGOCD_ADDON_APPLICATIONSET_VERSION="1.9.1" \ No newline at end of file diff --git a/vkpr/keycloak/export/clients/src/unix/formula/formula.sh b/vkpr/keycloak/export/clients/src/unix/formula/formula.sh index 8b01e24c..b85dcd40 100755 --- a/vkpr/keycloak/export/clients/src/unix/formula/formula.sh +++ b/vkpr/keycloak/export/clients/src/unix/formula/formula.sh @@ -2,13 +2,16 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Exporting Realm Clients ID from $REALM_NAME...")" - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c " + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "keycloak.namespace" "NAMESPACE" + + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c " kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password $KEYCLOAK_PASSWORD --config /tmp/kcadm.config && \ kcadm.sh get clients -r $REALM_NAME --config /tmp/kcadm.config > /tmp/${REALM_NAME}-clientsid.json && \ rm -f /tmp/kcadm.config " - $VKPR_KUBECTL cp keycloak-0:tmp/${REALM_NAME}-clientsid.json clientsid.json -n $VKPR_K8S_NAMESPACE + $VKPR_KUBECTL cp keycloak-0:tmp/${REALM_NAME}-clientsid.json clientsid.json -n $VKPR_ENV_NAMESPACE echo "{}" | $VKPR_JQ --argjson groupInfo "$( ${REALM_NAME}-clientsid.json rm clientsid.json - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c "rm -f /tmp/${REALM_NAME}-clientsid.json" + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c "rm -f /tmp/${REALM_NAME}-clientsid.json" } diff --git a/vkpr/keycloak/export/realm/src/unix/formula/formula.sh b/vkpr/keycloak/export/realm/src/unix/formula/formula.sh index 6c6a8381..51330505 100755 --- a/vkpr/keycloak/export/realm/src/unix/formula/formula.sh +++ b/vkpr/keycloak/export/realm/src/unix/formula/formula.sh @@ -2,11 +2,14 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Exporting Realm $REALM_NAME...")" - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c " + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "keycloak.namespace" "NAMESPACE" + + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c " kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password $KEYCLOAK_PASSWORD --config /tmp/kcadm.config && \ kcadm.sh get realms/$REALM_NAME --config /tmp/kcadm.config > /tmp/${REALM_NAME}-realm.json && \ rm -f /tmp/kcadm.config " - $VKPR_KUBECTL cp keycloak-0:tmp/${REALM_NAME}-realm.json ${REALM_NAME}-realm.json -n $VKPR_K8S_NAMESPACE - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c "rm -f /tmp/${REALM_NAME}-realm.json" + $VKPR_KUBECTL cp keycloak-0:tmp/${REALM_NAME}-realm.json ${REALM_NAME}-realm.json -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c "rm -f /tmp/${REALM_NAME}-realm.json" } diff --git a/vkpr/keycloak/export/users/src/unix/formula/formula.sh b/vkpr/keycloak/export/users/src/unix/formula/formula.sh index a9e012f6..af0f8aba 100755 --- a/vkpr/keycloak/export/users/src/unix/formula/formula.sh +++ b/vkpr/keycloak/export/users/src/unix/formula/formula.sh @@ -2,13 +2,16 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Exporting Realm users from $REALM_NAME...")" - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c " + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "keycloak.namespace" "NAMESPACE" + + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c " kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password $KEYCLOAK_PASSWORD --config /tmp/kcadm.config && \ kcadm.sh get users -r $REALM_NAME --config /tmp/kcadm.config > /tmp/${REALM_NAME}-users.json && \ rm -f /tmp/kcadm.config " - $VKPR_KUBECTL cp keycloak-0:tmp/${REALM_NAME}-users.json users.json -n $VKPR_K8S_NAMESPACE + $VKPR_KUBECTL cp keycloak-0:tmp/${REALM_NAME}-users.json users.json -n $VKPR_ENV_NAMESPACE echo "{}" | $VKPR_JQ --argjson groupInfo "$( ${REALM_NAME}-users.json rm users.json - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c "rm -f /tmp/${REALM_NAME}-users.json" + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c "rm -f /tmp/${REALM_NAME}-users.json" } diff --git a/vkpr/keycloak/import/clients/src/unix/formula/formula.sh b/vkpr/keycloak/import/clients/src/unix/formula/formula.sh index 702fbcdd..16a1b594 100755 --- a/vkpr/keycloak/import/clients/src/unix/formula/formula.sh +++ b/vkpr/keycloak/import/clients/src/unix/formula/formula.sh @@ -2,8 +2,11 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Importing Realm clients...")" - $VKPR_KUBECTL cp $REALM_PATH keycloak-0:tmp/client.json -n $VKPR_K8S_NAMESPACE - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c " + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "keycloak.namespace" "NAMESPACE" + + $VKPR_KUBECTL cp $REALM_PATH keycloak-0:tmp/client.json -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c " kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password $KEYCLOAK_PASSWORD --config /tmp/kcadm.config && \ kcadm.sh create partialImport -r $REALM_NAME -s ifResourceExists=SKIP -o -f /tmp/client.json --config /tmp/kcadm.config && \ rm -f /tmp/kcadm.config /tmp/client.json diff --git a/vkpr/keycloak/import/realm/src/unix/formula/formula.sh b/vkpr/keycloak/import/realm/src/unix/formula/formula.sh index 63470042..d26b8177 100755 --- a/vkpr/keycloak/import/realm/src/unix/formula/formula.sh +++ b/vkpr/keycloak/import/realm/src/unix/formula/formula.sh @@ -2,8 +2,11 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Importing Realm...")" - $VKPR_KUBECTL cp $REALM_PATH keycloak-0:tmp/realm.json -n $VKPR_K8S_NAMESPACE - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c " + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "keycloak.namespace" "NAMESPACE" + + $VKPR_KUBECTL cp $REALM_PATH keycloak-0:tmp/realm.json -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c " kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password $KEYCLOAK_PASSWORD --config /tmp/kcadm.config && \ kcadm.sh create realms -f /tmp/realm.json --config /tmp/kcadm.config && \ rm -f /tmp/kcadm.config /tmp/realm.json diff --git a/vkpr/keycloak/import/users/src/unix/formula/formula.sh b/vkpr/keycloak/import/users/src/unix/formula/formula.sh index 4cb1afda..7a4b73a1 100755 --- a/vkpr/keycloak/import/users/src/unix/formula/formula.sh +++ b/vkpr/keycloak/import/users/src/unix/formula/formula.sh @@ -2,8 +2,11 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Importing Realm users...")" - $VKPR_KUBECTL cp $REALM_PATH keycloak-0:tmp/users.json -n $VKPR_K8S_NAMESPACE - $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_K8S_NAMESPACE -- sh -c " + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "keycloak.namespace" "NAMESPACE" + + $VKPR_KUBECTL cp $REALM_PATH keycloak-0:tmp/users.json -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL exec -it keycloak-0 -n $VKPR_ENV_NAMESPACE -- sh -c " kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password $KEYCLOAK_PASSWORD --config /tmp/kcadm.config && \ kcadm.sh create partialImport -r $REALM_NAME -s ifResourceExists=SKIP -o -f /tmp/users.json --config /tmp/kcadm.config && \ rm -f /tmp/kcadm.config /tmp/users.json diff --git a/vkpr/keycloak/install/src/unix/formula/formula.sh b/vkpr/keycloak/install/src/unix/formula/formula.sh index d240c4bb..9b088713 100755 --- a/vkpr/keycloak/install/src/unix/formula/formula.sh +++ b/vkpr/keycloak/install/src/unix/formula/formula.sh @@ -13,6 +13,10 @@ runFormula() { checkGlobalConfig $ADMIN_PASSWORD "vkpr123" "keycloak.adminPassword" "KEYCLOAK_ADMIN_PASSWORD" checkGlobalConfig "nginx" "nginx" "keycloak.ingressClassName" "KEYCLOAK_INGRESS" checkGlobalConfig "false" "false" "keycloak.metrics" "METRICS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "keycloak.namespace" "NAMESPACE" + + # External apps values + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "postgresql.namespace" "POSTGRESQL_NAMESPACE" local VKPR_ENV_KEYCLOAK_DOMAIN="keycloak.${VKPR_ENV_DOMAIN}" @@ -44,7 +48,7 @@ installKeycloak(){ echoColor "bold" "$(echoColor "green" "Installing Keycloak...")" $VKPR_YQ eval "$YQ_VALUES" "$VKPR_KEYCLOAK_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_KEYCLOAK_VERSION" \ - --create-namespace -n $VKPR_K8S_NAMESPACE \ + --create-namespace -n $VKPR_ENV_NAMESPACE \ --wait --timeout 10m -f - keycloak bitnami/keycloak } @@ -66,7 +70,7 @@ settingKeycloak(){ .replicaCount = 3 | .serviceDiscovery.enabled = "true" | .serviceDiscovery.protocol = "dns.DNS_PING" | - .serviceDiscovery.properties[0] = "dns_query=\"keycloak-headless.vkpr.svc.cluster.local\"" | + .serviceDiscovery.properties[0] = "dns_query=\"keycloak-headless.'$VKPR_ENV_NAMESPACE'.svc.cluster.local\"" | .proxyAddressForwarding = true | .cache.ownersCount = 3 | .cache.authOwnersCount = 3 @@ -76,7 +80,7 @@ settingKeycloak(){ YQ_VALUES=''$YQ_VALUES' | .metrics.enabled = true | .metrics.serviceMonitor.enabled = true | - .metrics.serviceMonitor.namespace = "vkpr" | + .metrics.serviceMonitor.namespace = "'$VKPR_ENV_NAMESPACE'" | .metrics.serviceMonitor.interval = "30s" | .metrics.serviceMonitor.scrapeTimeout = "30s" | .metrics.serviceMonitor.additionalLabels.release = "prometheus-stack" @@ -90,18 +94,18 @@ configureKeycloakDB(){ local PG_HA="false" validatePostgresqlPassword $PASSWORD [[ $VKPR_ENV_HA == true ]] && PG_HA="true" - if [[ $(checkPodName "postgres-postgresql") != "true" ]]; then + if [[ $(checkPodName $VKPR_ENV_POSTGRESQL_NAMESPACE "postgres-postgresql") != "true" ]]; then echoColor "green" "Initializing postgresql to Keycloak" [[ -f $CURRENT_PWD/vkpr.yaml ]] && cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" rit vkpr postgres install --HA=$PG_HA --password=$PASSWORD --default fi - if [[ $(checkExistingDatabase $PG_USER $PG_PASSWORD $PG_DATABASE_NAME) != "keycloak" ]]; then + if [[ $(checkExistingDatabase $PG_USER $PG_PASSWORD $PG_DATABASE_NAME $VKPR_ENV_POSTGRESQL_NAMESPACE) != "keycloak" ]]; then echoColor "green" "Creating Database Instance in postgresql..." - createDatabase $PG_USER $PG_PASSWORD $PG_DATABASE_NAME + createDatabase $PG_USER $PG_PASSWORD $PG_DATABASE_NAME $VKPR_ENV_POSTGRESQL_NAMESPACE fi - local PG_HOST="postgres-postgresql" - [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_K8S_NAMESPACE | grep pgpool) ]] && PG_HOST="postgres-postgresql-pgpool" + local PG_HOST="postgres-postgresql.$VKPR_ENV_POSTGRESQL_NAMESPACE" + [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_ENV_POSTGRESQL_NAMESPACE | grep pgpool) ]] && PG_HOST="postgres-postgresql-pgpool.$VKPR_ENV_POSTGRESQL_NAMESPACE" YQ_VALUES=''$YQ_VALUES' | .externalDatabase.host = "'$PG_HOST'" | .externalDatabase.port = "5432" | diff --git a/vkpr/keycloak/install/src/utils/keycloak.yaml b/vkpr/keycloak/install/src/utils/keycloak.yaml index ba860a00..d4b04eee 100644 --- a/vkpr/keycloak/install/src/utils/keycloak.yaml +++ b/vkpr/keycloak/install/src/utils/keycloak.yaml @@ -14,3 +14,5 @@ rbac: postgresql: persistence: enabled: false +commonLabels: + vkpr: "true" diff --git a/vkpr/keycloak/remove/src/unix/formula/formula.sh b/vkpr/keycloak/remove/src/unix/formula/formula.sh index 8d34f311..12290d01 100755 --- a/vkpr/keycloak/remove/src/unix/formula/formula.sh +++ b/vkpr/keycloak/remove/src/unix/formula/formula.sh @@ -2,5 +2,7 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing Keycloak...")" - $VKPR_HELM uninstall --namespace $VKPR_K8S_NAMESPACE keycloak + + KEYCLOAK_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=keycloak,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall keycloak -n $KEYCLOAK_NAMESPACE } \ No newline at end of file diff --git a/vkpr/kong/install/src/unix/formula/formula.sh b/vkpr/kong/install/src/unix/formula/formula.sh index d53bb8a2..c4d62fe0 100755 --- a/vkpr/kong/install/src/unix/formula/formula.sh +++ b/vkpr/kong/install/src/unix/formula/formula.sh @@ -10,6 +10,10 @@ runFormula() { checkGlobalConfig "false" "false" "kong.metrics" "METRICS" checkGlobalConfig $KONG_MODE "dbless" "kong.mode" "KONG_DEPLOY" checkGlobalConfig $RBAC_PASSWORD "vkpr123" "kong.rbac.adminPassword" "KONG_RBAC" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "kong.namespace" "NAMESPACE" + + # External apps values + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "postgresql.namespace" "POSTGRESQL_NAMESPACE" startInfos addRepoKong @@ -48,27 +52,40 @@ createKongSecrets() { [[ $LICENSE = " " ]] && LICENSE="license" local LICENSE_CONTENT=$(cat $LICENSE 2> /dev/null) echoColor "green" "Creating the Kong Secrets..." - $VKPR_KUBECTL create ns vkpr 2> /dev/null - $VKPR_KUBECTL create secret generic kong-enterprise-license --from-literal="license=$LICENSE_CONTENT" -n $VKPR_K8S_NAMESPACE + $VKPR_KUBECTL create ns $VKPR_ENV_NAMESPACE 2> /dev/null + + $VKPR_KUBECTL create secret generic kong-enterprise-license --from-literal="license=$LICENSE_CONTENT" -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL label secret kong-enterprise-license vkpr=true app.kubernetes.io/instance=kong -n $VKPR_ENV_NAMESPACE + if [[ $VKPR_ENV_KONG_DEPLOY != "dbless" ]]; then $VKPR_KUBECTL create secret generic kong-session-config \ --from-file=config/admin_gui_session_conf \ - --from-file=config/portal_session_conf -n $VKPR_K8S_NAMESPACE + --from-file=config/portal_session_conf -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL label secret kong-session-config vkpr=true app.kubernetes.io/instance=kong -n $VKPR_ENV_NAMESPACE fi + if [[ $VKPR_ENV_KONG_DEPLOY = "hybrid" ]]; then $VKPR_KUBECTL create ns kong - $VKPR_KUBECTL create secret tls kong-cluster-cert --cert=config/cluster.crt --key=config/cluster.key -n $VKPR_K8S_NAMESPACE + + $VKPR_KUBECTL create secret tls kong-cluster-cert --cert=config/cluster.crt --key=config/cluster.key -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL label secret kong-cluster-cert vkpr=true app.kubernetes.io/instance=kong -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL create secret tls kong-cluster-cert --cert=config/cluster.crt --key=config/cluster.key -n kong + $VKPR_KUBECTL label secret kong-cluster-cert vkpr=true app.kubernetes.io/instance=kong -n kong + $VKPR_KUBECTL create secret generic kong-enterprise-license --from-file=$LICENSE -n kong + $VKPR_KUBECTL label secret kong-enterprise-license vkpr=true app.kubernetes.io/instance=kong -n kong fi + rm -rf $(dirname "$0")/config/ } installDB(){ local PG_HA="false" [[ $VKPR_ENV_HA == true ]] && PG_HA="true" - if [[ $(checkPodName "postgres-postgresql") != "true" ]]; then + if [[ $(checkPodName $VKPR_ENV_POSTGRESQL_NAMESPACE "postgres-postgresql") != "true" ]]; then echoColor "green" "Initializing postgresql to Kong" + [[ -f $CURRENT_PWD/vkpr.yaml ]] && cp $CURRENT_PWD/vkpr.yaml "$(dirname "$0")" rit vkpr postgres install --HA=$PG_HA --default else echoColor "green" "Initializing Kong with Postgres already created" @@ -97,7 +114,7 @@ installKong(){ echoColor "bold" "$(echoColor "green" "Installing Kong...")" $VKPR_YQ eval "$YQ_VALUES" "$VKPR_KONG_VALUES" \ - | $VKPR_HELM upgrade -i --wait --create-namespace -n $VKPR_K8S_NAMESPACE \ + | $VKPR_HELM upgrade -i --wait --create-namespace -n $VKPR_ENV_NAMESPACE \ --version $VKPR_KONG_VERSION -f - kong kong/kong if [[ $VKPR_ENV_METRICS = true ]]; then @@ -106,8 +123,19 @@ installKong(){ } settingKongDefaults() { - local PG_HOST="postgres-postgresql" - [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_K8S_NAMESPACE | grep pgpool) ]] && PG_HOST="postgres-postgresql-pgpool" YQ_VALUES=''$YQ_VALUES' | .env.pg_password.valueFrom.secretKeyRef.name = "postgres-postgresql-postgresql"' + local PG_HOST="postgres-postgresql.$VKPR_ENV_POSTGRESQL_NAMESPACE" + local PG_SECRET="postgres-postgresql" + + if [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_ENV_POSTGRESQL_NAMESPACE | grep pgpool) ]]; then + PG_HOST="postgres-postgresql-pgpool.$VKPR_ENV_POSTGRESQL_NAMESPACE" + PG_SECRET="postgres-postgresql-postgresql" + YQ_VALUES=''$YQ_VALUES' | .env.pg_password.valueFrom.secretKeyRef.name = "'$PG_SECRET'"' + fi + + $VKPR_KUBECTL get secret $PG_SECRET -o yaml -n $VKPR_ENV_POSTGRESQL_NAMESPACE | $VKPR_YQ e '.metadata.namespace = "vkpr"' - |\ + $VKPR_KUBECTL apply -f - -n $VKPR_ENV_NAMESPACE + $VKPR_KUBECTL label secret $PG_SECRET vkpr=true app.kubernetes.io/instance=kong -n $VKPR_ENV_NAMESPACE + YQ_VALUES=''$YQ_VALUES' | .env.pg_host = "'$PG_HOST'" ' @@ -148,7 +176,7 @@ settingKongDefaults() { if [[ $VKPR_ENV_METRICS == "true" ]]; then YQ_VALUES=''$YQ_VALUES' | .serviceMonitor.enabled = true | - .serviceMonitor.namespace = "vkpr" | + .serviceMonitor.namespace = "'$VKPR_ENV_NAMESPACE'" | .serviceMonitor.interval = "30s" | .serviceMonitor.scrapeTimeout = "30s" | .serviceMonitor.labels.release = "prometheus-stack" | @@ -178,7 +206,8 @@ settingKongDefaults() { } settingKongEnterprise() { - $VKPR_KUBECTL create secret generic kong-enterprise-superuser-password -n $VKPR_K8S_NAMESPACE --from-literal="password=$VKPR_ENV_KONG_RBAC" + $VKPR_KUBECTL create secret generic kong-enterprise-superuser-password -n $VKPR_ENV_NAMESPACE --from-literal="password=$VKPR_ENV_KONG_RBAC" + $VKPR_KUBECTL label secret kong-enterprise-superuser-password vkpr=true app.kubernetes.io/instance=kong -n $VKPR_ENV_NAMESPACE if [[ $ENTERPRISE = true ]]; then YQ_VALUES=''$YQ_VALUES' | .image.repository = "kong/kong-gateway" | diff --git a/vkpr/kong/install/src/utils/kong-cp.yaml b/vkpr/kong/install/src/utils/kong-cp.yaml index af739508..66849ed1 100644 --- a/vkpr/kong/install/src/utils/kong-cp.yaml +++ b/vkpr/kong/install/src/utils/kong-cp.yaml @@ -1,5 +1,7 @@ # ----------------------------------------------------------------------------- # Kong parameters +podLabels: + vkpr: "true" secretVolumes: - kong-cluster-cert env: diff --git a/vkpr/kong/install/src/utils/kong-dbless.yaml b/vkpr/kong/install/src/utils/kong-dbless.yaml index 466bfff5..5a0980ee 100644 --- a/vkpr/kong/install/src/utils/kong-dbless.yaml +++ b/vkpr/kong/install/src/utils/kong-dbless.yaml @@ -1,5 +1,7 @@ # ----------------------------------------------------------------------------- # Kong parameters +podLabels: + vkpr: "true" env: database: "off" log_level: notice diff --git a/vkpr/kong/install/src/utils/kong-dp.yaml b/vkpr/kong/install/src/utils/kong-dp.yaml index 0e57c1e7..ebfb1cca 100644 --- a/vkpr/kong/install/src/utils/kong-dp.yaml +++ b/vkpr/kong/install/src/utils/kong-dp.yaml @@ -1,5 +1,7 @@ # ----------------------------------------------------------------------------- # Kong parameters +podLabels: + vkpr: "true" secretVolumes: - kong-cluster-cert env: diff --git a/vkpr/kong/install/src/utils/kong.yaml b/vkpr/kong/install/src/utils/kong.yaml index 1f3a6d7e..4f9aa618 100644 --- a/vkpr/kong/install/src/utils/kong.yaml +++ b/vkpr/kong/install/src/utils/kong.yaml @@ -1,5 +1,7 @@ # ----------------------------------------------------------------------------- # Kong parameters +podLabels: + vkpr: "true" env: log_level: notice database: postgres diff --git a/vkpr/kong/install/src/utils/prometheus-plugin.yaml b/vkpr/kong/install/src/utils/prometheus-plugin.yaml index e55ee1a5..ef450cf9 100644 --- a/vkpr/kong/install/src/utils/prometheus-plugin.yaml +++ b/vkpr/kong/install/src/utils/prometheus-plugin.yaml @@ -6,6 +6,5 @@ metadata: kubernetes.io/ingress.class: kong labels: global: "true" -config: - enabled: true + vkpr: "true" plugin: prometheus diff --git a/vkpr/kong/remove/src/unix/formula/formula.sh b/vkpr/kong/remove/src/unix/formula/formula.sh index 682a2ac4..7d7a59d2 100755 --- a/vkpr/kong/remove/src/unix/formula/formula.sh +++ b/vkpr/kong/remove/src/unix/formula/formula.sh @@ -2,8 +2,11 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing Kong...")" - $VKPR_HELM uninstall kong -n $VKPR_K8S_NAMESPACE - $VKPR_KUBECTL delete secret kong-session-config kong-enterprise-license kong-cluster-cert kong-enterprise-superuser-password -n $VKPR_K8S_NAMESPACE 2> /dev/null + + KONG_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=kong,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall kong -n $KONG_NAMESPACE + $VKPR_KUBECTL delete secret -A -l app.kubernetes.io/instance=kong,vkpr=true 2> /dev/null + $VKPR_HELM uninstall kong-dp -n kong 2> /dev/null $VKPR_KUBECTL delete ns kong 2> /dev/null } diff --git a/vkpr/loki/install/src/unix/formula/formula.sh b/vkpr/loki/install/src/unix/formula/formula.sh index 4a96f28a..d87e0e99 100755 --- a/vkpr/loki/install/src/unix/formula/formula.sh +++ b/vkpr/loki/install/src/unix/formula/formula.sh @@ -4,6 +4,10 @@ runFormula() { local VKPR_LOKI_VALUES=$(dirname "$0")/utils/loki.yaml checkGlobalConfig "false" "false" "loki.metrics" "METRICS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "loki.namespace" "NAMESPACE" + + # External app values + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "prometheus-stack.namespace" "GRAFANA_NAMESPACE" startInfos addRepLoki @@ -27,14 +31,14 @@ installLoki(){ settingLoki $VKPR_YQ eval "$YQ_VALUES" "$VKPR_LOKI_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_LOKI_VERSION" \ - --create-namespace --namespace $VKPR_K8S_NAMESPACE\ + --create-namespace --namespace $VKPR_ENV_NAMESPACE\ --wait -f - loki-stack grafana/loki-stack } existGrafana() { - if [[ $(checkPodName "prometheus-stack-grafana") = "true" ]]; then - local LOGINGRAFANA="$($VKPR_KUBECTL get secret --namespace $VKPR_K8S_NAMESPACE prometheus-stack-grafana -o yaml \ - | $VKPR_YQ eval '.data.admin-user' - | base64 -d):$($VKPR_KUBECTL get secret --namespace $VKPR_K8S_NAMESPACE prometheus-stack-grafana -o yaml | $VKPR_YQ eval '.data.admin-password' - | base64 -d)" + if [[ $(checkPodName $VKPR_ENV_GRAFANA_NAMESPACE "prometheus-stack-grafana") = "true" ]]; then + local LOGINGRAFANA="$($VKPR_KUBECTL get secret --namespace $VKPR_ENV_GRAFANA_NAMESPACE prometheus-stack-grafana -o yaml \ + | $VKPR_YQ eval '.data.admin-user' - | base64 -d):$($VKPR_KUBECTL get secret --namespace $VKPR_ENV_GRAFANA_NAMESPACE prometheus-stack-grafana -o yaml | $VKPR_YQ eval '.data.admin-password' - | base64 -d)" local TOKEN_API_GRAFANA=$(curl -sk -X POST -H "Host: grafana.${VKPR_ENV_DOMAIN}" -H "Content-Type: application/json" \ -d '{"name": "apikeycurl","role": "Admin"}' http://$LOGINGRAFANA@127.0.0.1:8000/api/auth/keys | $VKPR_JQ --raw-output '.key') @@ -50,7 +54,7 @@ existGrafana() { -d '{ "name":"loki", "type":"loki", - "url":"loki-stack.'$VKPR_K8S_NAMESPACE'.svs.cluster.local:3100", + "url":"loki-stack.'$VKPR_ENV_NAMESPACE'.svc.cluster.local:3100", "access":"proxy", "basicAuth":false, "editable": true diff --git a/vkpr/loki/install/src/utils/loki.yaml b/vkpr/loki/install/src/utils/loki.yaml index bbe536c9..68edf4a9 100644 --- a/vkpr/loki/install/src/utils/loki.yaml +++ b/vkpr/loki/install/src/utils/loki.yaml @@ -1,2 +1,4 @@ loki: enabled: true + podLabels: + vkpr: "true" diff --git a/vkpr/loki/remove/src/unix/formula/formula.sh b/vkpr/loki/remove/src/unix/formula/formula.sh index c3fa8bd7..47e49fa1 100755 --- a/vkpr/loki/remove/src/unix/formula/formula.sh +++ b/vkpr/loki/remove/src/unix/formula/formula.sh @@ -1,6 +1,8 @@ #!/bin/sh runFormula() { - echoColor "bold" "$(echoColor "green" "Removing whoami...")" - $VKPR_HELM uninstall --namespace $VKPR_K8S_NAMESPACE loki-stack + echoColor "bold" "$(echoColor "green" "Removing Loki...")" + + LOKI_NAMESPACE=$($VKPR_KUBECTL get po -A -l release=loki-stack,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall --namespace $LOKI_NAMESPACE loki-stack } diff --git a/vkpr/postgres/createdb/src/unix/formula/formula.sh b/vkpr/postgres/createdb/src/unix/formula/formula.sh index d003d3aa..7341c58b 100755 --- a/vkpr/postgres/createdb/src/unix/formula/formula.sh +++ b/vkpr/postgres/createdb/src/unix/formula/formula.sh @@ -2,11 +2,15 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Creating database $DBNAME in postgresql...")" + local PG_PASSWORD=$($VKPR_JQ -r '.credential.password' ~/.rit/credentials/default/postgres) local PG_HOST="postgres-postgresql" - if [[ $(checkPodName "postgres-postgresql") = "true" ]]; then - [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_K8S_NAMESPACE | grep pgpool) ]] && PG_HOST="postgres-postgresql-pgpool" - $VKPR_KUBECTL run init-db --rm -it --restart="Never" --namespace $VKPR_K8S_NAMESPACE --image docker.io/bitnami/postgresql-repmgr:11.14.0-debian-10-r12 --env="PGUSER=postgres" --env="PGPASSWORD=$PG_PASSWORD" --env="PGHOST=${PG_HOST}" --env="PGPORT=5432" --env="PGDATABASE=postgres" \ + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "postgresql.namespace" "NAMESPACE" + + if [[ $(checkPodName $VKPR_ENV_NAMESPACE "postgres-postgresql") = "true" ]]; then + [[ ! -z $($VKPR_KUBECTL get pod -n $VKPR_ENV_NAMESPACE | grep pgpool) ]] && PG_HOST="postgres-postgresql-pgpool" + $VKPR_KUBECTL run init-db --rm -it --restart="Never" --namespace $VKPR_ENV_NAMESPACE --image docker.io/bitnami/postgresql-repmgr:11.14.0-debian-10-r12 --env="PGUSER=postgres" --env="PGPASSWORD=$PG_PASSWORD" --env="PGHOST=${PG_HOST}" --env="PGPORT=5432" --env="PGDATABASE=postgres" \ --command -- psql -c '\x' -c "CREATE USER $DBUSER WITH ENCRYPTED PASSWORD '$DBPASSWORD';" -c "CREATE DATABASE $DBNAME;" -c "GRANT ALL PRIVILEGES ON DATABASE $DBNAME TO $DBUSER" else echoColor "red" "Error, Postgresql doesn't up or installed yet" diff --git a/vkpr/postgres/install/src/unix/formula/formula.sh b/vkpr/postgres/install/src/unix/formula/formula.sh index 9bf650d3..23439cd7 100755 --- a/vkpr/postgres/install/src/unix/formula/formula.sh +++ b/vkpr/postgres/install/src/unix/formula/formula.sh @@ -5,6 +5,7 @@ runFormula() { checkGlobalConfig $HA "false" "postgresql.HA" "HA" checkGlobalConfig "false" "false" "postgresql.metrics" "METRICS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "postgresql.namespace" "NAMESPACE" validatePostgresqlPassword $PASSWORD @@ -32,7 +33,7 @@ installPostgres(){ settingPostgres $VKPR_YQ eval "$YQ_VALUES" "$VKPR_POSTGRES_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_POSTGRES_VERSION" \ - --create-namespace --namespace $VKPR_K8S_NAMESPACE \ + --create-namespace --namespace $VKPR_ENV_NAMESPACE \ --wait -f - postgresql bitnami/$POSTGRESQL_CHART } @@ -47,9 +48,11 @@ settingPostgres() { .postgresql.repmgrDatabase = "postgres" | .postgresql.postgresPassword = "'$PASSWORD'" | .postgresql.replicaCount = 3 | + .postgresql.podLabels.vkpr = "true" | .pgpool.adminUsername = "postgres" | .pgpool.adminPassword = "'$PASSWORD'" | - .pgpool.replicaCount = 3 + .pgpool.replicaCount = 3 | + .primary = {} ' POSTGRESQL_CHART="postgresql-ha" else @@ -63,7 +66,7 @@ settingPostgres() { YQ_VALUES=''$YQ_VALUES' | .metrics.enabled = true | .metrics.serviceMonitor.enabled = true | - .metrics.serviceMonitor.namespace = "vkpr" | + .metrics.serviceMonitor.namespace = "'$VKPR_ENV_NAMESPACE'" | .metrics.serviceMonitor.interval = "1m" | .metrics.serviceMonitor.scrapeTimeout = "30m" ' diff --git a/vkpr/postgres/install/src/utils/postgres.yaml b/vkpr/postgres/install/src/utils/postgres.yaml index 6090df56..2666475e 100644 --- a/vkpr/postgres/install/src/utils/postgres.yaml +++ b/vkpr/postgres/install/src/utils/postgres.yaml @@ -1,2 +1,5 @@ volumePermissions: enabled: true +primary: + podLabels: + vkpr: "true" diff --git a/vkpr/postgres/remove/src/unix/formula/formula.sh b/vkpr/postgres/remove/src/unix/formula/formula.sh index 329310b3..706ab762 100755 --- a/vkpr/postgres/remove/src/unix/formula/formula.sh +++ b/vkpr/postgres/remove/src/unix/formula/formula.sh @@ -7,11 +7,12 @@ runFormula() { removePostgres(){ echoColor "bold" "$(echoColor "green" "Removing Postgresql...")" - $VKPR_HELM uninstall --namespace $VKPR_K8S_NAMESPACE postgresql + + POSTGRESQL_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=postgresql,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall --namespace $POSTGRESQL_NAMESPACE postgresql } removePVC(){ echoColor "bold" "$(echoColor "green" "Removing PVC...")" - $VKPR_KUBECTL delete pvc --namespace $VKPR_K8S_NAMESPACE -l app.kubernetes.io/instance=postgresql - $VKPR_KUBECTL delete pvc --namespace $VKPR_K8S_NAMESPACE -l app=postgresql + $VKPR_KUBECTL delete pvc -A -l app.kubernetes.io/instance=postgresql } diff --git a/vkpr/prometheus-stack/import/src/unix/formula/formula.sh b/vkpr/prometheus-stack/import/src/unix/formula/formula.sh index b8bd7453..34752b2e 100755 --- a/vkpr/prometheus-stack/import/src/unix/formula/formula.sh +++ b/vkpr/prometheus-stack/import/src/unix/formula/formula.sh @@ -3,8 +3,11 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Importing Dashboard...")" local JSON_FILE=$(cat $DASHBOARD_PATH) + + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "prometheus-stack.namespace" "NAMESPACE" + dashboard="$DASHBOARD_NAME-grafana" $VKPR_YQ eval '(.metadata.name, .metadata.labels.app) = strenv(dashboard)' $(dirname "$0")/utils/dashboard.yaml > $DASHBOARD_NAME.yaml - $VKPR_YQ eval -i '.metadata.namespace = "'$VKPR_K8S_NAMESPACE'"' $DASHBOARD_NAME.yaml + $VKPR_YQ eval -i '.metadata.namespace = "'$VKPR_ENV_NAMESPACE'"' $DASHBOARD_NAME.yaml $VKPR_YQ eval '.data.["'$DASHBOARD_NAME.json'"] = ('"$JSON_FILE"' | to_json)' $DASHBOARD_NAME.yaml \ | $VKPR_KUBECTL apply -f - rm $DASHBOARD_NAME.yaml diff --git a/vkpr/prometheus-stack/import/src/utils/dashboard.yaml b/vkpr/prometheus-stack/import/src/utils/dashboard.yaml index 58374d5f..2d41f228 100644 --- a/vkpr/prometheus-stack/import/src/utils/dashboard.yaml +++ b/vkpr/prometheus-stack/import/src/utils/dashboard.yaml @@ -5,3 +5,4 @@ metadata: labels: app: name-grafana grafana_dashboard: "true" + vkpr: "true" diff --git a/vkpr/prometheus-stack/install/src/unix/formula/formula.sh b/vkpr/prometheus-stack/install/src/unix/formula/formula.sh index f40fe659..9110846d 100755 --- a/vkpr/prometheus-stack/install/src/unix/formula/formula.sh +++ b/vkpr/prometheus-stack/install/src/unix/formula/formula.sh @@ -10,7 +10,11 @@ runFormula() { checkGlobalConfig $GRAFANA_PASSWORD "vkpr123" "prometheus-stack.grafana.adminPassword" "GRAFANA_PASSWORD" checkGlobalConfig "nginx" "nginx" "prometheus-stack.ingressClassName" "PROMETHEUS_INGRESS" checkGlobalConfig "true" "true" "prometheus-stack.grafana.k8sExporters" "K8S_EXPORTERS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "prometheus-stack.namespace" "NAMESPACE" + # External app values + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "loki.namespace" "LOKI_NAMESPACE" + local VKPR_ENV_GRAFANA_DOMAIN="grafana.${VKPR_ENV_DOMAIN}" local VKPR_ENV_ALERT_MANAGER_DOMAIN="alertmanager.${VKPR_ENV_DOMAIN}" @@ -40,7 +44,7 @@ installPrometheusStack() { settingStack $VKPR_YQ eval "$YQ_VALUES" "$VKPR_PROMETHEUS_VALUES" \ | $VKPR_HELM upgrade -i --wait --version "$VKPR_PROMETHEUS_STACK_VERSION" \ - --create-namespace --namespace $VKPR_K8S_NAMESPACE \ + --create-namespace --namespace $VKPR_ENV_NAMESPACE \ -f - prometheus-stack prometheus-community/kube-prometheus-stack } @@ -92,11 +96,11 @@ settingStack() { .nodeExporter.enabled = true ' fi - if [[ $(checkPodName "loki-stack") = "true" ]]; then + if [[ $(checkPodName $VKPR_ENV_LOKI_NAMESPACE "loki-stack") = "true" ]]; then YQ_VALUES=''$YQ_VALUES' | .grafana.additionalDataSources[0].name = "Loki" | .grafana.additionalDataSources[0].type = "loki" | - .grafana.additionalDataSources[0].url = "http://loki-stack:3100" | + .grafana.additionalDataSources[0].url = "http://loki-stack.'$VKPR_ENV_LOKI_NAMESPACE':3100" | .grafana.additionalDataSources[0].access = "proxy" | .grafana.additionalDataSources[0].basicAuth = false | .grafana.additionalDataSources[0].editable = true diff --git a/vkpr/prometheus-stack/install/src/utils/prometheus-stack.yaml b/vkpr/prometheus-stack/install/src/utils/prometheus-stack.yaml index 993cf11a..b5fddaa2 100644 --- a/vkpr/prometheus-stack/install/src/utils/prometheus-stack.yaml +++ b/vkpr/prometheus-stack/install/src/utils/prometheus-stack.yaml @@ -1,3 +1,5 @@ +commonLabels: + vkpr: "true" alertmanager: enabled: false ingress: diff --git a/vkpr/prometheus-stack/remove/src/unix/formula/formula.sh b/vkpr/prometheus-stack/remove/src/unix/formula/formula.sh index cf42cbdc..30eae235 100755 --- a/vkpr/prometheus-stack/remove/src/unix/formula/formula.sh +++ b/vkpr/prometheus-stack/remove/src/unix/formula/formula.sh @@ -2,6 +2,8 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing Prometheus-stack...")" - $VKPR_HELM uninstall --namespace $VKPR_K8S_NAMESPACE prometheus-stack - $VKPR_KUBECTL delete cm -n $VKPR_K8S_NAMESPACE -l grafana_dashboard=true > /dev/null + + PROMETHEUS_STACK_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=prometheus-stack,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall --namespace $PROMETHEUS_STACK_NAMESPACE prometheus-stack + $VKPR_KUBECTL delete cm -A -l grafana_dashboard=true,vkpr=true > /dev/null } diff --git a/vkpr/vault/install/src/unix/formula/formula.sh b/vkpr/vault/install/src/unix/formula/formula.sh index 19a8ff49..5e1c7416 100755 --- a/vkpr/vault/install/src/unix/formula/formula.sh +++ b/vkpr/vault/install/src/unix/formula/formula.sh @@ -10,6 +10,10 @@ runFormula() { checkGlobalConfig $VAULT_MODE "raft" "vault.storageMode" "VAULT_MODE" checkGlobalConfig $VAULT_AUTO_UNSEAL "false" "vault.autoUnseal" "VAULT_AUTO_UNSEAL" checkGlobalConfig "nginx" "nginx" "vault.ingressClassName" "VAULT_INGRESS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "vault.namespace" "NAMESPACE" + + # External app values + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "consul.namespace" "CONSUL_NAMESPACE" local VKPR_ENV_VAULT_DOMAIN="vault.${VKPR_ENV_DOMAIN}" @@ -48,6 +52,7 @@ settingVault() { fi if [[ $VKPR_ENV_VAULT_AUTO_UNSEAL != false ]]; then + $VKPR_KUBECTL create ns $VKPR_ENV_NAMESPACE 2> /dev/null YQ_VALUES=''$YQ_VALUES' | .server.extraEnvironmentVars.VAULT_LOG_LEVEL = "debug" ' @@ -75,12 +80,13 @@ settingVault() { validateAwsAccessKey $AWS_ACCESS_KEY validateAwsRegion $AWS_REGION $VKPR_YQ eval '.metadata.name = "aws-unseal-vault" | + .metadata.namespace = "'$VKPR_ENV_NAMESPACE'" | .data.AWS_REGION = "'$(echo -n $($VKPR_JQ -r .credential.accesskeyid $RIT_CREDENTIALS_PATH/aws) | base64)'" | .data.AWS_ACCESS_KEY = "'$(echo -n $($VKPR_JQ -r .credential.secretaccesskey $RIT_CREDENTIALS_PATH/aws) | base64)'" | .data.AWS_SECRET_KEY = "'$(echo -n $($VKPR_JQ -r .credential.awsregion $RIT_CREDENTIALS_PATH/aws) | base64)'" | .data.AWS_KMS_KEY_ID = "'$(echo -n $($VKPR_JQ -r .credential.kmskeyid $RIT_CREDENTIALS_PATH/aws) | base64)'" | .data.AWS_KMS_ENDPOINT = "'$(echo -n $($VKPR_JQ -r .credential.kmsendpoint $RIT_CREDENTIALS_PATH/aws) | base64)'" - ' $(dirname "$0")/utils/auto-unseal.yaml + ' $(dirname "$0")/utils/auto-unseal.yaml | $VKPR_KUBECTL apply -f - ;; azure) YQ_VALUES=''$YQ_VALUES' | @@ -102,12 +108,13 @@ settingVault() { .server.extraSecretEnvironmentVars[4].secretKey = "VAULT_AZUREKEYVAULT_KEY_NAME" ' $VKPR_YQ eval '.metadata.name = "azure-unseal-vault" | + .metadata.namespace = "'$VKPR_ENV_NAMESPACE'" | .data.AZURE_TENANT_ID = "'$(echo -n $($VKPR_JQ -r .credential.azuretenantid $RIT_CREDENTIALS_PATH/azure) | base64)'" | .data.AZURE_CLIENT_ID = "'$(echo -n $($VKPR_JQ -r .credential.azureclientid $RIT_CREDENTIALS_PATH/azure) | base64)'" | .data.AZURE_CLIENT_SECRET = "'$(echo -n $($VKPR_JQ -r .credential.azureclientsecret $RIT_CREDENTIALS_PATH/azure) | base64)'" | .data.VAULT_AZUREKEYVAULT_VAULT_NAME = "'$(echo -n $($VKPR_JQ -r .credential.vaultazurekeyvaultvaultname $RIT_CREDENTIALS_PATH/azure) | base64)'" | .data.VAULT_AZUREKEYVAULT_KEY_NAME = "'$(echo -n $($VKPR_JQ -r .credential.vaultazurekeyvaultkeyname $RIT_CREDENTIALS_PATH/azure) | base64)'" - ' $(dirname "$0")/utils/auto-unseal.yaml + ' $(dirname "$0")/utils/auto-unseal.yaml | $VKPR_KUBECTL apply -f - ;; esac fi @@ -123,7 +130,7 @@ settingVault() { else printf 'storage "consul" { path = "vault" - address = "consul-consul-server.vkpr.svc.cluster.local:8500" + address = "consul-consul-server.'$VKPR_ENV_CONSUL_NAMESPACE'.svc.cluster.local:8500" }' >> $VKPR_VAULT_CONFIG fi @@ -136,8 +143,10 @@ installVault() { settingVault $VKPR_YQ eval "$YQ_VALUES" "$VKPR_VAULT_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_VAULT_VERSION" \ - --namespace $VKPR_K8S_NAMESPACE --create-namespace \ + --namespace $VKPR_ENV_NAMESPACE --create-namespace \ --wait -f - vault hashicorp/vault + echoColor "bold" "$(echoColor "green" "Creating storage config...")" - $VKPR_KUBECTL create secret generic vault-storage-config -n $VKPR_K8S_NAMESPACE --from-file=$VKPR_VAULT_CONFIG + $VKPR_KUBECTL create secret generic vault-storage-config -n $VKPR_ENV_NAMESPACE --from-file=$VKPR_VAULT_CONFIG + $VKPR_KUBECTL label secret vault-storage-config vkpr=true app.kubernetes.io/instance=vault -n $VKPR_ENV_NAMESPACE } \ No newline at end of file diff --git a/vkpr/vault/install/src/utils/auto-unseal.yaml b/vkpr/vault/install/src/utils/auto-unseal.yaml index cc7c8215..1f643769 100644 --- a/vkpr/vault/install/src/utils/auto-unseal.yaml +++ b/vkpr/vault/install/src/utils/auto-unseal.yaml @@ -2,4 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: auto-unseal + labels: + app.kubernetes.io/instance: vault + vkpr: "true" type: Opaque diff --git a/vkpr/vault/install/src/utils/vault.yaml b/vkpr/vault/install/src/utils/vault.yaml index 945f1125..ec78f669 100644 --- a/vkpr/vault/install/src/utils/vault.yaml +++ b/vkpr/vault/install/src/utils/vault.yaml @@ -4,6 +4,8 @@ global: injector: enabled: true server: + extraLabels: + vkpr: "true" volumes: - name: vault-storage-config secret: diff --git a/vkpr/vault/remove/src/unix/formula/formula.sh b/vkpr/vault/remove/src/unix/formula/formula.sh index 6a69e1b9..96880b7e 100755 --- a/vkpr/vault/remove/src/unix/formula/formula.sh +++ b/vkpr/vault/remove/src/unix/formula/formula.sh @@ -2,8 +2,8 @@ runFormula() { echoColor "bold" "$(echoColor "green" "Removing Vault...")" - $VKPR_HELM uninstall vault -n $VKPR_K8S_NAMESPACE - $VKPR_KUBECTL delete secret vault-storage-config -n $VKPR_K8S_NAMESPACE - $VKPR_KUBECTL delete secret aws-unseal-vault -n $VKPR_K8S_NAMESPACE - #$VKPR_KUBECTL delete pvc -l app.kubernetes.io/instance=vault -n $VKPR_K8S_NAMESPACE + + VAULT_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=vault,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall vault -n $VAULT_NAMESPACE + $VKPR_KUBECTL delete secret -A -l app.kubernetes.io/instance=vault,vkpr=true } diff --git a/vkpr/whoami/install/src/unix/formula/formula.sh b/vkpr/whoami/install/src/unix/formula/formula.sh index 7037dc09..f715c75d 100755 --- a/vkpr/whoami/install/src/unix/formula/formula.sh +++ b/vkpr/whoami/install/src/unix/formula/formula.sh @@ -6,6 +6,7 @@ runFormula() { checkGlobalConfig $DOMAIN "localhost" "domain" "DOMAIN" checkGlobalConfig $SECURE "false" "secure" "SECURE" checkGlobalConfig "nginx" "nginx" "whoami.ingressClassName" "WHOAMI_INGRESS" + checkGlobalConfig $VKPR_K8S_NAMESPACE "vkpr" "whoami.namespace" "NAMESPACE" local VKPR_ENV_WHOAMI_DOMAIN="whoami.${VKPR_ENV_DOMAIN}" @@ -47,6 +48,6 @@ installWhoami() { settingWhoami $VKPR_YQ eval "$YQ_VALUES" "$VKPR_WHOAMI_VALUES" \ | $VKPR_HELM upgrade -i --version "$VKPR_WHOAMI_VERSION" \ - --create-namespace -n $VKPR_K8S_NAMESPACE \ + --create-namespace -n $VKPR_ENV_NAMESPACE \ --wait -f - whoami cowboysysop/whoami } \ No newline at end of file diff --git a/vkpr/whoami/install/src/utils/whoami.yaml b/vkpr/whoami/install/src/utils/whoami.yaml index ad5f9744..3df0f743 100644 --- a/vkpr/whoami/install/src/utils/whoami.yaml +++ b/vkpr/whoami/install/src/utils/whoami.yaml @@ -5,3 +5,5 @@ ingress: hosts: - paths: ["/"] pathType: Prefix +podLabels: + vkpr: "true" diff --git a/vkpr/whoami/remove/src/unix/formula/formula.sh b/vkpr/whoami/remove/src/unix/formula/formula.sh index 77051499..76965966 100755 --- a/vkpr/whoami/remove/src/unix/formula/formula.sh +++ b/vkpr/whoami/remove/src/unix/formula/formula.sh @@ -1,14 +1,8 @@ #!/bin/sh runFormula() { - uninstallWhoami -} - -uninstallWhoami(){ echoColor "bold" "$(echoColor "green" "Removing whoami...")" - $VKPR_HELM uninstall whoami -n $VKPR_K8S_NAMESPACE - local EXISTING_CERT=$($VKPR_KUBECTL get secret/whoami-cert -n $VKPR_K8S_NAMESPACE -o name --ignore-not-found | cut -d "/" -f2) - if [[ $EXISTING_CERT = "whoami-cert" ]]; then - $VKPR_KUBECTL delete secret -n $VKPR_K8S_NAMESPACE whoami-cert - fi + + WHOAMI_NAMESPACE=$($VKPR_KUBECTL get po -A -l app.kubernetes.io/instance=whoami,vkpr=true -o=yaml | $VKPR_YQ e ".items[].metadata.namespace" - | head -n1) + $VKPR_HELM uninstall whoami -n $WHOAMI_NAMESPACE } \ No newline at end of file From a39cc4e92a4318b3b69ab7bdd78eae1e6675db3e Mon Sep 17 00:00:00 2001 From: Juan Carlos Suarez <70165801+xJCPMSx@users.noreply.github.com> Date: Tue, 15 Feb 2022 11:59:01 -0300 Subject: [PATCH 5/8] fix(docs): update README.md --- README.md | 80 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index e1f686e2..74759b7b 100755 --- a/README.md +++ b/README.md @@ -7,18 +7,18 @@ VKPR-CLI is Tool build with Shell that has the objetive to make it easier for th VKPR-CLI also helps the local development by using k3d to fully provision a Kubernetes cluster instance for testing purposes. -- [VKPR-CLI](#vkpr-cli-tool) - - [Why Ritchie](##Why-Ritchie?) - - [Minimum Required](##Minimum-required) - - [Get VKPR](##Get-VKPR) - - [Usage](##Usage) - - [Initializate](###Init) - - [Create a cluster](###Create-a-cluster) - - [Running the scripts](###Running-the-scripts) - - [Uninstalling the objects](###Uninstalling-the-objects) - - [Tools](##Apps) - - [Documentation](##Docs) - - [License](##License) +- [VKPR-CLI](#vkpr-cli) + - [Why Ritchie](#why-ritchie) + - [Minimum Required](#minimum-required) + - [Setup VKPR](#setup-vkpr) + - [Usage](#usage) + - [Initializate](#init) + - [Create a cluster](#create-a-cluster) + - [Deploy a sample app](deploy-a-sample-app) + - [Uninstalling the objects](#uninstalling-the-objects) + - [Tools](#apps) + - [Documentation](#docs) + - [License](#license) ## Why Ritchie? @@ -35,15 +35,14 @@ VKPR-CLI was made to run on Linux / MacOS. It's pre-requisites are: - [Docker](https://docs.docker.com/get-docker/) - [Git](https://git-scm.com/downloads) -## Get VKPR +## Setup VKPR -The VKPR CLI tool will do its best to hide its internals (including Ritchie). +VKPR was built on top of Ritchie, but he abstracts most of his interaction with him. To install it, you must run the following command. +### Installing VKPR CLI ```sh -# Install the VKPR curl -fsSL https://get.vkpr.net/ | bash -# Create alias -alias vkpr="rit vkpr" +echo 'alias vkpr="rit vkpr"' >> ~/.bashrc # If you use another Unix Shell, specify your specific source ``` ## Usage @@ -76,23 +75,33 @@ To do that, you can run the command: ```sh vkpr infra up ``` +You can peek into it using ```k9s```: + +``` +~/.vkpr/bin/k9s +``` You can now test your scripts and create your own environments with VKPR commands. -### Running the scripts +### Deploy a sample app -After you have started VKPR and connected to an environment with the Kubernetes cluster, you may be running the scripts. -Scripts follow a standard order of `vkpr + object + verb`. +To test some application using VKPR, we will use whoami as an example. -To start a simple web application, you can run the command: +For this, we will implement an ingress controller and the whoami itself: -```sh -vkpr whoami install ``` +vkpr ingress install +vkpr whoami install --default +``` +Now you can test this sample application with a simple curl command: -In certain commands, there is a quiz on how you want the application to go up. It can be configured, for example, access domains, HTTPS communication and others. After that, this command will create the objects needed to use whoami. +``` +curl whoami.localhost:8000 +# OR +curl -H "Host: whoami.localhost" localhost:8000 +``` -If you don't want to have to be configuring the application, you may be using the `--default` flag to follow the default values +> WARNING: Use the second form if ```whoami.localhost``` does not resolve to ```127.0.0.1``` ### Uninstalling the objects @@ -102,20 +111,37 @@ To be deleting all dependencies of the installed script, it is necessary to run vkpr whoami remove ``` +### Discard cluster + +After all tests, if you want to destroy the created cluster, you may discard his with a single command: + +```sh +vkpr infra down +``` + + + ## Apps | Tools | Description | | ------------------------ | ------------------------------------------------------------- | -| nginx-ingress-controller | Install ingress-nginx | +| ingress | Install nginx-ingress-controller | | whoami | Install whoami | | cert-manager | Install cert-manager to manage your certificates | | external-dns | Install external-dns | | loki | Install Loki for monitoring and tracing | | keycloak | Install Keycloak to manage the identity and access management | +| consul | Install consul to service identities and traditional networking practices to securely connect applications| +| kong | Install kong to manage, configure, and route requests to your APIs.| +| postgres | Install postgres to manage the Database | +| prometheus-stack | Installs the kube-prometheus stack, a collection of Kubernetes manifests | +| vault | Install vault to manage secrets & protect sensitive data | +| argocd | Install argocd to automated the application deployment and lifecycle management| +| aws eks | Install aws to fork and setup the GitOps Repo in your Gitlab | ## Docs -The Documentation can be viewed in the following [link](https://github.com/vertigobr/vkpr-cli). +The Documentation can be viewed in the following [link](https://docs.vkpr.net/). ## License From e6c300fb00ffe547b8c55b8eccfba69981a81553 Mon Sep 17 00:00:00 2001 From: Luan Gazin Date: Tue, 15 Feb 2022 14:52:43 -0300 Subject: [PATCH 6/8] create gitlab env --- vkpr/aws/eks/init/build.sh | 7 +++++-- vkpr/aws/eks/init/src/main.sh | 3 ++- vkpr/gitlab/help.json | 3 +++ vkpr/gitlab/parameter/add/build.sh | 7 +++++-- vkpr/gitlab/parameter/add/config.json | 10 +++++----- vkpr/gitlab/parameter/add/src/main.sh | 3 ++- .../parameter/add/src/unix/formula/formula.sh | 13 ++++--------- .../src/utils/gitlab-operations.sh} | 8 ++++++++ 8 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 vkpr/gitlab/help.json rename vkpr/{utils/gitlab-parameter-operations.sh => init/src/utils/gitlab-operations.sh} (87%) diff --git a/vkpr/aws/eks/init/build.sh b/vkpr/aws/eks/init/build.sh index 1f38e6c7..16455075 100755 --- a/vkpr/aws/eks/init/build.sh +++ b/vkpr/aws/eks/init/build.sh @@ -4,11 +4,14 @@ BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh -BIN_GITLAB_OPERATION=../../../utils/gitlab-parameter-operations.sh #bash-build: + #copy script from vkpr/utils/ instead of ~/.vkpr/src/ mkdir -p $BIN_FOLDER/utils - cp $BIN_GITLAB_OPERATION $BIN_FOLDER/utils + # BIN_GITLAB_OPERATION=../../../utils/gitlab-operations.sh + #copying script from vkpr/utils/ + # cp $BIN_GITLAB_OPERATION $BIN_FOLDER/utils + cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX diff --git a/vkpr/aws/eks/init/src/main.sh b/vkpr/aws/eks/init/src/main.sh index d15b2e29..8fae7871 100755 --- a/vkpr/aws/eks/init/src/main.sh +++ b/vkpr/aws/eks/init/src/main.sh @@ -5,8 +5,9 @@ VKPR_SCRIPTS=~/.vkpr/src source $VKPR_SCRIPTS/log.sh source $VKPR_SCRIPTS/var.sh source $VKPR_SCRIPTS/helper.sh +source $VKPR_SCRIPTS/gitlab-operations.sh -source "$(dirname "$0")"/utils/gitlab-parameter-operations.sh +# source "$(dirname "$0")"/utils/gitlab-operations.sh # shellcheck source=/dev/null . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/gitlab/help.json b/vkpr/gitlab/help.json new file mode 100644 index 00000000..9cae429a --- /dev/null +++ b/vkpr/gitlab/help.json @@ -0,0 +1,3 @@ +{ + "short": "Manage Gitlab" +} \ No newline at end of file diff --git a/vkpr/gitlab/parameter/add/build.sh b/vkpr/gitlab/parameter/add/build.sh index 1f38e6c7..16455075 100755 --- a/vkpr/gitlab/parameter/add/build.sh +++ b/vkpr/gitlab/parameter/add/build.sh @@ -4,11 +4,14 @@ BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh -BIN_GITLAB_OPERATION=../../../utils/gitlab-parameter-operations.sh #bash-build: + #copy script from vkpr/utils/ instead of ~/.vkpr/src/ mkdir -p $BIN_FOLDER/utils - cp $BIN_GITLAB_OPERATION $BIN_FOLDER/utils + # BIN_GITLAB_OPERATION=../../../utils/gitlab-operations.sh + #copying script from vkpr/utils/ + # cp $BIN_GITLAB_OPERATION $BIN_FOLDER/utils + cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX diff --git a/vkpr/gitlab/parameter/add/config.json b/vkpr/gitlab/parameter/add/config.json index 506eeda6..31b230e4 100755 --- a/vkpr/gitlab/parameter/add/config.json +++ b/vkpr/gitlab/parameter/add/config.json @@ -1,7 +1,7 @@ { "inputs": [ { - "label": "Gitlab Project Name:", + "label": "Gitlab Project Name:(account/project)", "name": "project_name", "type": "text", "cache": { @@ -34,14 +34,14 @@ "required": true }, { - "label": "Environment Scope:", - "name": "environment_scope", + "label": "Parameter Scope:", + "name": "parameter_scope", "type": "text", - "required": true, + "required": false, "cache": { "active": true, "qty": 4, - "newLabel": "Type another environment scope: " + "newLabel": "Type another parameter scope: " } }, { diff --git a/vkpr/gitlab/parameter/add/src/main.sh b/vkpr/gitlab/parameter/add/src/main.sh index e2c1f563..faf73a41 100755 --- a/vkpr/gitlab/parameter/add/src/main.sh +++ b/vkpr/gitlab/parameter/add/src/main.sh @@ -5,8 +5,9 @@ VKPR_SCRIPTS=~/.vkpr/src source $VKPR_SCRIPTS/log.sh source $VKPR_SCRIPTS/var.sh source $VKPR_SCRIPTS/helper.sh +source $VKPR_SCRIPTS/gitlab-operations.sh -source "$(dirname "$0")"/utils/gitlab-parameter-operations.sh +# source "$(dirname "$0")"/utils/gitlab-operations.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/gitlab/parameter/add/src/unix/formula/formula.sh b/vkpr/gitlab/parameter/add/src/unix/formula/formula.sh index f1123b43..921ea6a4 100755 --- a/vkpr/gitlab/parameter/add/src/unix/formula/formula.sh +++ b/vkpr/gitlab/parameter/add/src/unix/formula/formula.sh @@ -1,15 +1,10 @@ #!/bin/bash runFormula() { - PROJECT_ID=$(rawUrlEncode "$GITLAB_USERNAME/${PROJECT_NAME}") + PROJECT_ID=$(rawUrlEncode "${PROJECT_NAME}") echoColor blue "Creating new parameter ${PARAMETER_NAME}" - # echo "Hello World! ${PROJECT_ID}" - # echo ${PROJECT_NAME} - # echo ${PARAMETER_NAME} - # echo ${PARAMETER_VALUE} - # echo ${PARAMETER_MASKED} - # echo ${ENVIRONMENT_SCOPE} - # echo $(cat ./utils/gitlab-parameter-operations.sh) - createOrUpdateVariable $PROJECT_ID $PARAMETER_NAME $PARAMETER_VALUE $PARAMETER_MASKED $ENVIRONMENT_SCOPE $GITLAB_TOKEN + + ## seting '*' as default value for PARAMETER_SCOPE + createOrUpdateVariable $PROJECT_ID $PARAMETER_NAME $PARAMETER_VALUE $PARAMETER_MASKED ${PARAMETER_SCOPE:-\*} $GITLAB_TOKEN } \ No newline at end of file diff --git a/vkpr/utils/gitlab-parameter-operations.sh b/vkpr/init/src/utils/gitlab-operations.sh similarity index 87% rename from vkpr/utils/gitlab-parameter-operations.sh rename to vkpr/init/src/utils/gitlab-operations.sh index bdeb4412..c8fb203e 100755 --- a/vkpr/utils/gitlab-parameter-operations.sh +++ b/vkpr/init/src/utils/gitlab-operations.sh @@ -16,6 +16,7 @@ createOrUpdateVariable(){ local ENVIRONMENT_SCOPE=$5 local GITLAB_TOKEN=$6 + # Documentation: https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable local VARIABLE_RESPONSE_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables" \ --form "key=$PARAMETER_KEY" --form "value=$PARAMETER_VALUE" --form "masked=$PARAMETER_MASKED" --form "environment_scope=$ENVIRONMENT_SCOPE" | head -n 1 | awk -F' ' '{print $2}') # echo "VARIABLE_RESPONSE_CODE = $VARIABLE_RESPONSE_CODE" @@ -25,6 +26,9 @@ createOrUpdateVariable(){ elif [ $VARIABLE_RESPONSE_CODE = 400 ];then # echoColor yellow "Variable $PARAMETER_KEY already exists, updating..." updateVariable $@ + elif [ $VARIABLE_RESPONSE_CODE = 401 ];then + echoColor red "Unauthorized access to GitLab API" + exit 1 else echoColor red "Something wrong while saving $PARAMETER_KEY" fi @@ -48,6 +52,7 @@ updateVariable(){ local ENVIRONMENT_SCOPE=$5 local GITLAB_TOKEN=$6 + # Documentation: https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable local UPDATE_CODE=$(curl -s -i --request PUT --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables/${PARAMETER_KEY}?filter\[environment_scope\]=${ENVIRONMENT_SCOPE}" \ --form "value=$PARAMETER_VALUE" --form "masked=$PARAMETER_MASKED" | head -n 1 | awk -F' ' '{print $2}') # echo "UPDATE_CODE= $UPDATE_CODE" @@ -71,6 +76,8 @@ createBranch(){ echoColor green "Creating branch named $BRANCH_NAME or justing starting a new pipeline" # echo "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$1&ref=master" + + # Documentation: https://docs.gitlab.com/ee/api/branches.html#create-repository-branch local CREATE_BRANCH_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$BRANCH_NAME&ref=master" | head -n 1 | awk -F' ' '{print $2}') # echo "CREATE_BRANCH_CODE: $CREATE_BRANCH_CODE" @@ -84,6 +91,7 @@ createPipeline(){ local PROJECT_ID=$1 local BRANCH_NAME=$2 local GITLAB_TOKEN=$3 + # Documentation: https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline local RESPONSE_PIPE=$(curl -s --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/pipeline?ref=$BRANCH_NAME") # echo "RESPONSE_PIPE: $RESPONSE_PIPE" echoColor green "Pipeline url: $(echo $RESPONSE_PIPE | $VKPR_JQ -r '.web_url')" From cdfd86602838b30b6800c36f9b9ae26388bda974 Mon Sep 17 00:00:00 2001 From: Jpeedroza Date: Wed, 16 Feb 2022 14:42:13 -0300 Subject: [PATCH 7/8] refactor(init): use of scripts internally by formulas --- .../src/utils => lib/functions}/helper.sh | 0 {vkpr/init/src/utils => lib/functions}/log.sh | 0 .../src/utils => lib/functions}/validate.sh | 24 +++++----- lib/functions/var.sh | 16 +++++++ .../utils/var.sh => lib/functions/versions.sh | 15 ------- vkpr/apply/build.sh | 12 +++-- vkpr/apply/src/main.sh | 14 +++--- vkpr/argocd/install/build.sh | 8 ++-- vkpr/argocd/install/src/main.sh | 12 ++--- vkpr/argocd/remove/build.sh | 8 ++-- vkpr/argocd/remove/src/main.sh | 12 ++--- vkpr/argocd/set/applicationset/build.sh | 8 ++-- vkpr/argocd/set/applicationset/src/main.sh | 12 ++--- vkpr/argocd/set/repository/build.sh | 8 ++-- vkpr/argocd/set/repository/src/main.sh | 12 ++--- vkpr/aws/eks/deploy/build.sh | 8 ++-- vkpr/aws/eks/deploy/src/main.sh | 13 +++--- vkpr/aws/eks/destroy/build.sh | 8 ++-- vkpr/aws/eks/destroy/src/main.sh | 13 +++--- vkpr/aws/eks/init/build.sh | 8 ++-- vkpr/aws/eks/init/src/main.sh | 13 +++--- vkpr/aws/eks/tfc/build.sh | 8 ++-- vkpr/aws/eks/tfc/src/main.sh | 12 ++--- vkpr/cert-manager/install/build.sh | 6 ++- vkpr/cert-manager/install/src/main.sh | 13 +++--- vkpr/cert-manager/remove/build.sh | 8 ++-- vkpr/cert-manager/remove/src/main.sh | 13 +++--- vkpr/consul/install/build.sh | 8 ++-- vkpr/consul/install/src/main.sh | 12 ++--- vkpr/consul/remove/build.sh | 8 ++-- vkpr/consul/remove/src/main.sh | 12 ++--- vkpr/create/formula/build.sh | 8 ++-- vkpr/create/formula/src/main.sh | 13 +++--- .../formula/src/unix/formula/formula.sh | 45 ++++++++++++++----- vkpr/external-dns/install/build.sh | 6 ++- vkpr/external-dns/install/src/main.sh | 13 +++--- vkpr/external-dns/remove/build.sh | 9 ++-- vkpr/external-dns/remove/src/main.sh | 13 +++--- vkpr/infra/down/build.sh | 8 ++-- vkpr/infra/down/src/main.sh | 12 ++--- vkpr/infra/start/build.sh | 4 +- vkpr/infra/start/src/main.sh | 12 ++--- vkpr/infra/up/build.sh | 6 ++- vkpr/infra/up/src/main.sh | 12 ++--- vkpr/ingress/install/build.sh | 8 ++-- vkpr/ingress/install/src/main.sh | 13 +++--- vkpr/ingress/remove/build.sh | 8 ++-- vkpr/ingress/remove/src/main.sh | 13 +++--- vkpr/init/build.sh | 6 ++- vkpr/init/src/main.sh | 13 +++--- vkpr/init/src/unix/formula/formula.sh | 12 +---- vkpr/keycloak/export/clients/build.sh | 8 ++-- vkpr/keycloak/export/clients/src/main.sh | 11 ++--- vkpr/keycloak/export/realm/build.sh | 8 ++-- vkpr/keycloak/export/realm/src/main.sh | 11 ++--- vkpr/keycloak/export/users/build.sh | 8 ++-- vkpr/keycloak/export/users/src/main.sh | 11 ++--- vkpr/keycloak/import/clients/build.sh | 8 ++-- vkpr/keycloak/import/clients/src/main.sh | 11 ++--- vkpr/keycloak/import/realm/build.sh | 8 ++-- vkpr/keycloak/import/realm/src/main.sh | 11 ++--- vkpr/keycloak/import/users/build.sh | 8 ++-- vkpr/keycloak/import/users/src/main.sh | 11 ++--- vkpr/keycloak/install/build.sh | 6 ++- vkpr/keycloak/install/src/main.sh | 13 +++--- vkpr/keycloak/remove/build.sh | 6 ++- vkpr/keycloak/remove/src/main.sh | 13 +++--- vkpr/kong/install/build.sh | 6 ++- vkpr/kong/install/src/main.sh | 13 +++--- vkpr/kong/remove/build.sh | 6 ++- vkpr/kong/remove/src/main.sh | 13 +++--- vkpr/loki/install/build.sh | 12 +++-- vkpr/loki/install/src/main.sh | 14 +++--- vkpr/loki/remove/build.sh | 12 +++-- vkpr/loki/remove/src/main.sh | 13 +++--- vkpr/postgres/createdb/build.sh | 8 ++-- vkpr/postgres/createdb/src/main.sh | 12 ++--- vkpr/postgres/install/build.sh | 6 ++- vkpr/postgres/install/src/main.sh | 13 +++--- vkpr/postgres/remove/build.sh | 6 ++- vkpr/postgres/remove/src/main.sh | 13 +++--- vkpr/prometheus-stack/import/build.sh | 8 ++-- vkpr/prometheus-stack/import/src/main.sh | 12 ++--- vkpr/prometheus-stack/install/build.sh | 8 ++-- vkpr/prometheus-stack/install/src/main.sh | 13 +++--- vkpr/prometheus-stack/remove/build.sh | 10 ++--- vkpr/prometheus-stack/remove/src/main.sh | 13 +++--- vkpr/template/config/build.sh | 8 ++-- vkpr/upgrade/build.sh | 8 ++-- vkpr/upgrade/src/main.sh | 11 ++--- vkpr/vault/install/build.sh | 8 ++-- vkpr/vault/install/src/main.sh | 12 ++--- vkpr/vault/remove/build.sh | 8 ++-- vkpr/vault/remove/src/main.sh | 12 ++--- vkpr/whoami/install/build.sh | 9 ++-- vkpr/whoami/install/src/main.sh | 13 +++--- vkpr/whoami/remove/build.sh | 6 ++- vkpr/whoami/remove/src/main.sh | 11 +++-- 98 files changed, 549 insertions(+), 478 deletions(-) rename {vkpr/init/src/utils => lib/functions}/helper.sh (100%) rename {vkpr/init/src/utils => lib/functions}/log.sh (100%) rename {vkpr/init/src/utils => lib/functions}/validate.sh (83%) create mode 100644 lib/functions/var.sh rename vkpr/init/src/utils/var.sh => lib/functions/versions.sh (52%) diff --git a/vkpr/init/src/utils/helper.sh b/lib/functions/helper.sh similarity index 100% rename from vkpr/init/src/utils/helper.sh rename to lib/functions/helper.sh diff --git a/vkpr/init/src/utils/log.sh b/lib/functions/log.sh similarity index 100% rename from vkpr/init/src/utils/log.sh rename to lib/functions/log.sh diff --git a/vkpr/init/src/utils/validate.sh b/lib/functions/validate.sh similarity index 83% rename from vkpr/init/src/utils/validate.sh rename to lib/functions/validate.sh index d9ad8c79..32f3cad8 100644 --- a/vkpr/init/src/utils/validate.sh +++ b/lib/functions/validate.sh @@ -102,49 +102,49 @@ validatePostgresqlPassword() { # ----------------------------------------------------------------------------- validateKubectlVersion() { - if [[ -f $VKPR_KUBECTL ]] && [[ $($VKPR_KUBECTL version --short --client | awk -F " " '{print $3}') = $VKPR_TOOLS_KUBECTL ]]; then + if [[ ! -f $VKPR_KUBECTL ]] || [[ $($VKPR_KUBECTL version --short --client | awk -F " " '{print $3}') = $VKPR_TOOLS_KUBECTL ]]; then return - else + else rm $VKPR_KUBECTL fi } validateHelmVersion() { - if [[ -f $VKPR_HELM ]] && [[ $($VKPR_HELM version --short | awk -F "+" '{print $1}') = $VKPR_TOOLS_HELM ]]; then + if [[ ! -f $VKPR_HELM ]] || [[ $($VKPR_HELM version --short | awk -F "+" '{print $1}') = $VKPR_TOOLS_HELM ]]; then return - else + else rm $VKPR_HELM fi } validateK3DVersion() { - if [[ -f $VKPR_K3D ]] && [[ $($VKPR_K3D version | awk -F " " '{print $3}' | head -n1) = $VKPR_TOOLS_K3D ]]; then + if [[ ! -f $VKPR_K3D ]] || [[ $($VKPR_K3D version | awk -F " " '{print $3}' | head -n1) = $VKPR_TOOLS_K3D ]]; then return - else + else rm $VKPR_K3D fi } validateJQVersion() { - if [[ -f $VKPR_JQ ]] && [[ $($VKPR_JQ --version) = $VKPR_TOOLS_JQ ]]; then + if [[ ! -f $VKPR_JQ ]] || [[ $($VKPR_JQ --version) = $VKPR_TOOLS_JQ ]]; then return - else + else rm $VKPR_JQ fi } validateYQVersion() { - if [[ -f $VKPR_YQ ]] && [[ $($VKPR_YQ --version | awk -F " " '$4="v"$4 {print $4}') = $VKPR_TOOLS_YQ ]]; then + if [[ ! -f $VKPR_YQ ]] || [[ $($VKPR_YQ --version | awk -F " " '$4="v"$4 {print $4}') = $VKPR_TOOLS_YQ ]]; then return - else + else rm $VKPR_YQ fi } validateK9SVersion() { - if [[ -f $VKPR_K9S ]] && [[ $($VKPR_K9S version --short | awk -F " " '{print $2}' | head -n1) = $VKPR_TOOLS_K9S ]]; then + if [[ ! -f $VKPR_K9S ]] || [[ $($VKPR_K9S version --short | awk -F " " '{print $2}' | head -n1) = $VKPR_TOOLS_K9S ]]; then return - else + else rm $VKPR_K9S fi } \ No newline at end of file diff --git a/lib/functions/var.sh b/lib/functions/var.sh new file mode 100644 index 00000000..9b41f932 --- /dev/null +++ b/lib/functions/var.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +VKPR_HOME=~/.vkpr +VKPR_GLOBAL=$CURRENT_PWD/vkpr.yaml +VKPR_CONFIG=$VKPR_HOME/config + +##ALL RESOURCES EXCEPT CERT-MANAGER MUST BE UNDER THIS NAMESPACE +VKPR_K8S_NAMESPACE=vkpr + +VKPR_GLAB=$VKPR_HOME/bin/glab +VKPR_K3D=$VKPR_HOME/bin/k3d +VKPR_ARKADE=$VKPR_HOME/bin/arkade +VKPR_KUBECTL=$VKPR_HOME/bin/kubectl +VKPR_HELM=$VKPR_HOME/bin/helm +VKPR_JQ=$VKPR_HOME/bin/jq +VKPR_YQ=$VKPR_HOME/bin/yq diff --git a/vkpr/init/src/utils/var.sh b/lib/functions/versions.sh similarity index 52% rename from vkpr/init/src/utils/var.sh rename to lib/functions/versions.sh index cc5ce6cf..f426f995 100644 --- a/vkpr/init/src/utils/var.sh +++ b/lib/functions/versions.sh @@ -1,20 +1,5 @@ #!/bin/bash -VKPR_HOME=~/.vkpr -VKPR_GLOBAL=$CURRENT_PWD/vkpr.yaml -VKPR_CONFIG=$VKPR_HOME/config - -##ALL RESOURCES EXCEPT CERT-MANAGER MUST BE UNDER THIS NAMESPACE -VKPR_K8S_NAMESPACE=vkpr - -VKPR_GLAB=$VKPR_HOME/bin/glab -VKPR_K3D=$VKPR_HOME/bin/k3d -VKPR_ARKADE=$VKPR_HOME/bin/arkade -VKPR_KUBECTL=$VKPR_HOME/bin/kubectl -VKPR_HELM=$VKPR_HOME/bin/helm -VKPR_JQ=$VKPR_HOME/bin/jq -VKPR_YQ=$VKPR_HOME/bin/yq - VKPR_EXTERNAL_DNS_VERSION="5.4.9" VKPR_WHOAMI_VERSION="2.5.0" VKPR_KEYCLOAK_VERSION="6.1.2" diff --git a/vkpr/apply/build.sh b/vkpr/apply/build.sh index e0c86872..e74a90bc 100755 --- a/vkpr/apply/build.sh +++ b/vkpr/apply/build.sh @@ -1,15 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX - -#bat-build: - -#docker: + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/apply/src/main.sh b/vkpr/apply/src/main.sh index 2a900398..5e51318f 100755 --- a/vkpr/apply/src/main.sh +++ b/vkpr/apply/src/main.sh @@ -1,14 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula - diff --git a/vkpr/argocd/install/build.sh b/vkpr/argocd/install/build.sh index 3f067481..892e1264 100755 --- a/vkpr/argocd/install/build.sh +++ b/vkpr/argocd/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/argocd/install/src/main.sh b/vkpr/argocd/install/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/argocd/install/src/main.sh +++ b/vkpr/argocd/install/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/argocd/remove/build.sh b/vkpr/argocd/remove/build.sh index 3f067481..892e1264 100755 --- a/vkpr/argocd/remove/build.sh +++ b/vkpr/argocd/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/argocd/remove/src/main.sh b/vkpr/argocd/remove/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/argocd/remove/src/main.sh +++ b/vkpr/argocd/remove/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/argocd/set/applicationset/build.sh b/vkpr/argocd/set/applicationset/build.sh index 3f067481..28e11737 100755 --- a/vkpr/argocd/set/applicationset/build.sh +++ b/vkpr/argocd/set/applicationset/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/argocd/set/applicationset/src/main.sh b/vkpr/argocd/set/applicationset/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/argocd/set/applicationset/src/main.sh +++ b/vkpr/argocd/set/applicationset/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/argocd/set/repository/build.sh b/vkpr/argocd/set/repository/build.sh index 3f067481..28e11737 100755 --- a/vkpr/argocd/set/repository/build.sh +++ b/vkpr/argocd/set/repository/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/argocd/set/repository/src/main.sh b/vkpr/argocd/set/repository/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/argocd/set/repository/src/main.sh +++ b/vkpr/argocd/set/repository/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/aws/eks/deploy/build.sh b/vkpr/aws/eks/deploy/build.sh index 3f067481..28e11737 100755 --- a/vkpr/aws/eks/deploy/build.sh +++ b/vkpr/aws/eks/deploy/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/aws/eks/deploy/src/main.sh b/vkpr/aws/eks/deploy/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/aws/eks/deploy/src/main.sh +++ b/vkpr/aws/eks/deploy/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/aws/eks/destroy/build.sh b/vkpr/aws/eks/destroy/build.sh index 3f067481..28e11737 100755 --- a/vkpr/aws/eks/destroy/build.sh +++ b/vkpr/aws/eks/destroy/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/aws/eks/destroy/src/main.sh b/vkpr/aws/eks/destroy/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/aws/eks/destroy/src/main.sh +++ b/vkpr/aws/eks/destroy/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/aws/eks/init/build.sh b/vkpr/aws/eks/init/build.sh index 3f067481..28e11737 100755 --- a/vkpr/aws/eks/init/build.sh +++ b/vkpr/aws/eks/init/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/aws/eks/init/src/main.sh b/vkpr/aws/eks/init/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/aws/eks/init/src/main.sh +++ b/vkpr/aws/eks/init/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/aws/eks/tfc/build.sh b/vkpr/aws/eks/tfc/build.sh index 3f067481..28e11737 100755 --- a/vkpr/aws/eks/tfc/build.sh +++ b/vkpr/aws/eks/tfc/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/aws/eks/tfc/src/main.sh b/vkpr/aws/eks/tfc/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/aws/eks/tfc/src/main.sh +++ b/vkpr/aws/eks/tfc/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/cert-manager/install/build.sh b/vkpr/cert-manager/install/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/cert-manager/install/build.sh +++ b/vkpr/cert-manager/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/cert-manager/install/src/main.sh b/vkpr/cert-manager/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/cert-manager/install/src/main.sh +++ b/vkpr/cert-manager/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/cert-manager/remove/build.sh b/vkpr/cert-manager/remove/build.sh index 3f067481..892e1264 100755 --- a/vkpr/cert-manager/remove/build.sh +++ b/vkpr/cert-manager/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/cert-manager/remove/src/main.sh b/vkpr/cert-manager/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/cert-manager/remove/src/main.sh +++ b/vkpr/cert-manager/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/consul/install/build.sh b/vkpr/consul/install/build.sh index 3f067481..892e1264 100755 --- a/vkpr/consul/install/build.sh +++ b/vkpr/consul/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/consul/install/src/main.sh b/vkpr/consul/install/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/consul/install/src/main.sh +++ b/vkpr/consul/install/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/consul/remove/build.sh b/vkpr/consul/remove/build.sh index 3f067481..892e1264 100755 --- a/vkpr/consul/remove/build.sh +++ b/vkpr/consul/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/consul/remove/src/main.sh b/vkpr/consul/remove/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/consul/remove/src/main.sh +++ b/vkpr/consul/remove/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/create/formula/build.sh b/vkpr/create/formula/build.sh index 3f067481..892e1264 100755 --- a/vkpr/create/formula/build.sh +++ b/vkpr/create/formula/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/create/formula/src/main.sh b/vkpr/create/formula/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/create/formula/src/main.sh +++ b/vkpr/create/formula/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/create/formula/src/unix/formula/formula.sh b/vkpr/create/formula/src/unix/formula/formula.sh index 0973dc04..cfe2a103 100755 --- a/vkpr/create/formula/src/unix/formula/formula.sh +++ b/vkpr/create/formula/src/unix/formula/formula.sh @@ -77,12 +77,6 @@ EOF rm -f "${formulaPath}/src/main.bat" rm -Rf "${formulaPath}/src/windows" - # Change Files - sed -i.tmp '/BINARY_NAME_WINDOWS/d' "${formulaPath}/build.sh" - sed -i.tmp '/ENTRY_POINT_WINDOWS/d' "${formulaPath}/build.sh" - echo "$(head -n 11 ${formulaPath}/build.sh)" > "${formulaPath}/build.sh" - rm ${formulaPath}/build.sh.tmp - # No inputs in config.json cp "${formulaPath}/config.json" "${formulaPath}/config.json.tmp" $VKPR_JQ '.inputs=[] | del(.dockerImageBuilder)' ${formulaPath}/config.json.tmp > ${formulaPath}/config.json @@ -97,6 +91,7 @@ EOF # Change entire file changeMainFile + changeBuildFile changeFormula } @@ -114,11 +109,12 @@ changeMainFile() { cat > ${formulaPath}/src/main.sh.tmp < ${formulaPath}/src/main.sh rm ${formulaPath}/src/main.sh.tmp +} + +changeBuildFile() { + FORMULA_SIZE=$(echo ${VKPR_FORMULA} | awk -F " " '{print NF}') + path="" + for i in $(seq $FORMULA_SIZE); do + path+="../" + done + + cat > ${formulaPath}/build.sh.tmp < ${formulaPath}/build.sh + rm ${formulaPath}/build.sh.tmp } \ No newline at end of file diff --git a/vkpr/external-dns/install/build.sh b/vkpr/external-dns/install/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/external-dns/install/build.sh +++ b/vkpr/external-dns/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/external-dns/install/src/main.sh b/vkpr/external-dns/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/external-dns/install/src/main.sh +++ b/vkpr/external-dns/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/external-dns/remove/build.sh b/vkpr/external-dns/remove/build.sh index 9d822cee..892e1264 100755 --- a/vkpr/external-dns/remove/build.sh +++ b/vkpr/external-dns/remove/build.sh @@ -1,12 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX - + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/external-dns/remove/src/main.sh b/vkpr/external-dns/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/external-dns/remove/src/main.sh +++ b/vkpr/external-dns/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/infra/down/build.sh b/vkpr/infra/down/build.sh index 3f067481..892e1264 100755 --- a/vkpr/infra/down/build.sh +++ b/vkpr/infra/down/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/infra/down/src/main.sh b/vkpr/infra/down/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/infra/down/src/main.sh +++ b/vkpr/infra/down/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/infra/start/build.sh b/vkpr/infra/start/build.sh index 43737f71..892e1264 100755 --- a/vkpr/infra/start/build.sh +++ b/vkpr/infra/start/build.sh @@ -3,9 +3,11 @@ BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/infra/start/src/main.sh b/vkpr/infra/start/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/infra/start/src/main.sh +++ b/vkpr/infra/start/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/infra/up/build.sh b/vkpr/infra/up/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/infra/up/build.sh +++ b/vkpr/infra/up/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/infra/up/src/main.sh b/vkpr/infra/up/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/infra/up/src/main.sh +++ b/vkpr/infra/up/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/ingress/install/build.sh b/vkpr/ingress/install/build.sh index 3f067481..892e1264 100755 --- a/vkpr/ingress/install/build.sh +++ b/vkpr/ingress/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/ingress/install/src/main.sh b/vkpr/ingress/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/ingress/install/src/main.sh +++ b/vkpr/ingress/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/ingress/remove/build.sh b/vkpr/ingress/remove/build.sh index 3f067481..892e1264 100755 --- a/vkpr/ingress/remove/build.sh +++ b/vkpr/ingress/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/ingress/remove/src/main.sh b/vkpr/ingress/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/ingress/remove/src/main.sh +++ b/vkpr/ingress/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/init/build.sh b/vkpr/init/build.sh index cfabf0a0..e74a90bc 100755 --- a/vkpr/init/build.sh +++ b/vkpr/init/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/init/src/main.sh b/vkpr/init/src/main.sh index d777f3be..6a55f685 100755 --- a/vkpr/init/src/main.sh +++ b/vkpr/init/src/main.sh @@ -1,12 +1,13 @@ #!/bin/bash -#import utility -. "$(dirname "$0")"/utils/var.sh -. "$(dirname "$0")"/utils/log.sh -. "$(dirname "$0")"/utils/dependencies.sh -. "$(dirname "$0")"/utils/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh +source "$(dirname "$0")"/utils/dependencies.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/init/src/unix/formula/formula.sh b/vkpr/init/src/unix/formula/formula.sh index 40707b17..6e649113 100755 --- a/vkpr/init/src/unix/formula/formula.sh +++ b/vkpr/init/src/unix/formula/formula.sh @@ -16,7 +16,6 @@ runFormula() { mkdir -p $VKPR_HOME/bin mkdir -p $VKPR_HOME/config mkdir -p $VKPR_HOME/bats - mkdir -p $VKPR_HOME/src installArkade installGlab @@ -34,10 +33,8 @@ runFormula() { # validateK9SVersion # installTool "k9s" $VKPR_TOOLS_K9S - installGlobals installBats - -} +} installArkade() { if [[ -f "$VKPR_ARKADE" ]]; then @@ -78,13 +75,6 @@ installGlab() { fi } -installGlobals() { - ##Workaround to cp command with regex - #More details: https://www.oreilly.com/library/view/bash-quick-start/9781789538830/2609b05c-60fa-443d-bb5f-d5cd7626374f.xhtml - shopt -s extglob - eval 'cp $(dirname "$0")/utils/!(dependencies.sh|!(*.sh)) $VKPR_SCRIPTS' -} - installBats(){ if [[ -f "$VKPR_HOME/bats/bin/bats" ]]; then echoColor "yellow" "Bats already installed. Skipping." diff --git a/vkpr/keycloak/export/clients/build.sh b/vkpr/keycloak/export/clients/build.sh index 3f067481..28e11737 100755 --- a/vkpr/keycloak/export/clients/build.sh +++ b/vkpr/keycloak/export/clients/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/export/clients/src/main.sh b/vkpr/keycloak/export/clients/src/main.sh index 77b194fb..5e51318f 100755 --- a/vkpr/keycloak/export/clients/src/main.sh +++ b/vkpr/keycloak/export/clients/src/main.sh @@ -1,10 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/keycloak/export/realm/build.sh b/vkpr/keycloak/export/realm/build.sh index 3f067481..28e11737 100755 --- a/vkpr/keycloak/export/realm/build.sh +++ b/vkpr/keycloak/export/realm/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/export/realm/src/main.sh b/vkpr/keycloak/export/realm/src/main.sh index 77b194fb..5e51318f 100755 --- a/vkpr/keycloak/export/realm/src/main.sh +++ b/vkpr/keycloak/export/realm/src/main.sh @@ -1,10 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/keycloak/export/users/build.sh b/vkpr/keycloak/export/users/build.sh index 3f067481..28e11737 100755 --- a/vkpr/keycloak/export/users/build.sh +++ b/vkpr/keycloak/export/users/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/export/users/src/main.sh b/vkpr/keycloak/export/users/src/main.sh index 77b194fb..5e51318f 100755 --- a/vkpr/keycloak/export/users/src/main.sh +++ b/vkpr/keycloak/export/users/src/main.sh @@ -1,10 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/keycloak/import/clients/build.sh b/vkpr/keycloak/import/clients/build.sh index 3f067481..28e11737 100755 --- a/vkpr/keycloak/import/clients/build.sh +++ b/vkpr/keycloak/import/clients/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/import/clients/src/main.sh b/vkpr/keycloak/import/clients/src/main.sh index 77b194fb..5e51318f 100755 --- a/vkpr/keycloak/import/clients/src/main.sh +++ b/vkpr/keycloak/import/clients/src/main.sh @@ -1,10 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/keycloak/import/realm/build.sh b/vkpr/keycloak/import/realm/build.sh index 3f067481..28e11737 100755 --- a/vkpr/keycloak/import/realm/build.sh +++ b/vkpr/keycloak/import/realm/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/import/realm/src/main.sh b/vkpr/keycloak/import/realm/src/main.sh index 77b194fb..5e51318f 100755 --- a/vkpr/keycloak/import/realm/src/main.sh +++ b/vkpr/keycloak/import/realm/src/main.sh @@ -1,10 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/keycloak/import/users/build.sh b/vkpr/keycloak/import/users/build.sh index 3f067481..28e11737 100755 --- a/vkpr/keycloak/import/users/build.sh +++ b/vkpr/keycloak/import/users/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/import/users/src/main.sh b/vkpr/keycloak/import/users/src/main.sh index 77b194fb..5e51318f 100755 --- a/vkpr/keycloak/import/users/src/main.sh +++ b/vkpr/keycloak/import/users/src/main.sh @@ -1,10 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/keycloak/install/build.sh b/vkpr/keycloak/install/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/keycloak/install/build.sh +++ b/vkpr/keycloak/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/install/src/main.sh b/vkpr/keycloak/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/keycloak/install/src/main.sh +++ b/vkpr/keycloak/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/keycloak/remove/build.sh b/vkpr/keycloak/remove/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/keycloak/remove/build.sh +++ b/vkpr/keycloak/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/keycloak/remove/src/main.sh b/vkpr/keycloak/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/keycloak/remove/src/main.sh +++ b/vkpr/keycloak/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/kong/install/build.sh b/vkpr/kong/install/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/kong/install/build.sh +++ b/vkpr/kong/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/kong/install/src/main.sh b/vkpr/kong/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/kong/install/src/main.sh +++ b/vkpr/kong/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/kong/remove/build.sh b/vkpr/kong/remove/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/kong/remove/build.sh +++ b/vkpr/kong/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/kong/remove/src/main.sh b/vkpr/kong/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/kong/remove/src/main.sh +++ b/vkpr/kong/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/loki/install/build.sh b/vkpr/loki/install/build.sh index e0c86872..892e1264 100755 --- a/vkpr/loki/install/build.sh +++ b/vkpr/loki/install/build.sh @@ -1,15 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX - -#bat-build: - -#docker: + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/loki/install/src/main.sh b/vkpr/loki/install/src/main.sh index 2a900398..5e51318f 100755 --- a/vkpr/loki/install/src/main.sh +++ b/vkpr/loki/install/src/main.sh @@ -1,14 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula - diff --git a/vkpr/loki/remove/build.sh b/vkpr/loki/remove/build.sh index e0c86872..892e1264 100755 --- a/vkpr/loki/remove/build.sh +++ b/vkpr/loki/remove/build.sh @@ -1,15 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX - -#bat-build: - -#docker: + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/loki/remove/src/main.sh b/vkpr/loki/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/loki/remove/src/main.sh +++ b/vkpr/loki/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/postgres/createdb/build.sh b/vkpr/postgres/createdb/build.sh index 3f067481..892e1264 100755 --- a/vkpr/postgres/createdb/build.sh +++ b/vkpr/postgres/createdb/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/postgres/createdb/src/main.sh b/vkpr/postgres/createdb/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/postgres/createdb/src/main.sh +++ b/vkpr/postgres/createdb/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/postgres/install/build.sh b/vkpr/postgres/install/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/postgres/install/build.sh +++ b/vkpr/postgres/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/postgres/install/src/main.sh b/vkpr/postgres/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/postgres/install/src/main.sh +++ b/vkpr/postgres/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/postgres/remove/build.sh b/vkpr/postgres/remove/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/postgres/remove/build.sh +++ b/vkpr/postgres/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/postgres/remove/src/main.sh b/vkpr/postgres/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/postgres/remove/src/main.sh +++ b/vkpr/postgres/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/prometheus-stack/import/build.sh b/vkpr/prometheus-stack/import/build.sh index 3f067481..892e1264 100755 --- a/vkpr/prometheus-stack/import/build.sh +++ b/vkpr/prometheus-stack/import/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/prometheus-stack/import/src/main.sh b/vkpr/prometheus-stack/import/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/prometheus-stack/import/src/main.sh +++ b/vkpr/prometheus-stack/import/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/prometheus-stack/install/build.sh b/vkpr/prometheus-stack/install/build.sh index cfabf0a0..3bfd4b20 100755 --- a/vkpr/prometheus-stack/install/build.sh +++ b/vkpr/prometheus-stack/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX diff --git a/vkpr/prometheus-stack/install/src/main.sh b/vkpr/prometheus-stack/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/prometheus-stack/install/src/main.sh +++ b/vkpr/prometheus-stack/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/prometheus-stack/remove/build.sh b/vkpr/prometheus-stack/remove/build.sh index e0c86872..3bfd4b20 100755 --- a/vkpr/prometheus-stack/remove/build.sh +++ b/vkpr/prometheus-stack/remove/build.sh @@ -1,15 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX - -#bat-build: - -#docker: diff --git a/vkpr/prometheus-stack/remove/src/main.sh b/vkpr/prometheus-stack/remove/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/prometheus-stack/remove/src/main.sh +++ b/vkpr/prometheus-stack/remove/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/template/config/build.sh b/vkpr/template/config/build.sh index 3f067481..892e1264 100755 --- a/vkpr/template/config/build.sh +++ b/vkpr/template/config/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/upgrade/build.sh b/vkpr/upgrade/build.sh index 3f067481..e74a90bc 100755 --- a/vkpr/upgrade/build.sh +++ b/vkpr/upgrade/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/upgrade/src/main.sh b/vkpr/upgrade/src/main.sh index 77b194fb..5e51318f 100755 --- a/vkpr/upgrade/src/main.sh +++ b/vkpr/upgrade/src/main.sh @@ -1,10 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/vault/install/build.sh b/vkpr/vault/install/build.sh index 3f067481..892e1264 100755 --- a/vkpr/vault/install/build.sh +++ b/vkpr/vault/install/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/vault/install/src/main.sh b/vkpr/vault/install/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/vault/install/src/main.sh +++ b/vkpr/vault/install/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/vault/remove/build.sh b/vkpr/vault/remove/build.sh index 3f067481..892e1264 100755 --- a/vkpr/vault/remove/build.sh +++ b/vkpr/vault/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/vault/remove/src/main.sh b/vkpr/vault/remove/src/main.sh index 712c2deb..5e51318f 100755 --- a/vkpr/vault/remove/src/main.sh +++ b/vkpr/vault/remove/src/main.sh @@ -1,11 +1,11 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +# shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh . "$(dirname "$0")"/unix/formula/formula.sh --source-only diff --git a/vkpr/whoami/install/build.sh b/vkpr/whoami/install/build.sh index 9d822cee..892e1264 100755 --- a/vkpr/whoami/install/build.sh +++ b/vkpr/whoami/install/build.sh @@ -1,12 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX - chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX - + chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/whoami/install/src/main.sh b/vkpr/whoami/install/src/main.sh index b6bfd762..5e51318f 100755 --- a/vkpr/whoami/install/src/main.sh +++ b/vkpr/whoami/install/src/main.sh @@ -1,13 +1,12 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh - # shellcheck source=/dev/null +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh + . "$(dirname "$0")"/unix/formula/formula.sh --source-only runFormula diff --git a/vkpr/whoami/remove/build.sh b/vkpr/whoami/remove/build.sh index cfabf0a0..892e1264 100755 --- a/vkpr/whoami/remove/build.sh +++ b/vkpr/whoami/remove/build.sh @@ -1,11 +1,13 @@ -#!/bin/sh +#!/bin/bash BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh ENTRY_POINT_UNIX=main.sh +LIB_RESOURCES="../../../lib/functions/*" #bash-build: - mkdir -p $BIN_FOLDER + mkdir -p $BIN_FOLDER/src + cp $LIB_RESOURCES $BIN_FOLDER/src cp -r src/* $BIN_FOLDER mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX \ No newline at end of file diff --git a/vkpr/whoami/remove/src/main.sh b/vkpr/whoami/remove/src/main.sh index b6bfd762..6f50011e 100755 --- a/vkpr/whoami/remove/src/main.sh +++ b/vkpr/whoami/remove/src/main.sh @@ -1,11 +1,10 @@ #!/bin/bash -VKPR_SCRIPTS=~/.vkpr/src - -source $VKPR_SCRIPTS/log.sh -source $VKPR_SCRIPTS/var.sh -source $VKPR_SCRIPTS/helper.sh -source $VKPR_SCRIPTS/validate.sh +source src/log.sh +source src/var.sh +source src/helper.sh +source src/validate.sh +source src/versions.sh # shellcheck source=/dev/null . "$(dirname "$0")"/unix/formula/formula.sh --source-only From b0a64a1e56269e59db24636b1e7978c4cb2df2b2 Mon Sep 17 00:00:00 2001 From: Jpeedroza Date: Wed, 16 Feb 2022 14:47:38 -0300 Subject: [PATCH 8/8] fix(keycloak): fix pod labels value --- vkpr/keycloak/install/src/utils/keycloak.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vkpr/keycloak/install/src/utils/keycloak.yaml b/vkpr/keycloak/install/src/utils/keycloak.yaml index d4b04eee..a60bc471 100644 --- a/vkpr/keycloak/install/src/utils/keycloak.yaml +++ b/vkpr/keycloak/install/src/utils/keycloak.yaml @@ -14,5 +14,5 @@ rbac: postgresql: persistence: enabled: false -commonLabels: +podLabels: vkpr: "true"