From 219a97df9e717afebd46f13b8e3b1e8f96552827 Mon Sep 17 00:00:00 2001 From: HumbertoPeluso Date: Wed, 11 Aug 2021 10:02:13 -0300 Subject: [PATCH 1/7] restoring missing files --- vkpr/external-dns/install/README.md | 13 +++++++++++++ vkpr/external-dns/install/build.sh | 11 +++++++++++ vkpr/external-dns/install/config.json | 13 +++++++++++++ vkpr/external-dns/install/metadata.json | 16 ++++++++++++++++ vkpr/external-dns/install/set_umask.sh | 3 +++ vkpr/external-dns/install/src/main.sh | 6 ++++++ 6 files changed, 62 insertions(+) create mode 100644 vkpr/external-dns/install/README.md create mode 100644 vkpr/external-dns/install/build.sh create mode 100644 vkpr/external-dns/install/config.json create mode 100644 vkpr/external-dns/install/metadata.json create mode 100644 vkpr/external-dns/install/set_umask.sh create mode 100644 vkpr/external-dns/install/src/main.sh diff --git a/vkpr/external-dns/install/README.md b/vkpr/external-dns/install/README.md new file mode 100644 index 00000000..68b1eb53 --- /dev/null +++ b/vkpr/external-dns/install/README.md @@ -0,0 +1,13 @@ +# Description + +Formula description + +## Command + +```bash +rit vkpr external-dns install +``` + +## Requirements + +## Demonstration diff --git a/vkpr/external-dns/install/build.sh b/vkpr/external-dns/install/build.sh new file mode 100644 index 00000000..3f067481 --- /dev/null +++ b/vkpr/external-dns/install/build.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +BIN_FOLDER=bin +BINARY_NAME_UNIX=run.sh +ENTRY_POINT_UNIX=main.sh + +#bash-build: + mkdir -p $BIN_FOLDER + 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/external-dns/install/config.json b/vkpr/external-dns/install/config.json new file mode 100644 index 00000000..8f836a5e --- /dev/null +++ b/vkpr/external-dns/install/config.json @@ -0,0 +1,13 @@ +{ + "dockerImageBuilder": "ritclizup/rit-shell-bat-builder", + "inputs": [ + { + "label": "Type you Digital Ocean Api Key: ", + "name": "input_digital_ocean", + "required": true, + "type": "text" + } + ], + "template": "shell-bat", + "templateRelease:": "2.16.2" +} diff --git a/vkpr/external-dns/install/metadata.json b/vkpr/external-dns/install/metadata.json new file mode 100644 index 00000000..89a145bb --- /dev/null +++ b/vkpr/external-dns/install/metadata.json @@ -0,0 +1,16 @@ +{ + "execution": [ + "local", + "docker" + ], + "os": { + "deps": [], + "support": [ + "mac", + "linux" + ] + }, + "tags": [ + "vkpr", "external-dns", "install" + ] +} diff --git a/vkpr/external-dns/install/set_umask.sh b/vkpr/external-dns/install/set_umask.sh new file mode 100644 index 00000000..091c13d6 --- /dev/null +++ b/vkpr/external-dns/install/set_umask.sh @@ -0,0 +1,3 @@ +#!/bin/sh +umask 0011 +$1 diff --git a/vkpr/external-dns/install/src/main.sh b/vkpr/external-dns/install/src/main.sh new file mode 100644 index 00000000..736f5ce4 --- /dev/null +++ b/vkpr/external-dns/install/src/main.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# shellcheck source=/dev/null +. "$(dirname "$0")"/unix/formula/formula.sh --source-only + +runFormula From a9d1485485e79c5b17af5fa619385bdd4de21e1e Mon Sep 17 00:00:00 2001 From: HumbertoPeluso Date: Thu, 12 Aug 2021 08:37:06 -0300 Subject: [PATCH 2/7] external-dns provider inputs created --- vkpr/external-dns/install/config.json | 14 ++++++++++++-- .../install/src/unix/formula/formula.sh | 18 +++++++++++++++--- .../install/src/utils/external-dns.sh | 2 +- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/vkpr/external-dns/install/config.json b/vkpr/external-dns/install/config.json index 8f836a5e..0e37199e 100644 --- a/vkpr/external-dns/install/config.json +++ b/vkpr/external-dns/install/config.json @@ -2,12 +2,22 @@ "dockerImageBuilder": "ritclizup/rit-shell-bat-builder", "inputs": [ { - "label": "Type you Digital Ocean Api Key: ", - "name": "input_digital_ocean", + "default": "DIGITALOCEAN", + "items": [ + "DIGITALOCEAN", + "AWS" + ], + "label": "What is your cloud provider? ", + "name": "input_cloud_provider", "required": true, "type": "text" + }, + { + "name": "digitalocean_apitoken", + "type": "CREDENTIAL_DIGITALOCEAN_APITOKEN" } ], "template": "shell-bat", "templateRelease:": "2.16.2" } + diff --git a/vkpr/external-dns/install/src/unix/formula/formula.sh b/vkpr/external-dns/install/src/unix/formula/formula.sh index 8a6e2b37..cf11b1b5 100755 --- a/vkpr/external-dns/install/src/unix/formula/formula.sh +++ b/vkpr/external-dns/install/src/unix/formula/formula.sh @@ -17,13 +17,25 @@ add_repo_external_dns() { } install_external_dns() { - export DO_AUTH_TOKEN=$INPUT_DIGITAL_OCEAN + getProvider $INPUT_CLOUD_PROVIDER if [[ ! -e $VKPR_EXTERNAL_DNS_VALUES ]]; then - . $(dirname "$0")/utils/external-dns.sh $DO_AUTH_TOKEN $VKPR_EXTERNAL_DNS_VALUES + . $(dirname "$0")/utils/external-dns.sh $VKPR_EXTERNAL_DNS_VALUES $DO_AUTH_TOKEN fi $VKPR_HOME/bin/helm upgrade -i vkpr -f $VKPR_EXTERNAL_DNS_VALUES bitnami/external-dns } +getProvider(){ + case $1 in + DIGITALOCEAN) + export DO_AUTH_TOKEN=$DIGITALOCEAN_APITOKEN + ;; + AWS) + echoColor "yellow" "AWS is a working in progress." + exit 0 + ;; + esac +} + echoColor() { case $1 in red) @@ -42,4 +54,4 @@ echoColor() { echo "$(printf '\033[36m')$2$(printf '\033[0m')" ;; esac -} \ No newline at end of file +} diff --git a/vkpr/external-dns/install/src/utils/external-dns.sh b/vkpr/external-dns/install/src/utils/external-dns.sh index a4462d87..55812c3b 100644 --- a/vkpr/external-dns/install/src/utils/external-dns.sh +++ b/vkpr/external-dns/install/src/utils/external-dns.sh @@ -8,4 +8,4 @@ sources: provider: digitalocean interval: '"1m"' digitalocean: - apiToken: $1" > $2 \ No newline at end of file + apiToken: $2" > $1 \ No newline at end of file From 41f83805e82cabe66b3e96f9bd239f8c4d1d95cd Mon Sep 17 00:00:00 2001 From: HumbertoPeluso Date: Thu, 12 Aug 2021 12:26:50 -0300 Subject: [PATCH 3/7] inputs domain and secure created --- vkpr/whoami/install/config.json | 21 +++++++++++++++- .../install/src/unix/formula/formula.sh | 4 ++-- vkpr/whoami/install/src/utils/whoami.sh | 24 +++++++++---------- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/vkpr/whoami/install/config.json b/vkpr/whoami/install/config.json index e87a59b6..1815fa5e 100755 --- a/vkpr/whoami/install/config.json +++ b/vkpr/whoami/install/config.json @@ -1,6 +1,25 @@ { "dockerImageBuilder": "ritclizup/rit-shell-bat-builder", - "inputs": [], + "inputs": [ + { + "default": "whoami.localhost", + "label": "Type the Whoami domain: ", + "name": "input_domain", + "required": true, + "type": "text" + }, + { + "default": "false", + "items": [ + "true", + "false" + ], + "label": "Secure? ", + "name": "input_secure", + "required": true, + "type": "bool" + } + ], "template": "shell-bat", "templateRelease:": "2.16.2" } \ No newline at end of file diff --git a/vkpr/whoami/install/src/unix/formula/formula.sh b/vkpr/whoami/install/src/unix/formula/formula.sh index 80d90184..054e936f 100755 --- a/vkpr/whoami/install/src/unix/formula/formula.sh +++ b/vkpr/whoami/install/src/unix/formula/formula.sh @@ -6,7 +6,7 @@ runFormula() { mkdir -p $VKPR_HOME/values/whoami VKPR_WHOAMI_VALUES=$VKPR_HOME/values/whoami/values.yaml touch $VKPR_WHOAMI_VALUES - + echoColor "yellow" "Secure is a working in progress." addRepoWhoami installWhoami } @@ -25,7 +25,7 @@ verifyHasIngress(){ installWhoami(){ if [[ ! -n $(verifyHasIngress) ]]; then - . $(dirname "$0")/utils/whoami.sh $VKPR_WHOAMI_VALUES + . $(dirname "$0")/utils/whoami.sh $VKPR_WHOAMI_VALUES $INPUT_DOMAIN helm upgrade -i -f $VKPR_WHOAMI_VALUES whoami cowboysysop/whoami else echoColor "red" "Não há ingress instalado, para utilizar o Whoami no localhost deve-se subir o ingress." diff --git a/vkpr/whoami/install/src/utils/whoami.sh b/vkpr/whoami/install/src/utils/whoami.sh index 8b68a118..4c75d2a0 100644 --- a/vkpr/whoami/install/src/utils/whoami.sh +++ b/vkpr/whoami/install/src/utils/whoami.sh @@ -1,15 +1,15 @@ #!/bin/sh printf \ "ingress: -enabled: true -annotations: - kubernetes.io/ingress.class: nginx - kubernetes.io/tls-acme: '"true"' -pathType: Prefix -hosts: - - host: whoami.vkpr-dev.vertigo.com.br - paths: ['"/"'] -tls: -- hosts: - - whoami.vkpr-dev.vertigo.com.br - secretName: whoami-cert" > $1 \ No newline at end of file + enabled: true + annotations: + kubernetes.io/ingress.class: nginx + kubernetes.io/tls-acme: '"true"' + pathType: Prefix + hosts: + - host: $2 + paths: ['"/"'] + tls: + - hosts: + - $2 + secretName: whoami-cert" > $1 \ No newline at end of file From a524521214142b25a909e54d680946f23a654597 Mon Sep 17 00:00:00 2001 From: Jpeedroza Date: Fri, 13 Aug 2021 14:21:25 -0300 Subject: [PATCH 4/7] Att remove formula from whoami --- vkpr/whoami/remove/src/unix/formula/formula.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vkpr/whoami/remove/src/unix/formula/formula.sh b/vkpr/whoami/remove/src/unix/formula/formula.sh index 7cf6e45f..9d108102 100755 --- a/vkpr/whoami/remove/src/unix/formula/formula.sh +++ b/vkpr/whoami/remove/src/unix/formula/formula.sh @@ -8,7 +8,8 @@ runFormula() { } uninstallWhoami(){ - helm uninstall whoami + $VKPR_HOME/bin/helm uninstall whoami + $VKPR_HOME/bin/kubectl delete secret whoami-cert } echoColor() { From 731db76dda7b76c7ff194c69675cb3d4f47b65d4 Mon Sep 17 00:00:00 2001 From: Jpeedroza Date: Fri, 13 Aug 2021 14:34:45 -0300 Subject: [PATCH 5/7] Refactoring whoami formula --- .../install/src/unix/formula/formula.sh | 26 ++++--------------- vkpr/whoami/install/src/utils/whoami.yaml | 9 +++---- .../whoami/remove/src/unix/formula/formula.sh | 4 +-- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/vkpr/whoami/install/src/unix/formula/formula.sh b/vkpr/whoami/install/src/unix/formula/formula.sh index 514af4f7..2e01e040 100755 --- a/vkpr/whoami/install/src/unix/formula/formula.sh +++ b/vkpr/whoami/install/src/unix/formula/formula.sh @@ -1,38 +1,22 @@ #!/bin/sh runFormula() { - echoColor "yellow" "Installing whoami..." VKPR_HOME=~/.vkpr - #mkdir -p $VKPR_HOME/values/whoami + VKPR_HELM=$VKPR_HOME/bin/helm VKPR_WHOAMI_VALUES=$(dirname "$0")/utils/whoami.yaml - #touch $VKPR_WHOAMI_VALUES addRepoWhoami installWhoami } addRepoWhoami(){ - $VKPR_HOME/bin/helm repo add cowboysysop https://cowboysysop.github.io/charts/ - $VKPR_HOME/bin/helm repo update + $VKPR_HELM repo add cowboysysop https://cowboysysop.github.io/charts/ + $VKPR_HELM repo update } -# verifyHasIngress(){ -# INGRESS=$($VKPR_HOME/bin/kubectl wait --for=condition=available deploy ingress-nginx-controller -o name | cut -d "/" -f2) -# if [[ ! $INGRESS = "ingress-nginx-controller" ]]; then -# local res=$? -# echo $res -# fi -# } - installWhoami(){ - # if [[ ! -n $(verifyHasIngress) ]]; then - # . $(dirname "$0")/utils/whoami.sh $VKPR_WHOAMI_VALUES - # helm upgrade -i -f $VKPR_WHOAMI_VALUES whoami cowboysysop/whoami - # else - # echoColor "red" "Não há ingress instalado, para utilizar o Whoami no localhost deve-se subir o ingress." - # helm upgrade -i whoami cowboysysop/whoami - # fi - $VKPR_HOME/bin/helm upgrade -i -f $VKPR_WHOAMI_VALUES whoami cowboysysop/whoami + echoColor "yellow" "Installing whoami..." + $VKPR_HELM upgrade -i -f $VKPR_WHOAMI_VALUES whoami cowboysysop/whoami } echoColor() { diff --git a/vkpr/whoami/install/src/utils/whoami.yaml b/vkpr/whoami/install/src/utils/whoami.yaml index 930c188c..b1febae6 100644 --- a/vkpr/whoami/install/src/utils/whoami.yaml +++ b/vkpr/whoami/install/src/utils/whoami.yaml @@ -3,12 +3,11 @@ ingress: annotations: kubernetes.io/ingress.class: nginx kubernetes.io/tls-acme: "true" - #cert-manager.io/cluster-issuer: letsencrypt-staging hosts: - host: "whoami.vkpr-dev.vertigo.com.br" paths: ["/"] - tls: - - hosts: - - "whoami.vkpr-dev.vertigo.com.br" - secretName: whoami-cert pathType: Prefix + tls: + - hosts: + - "whoami.vkpr-dev.vertigo.com.br" + secretName: whoami-cert diff --git a/vkpr/whoami/remove/src/unix/formula/formula.sh b/vkpr/whoami/remove/src/unix/formula/formula.sh index 9d108102..e355e18b 100755 --- a/vkpr/whoami/remove/src/unix/formula/formula.sh +++ b/vkpr/whoami/remove/src/unix/formula/formula.sh @@ -1,13 +1,13 @@ #!/bin/sh runFormula() { - echoColor "yellow" "Removendo Whoami..." VKPR_HOME=~/.vkpr - rm -rf $VKPR_HOME/values/whoami + uninstallWhoami } uninstallWhoami(){ + echoColor "yellow" "Removendo Whoami..." $VKPR_HOME/bin/helm uninstall whoami $VKPR_HOME/bin/kubectl delete secret whoami-cert } From da3ee363cc31a3a516da4b0b6b034238cea7ca8d Mon Sep 17 00:00:00 2001 From: Jpeedroza Date: Fri, 13 Aug 2021 15:06:46 -0300 Subject: [PATCH 6/7] Changing the formula helper messages from whoami --- vkpr/whoami/help.json | 4 ++-- vkpr/whoami/install/build.sh | 2 -- vkpr/whoami/install/config.json | 1 - vkpr/whoami/install/help.json | 4 ++-- vkpr/whoami/install/set_umask.sh | 3 --- vkpr/whoami/remove/config.json | 1 - vkpr/whoami/remove/help.json | 4 ++-- vkpr/whoami/remove/set_umask.sh | 3 --- 8 files changed, 6 insertions(+), 16 deletions(-) delete mode 100755 vkpr/whoami/install/set_umask.sh delete mode 100755 vkpr/whoami/remove/set_umask.sh diff --git a/vkpr/whoami/help.json b/vkpr/whoami/help.json index b4b57a08..735954f8 100644 --- a/vkpr/whoami/help.json +++ b/vkpr/whoami/help.json @@ -1,4 +1,4 @@ { - "short": "Add the Whoami to the cluster.", - "long": "Add a Pod and dependences containing a Whoami App in the cluster." + "short": "Manage whoami", + "long": "Whoami is a Tiny Go webserver that prints OS information and HTTP request to output" } \ No newline at end of file diff --git a/vkpr/whoami/install/build.sh b/vkpr/whoami/install/build.sh index 10c4ad30..9d822cee 100755 --- a/vkpr/whoami/install/build.sh +++ b/vkpr/whoami/install/build.sh @@ -2,9 +2,7 @@ BIN_FOLDER=bin BINARY_NAME_UNIX=run.sh -BINARY_NAME_WINDOWS=run.bat ENTRY_POINT_UNIX=main.sh -ENTRY_POINT_WINDOWS=main.bat #bash-build: mkdir -p $BIN_FOLDER diff --git a/vkpr/whoami/install/config.json b/vkpr/whoami/install/config.json index 1815fa5e..faf40389 100755 --- a/vkpr/whoami/install/config.json +++ b/vkpr/whoami/install/config.json @@ -1,5 +1,4 @@ { - "dockerImageBuilder": "ritclizup/rit-shell-bat-builder", "inputs": [ { "default": "whoami.localhost", diff --git a/vkpr/whoami/install/help.json b/vkpr/whoami/install/help.json index 5c51828d..47eaf5a0 100644 --- a/vkpr/whoami/install/help.json +++ b/vkpr/whoami/install/help.json @@ -1,4 +1,4 @@ { - "short": "Install the Whoami to the cluster.", - "long": "Install the Pod and dependences containing a Whoami App in the cluster." + "short": "Install whoami", + "long": "Install the whoami in the cluster by a Helm Chart." } \ No newline at end of file diff --git a/vkpr/whoami/install/set_umask.sh b/vkpr/whoami/install/set_umask.sh deleted file mode 100755 index 091c13d6..00000000 --- a/vkpr/whoami/install/set_umask.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -umask 0011 -$1 diff --git a/vkpr/whoami/remove/config.json b/vkpr/whoami/remove/config.json index e87a59b6..257f1ebe 100755 --- a/vkpr/whoami/remove/config.json +++ b/vkpr/whoami/remove/config.json @@ -1,5 +1,4 @@ { - "dockerImageBuilder": "ritclizup/rit-shell-bat-builder", "inputs": [], "template": "shell-bat", "templateRelease:": "2.16.2" diff --git a/vkpr/whoami/remove/help.json b/vkpr/whoami/remove/help.json index 0315fca4..47a0dade 100644 --- a/vkpr/whoami/remove/help.json +++ b/vkpr/whoami/remove/help.json @@ -1,4 +1,4 @@ { - "short": "Remove the Whoami from the cluster.", - "long": "Remove all the content about the Whoami App in the cluster." + "short": "Remove whoami", + "long": "Remove the whoami and its dependencies from the cluster" } \ No newline at end of file diff --git a/vkpr/whoami/remove/set_umask.sh b/vkpr/whoami/remove/set_umask.sh deleted file mode 100755 index 091c13d6..00000000 --- a/vkpr/whoami/remove/set_umask.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -umask 0011 -$1 From cec1ec139bb15b66ef31c885b79e7c6aab33e503 Mon Sep 17 00:00:00 2001 From: HumbertoPeluso Date: Mon, 16 Aug 2021 09:59:38 -0300 Subject: [PATCH 7/7] using yq to set variable --- vkpr/whoami/install/config.json | 4 ++-- vkpr/whoami/install/src/unix/formula/formula.sh | 9 +++------ vkpr/whoami/install/src/utils/whoami.sh | 15 --------------- vkpr/whoami/install/src/utils/whoami.yaml | 13 +++++++++++++ 4 files changed, 18 insertions(+), 23 deletions(-) delete mode 100644 vkpr/whoami/install/src/utils/whoami.sh create mode 100644 vkpr/whoami/install/src/utils/whoami.yaml diff --git a/vkpr/whoami/install/config.json b/vkpr/whoami/install/config.json index 1815fa5e..3e2e0e46 100755 --- a/vkpr/whoami/install/config.json +++ b/vkpr/whoami/install/config.json @@ -4,7 +4,7 @@ { "default": "whoami.localhost", "label": "Type the Whoami domain: ", - "name": "input_domain", + "name": "domain", "required": true, "type": "text" }, @@ -15,7 +15,7 @@ "false" ], "label": "Secure? ", - "name": "input_secure", + "name": "secure", "required": true, "type": "bool" } diff --git a/vkpr/whoami/install/src/unix/formula/formula.sh b/vkpr/whoami/install/src/unix/formula/formula.sh index 054e936f..56490341 100755 --- a/vkpr/whoami/install/src/unix/formula/formula.sh +++ b/vkpr/whoami/install/src/unix/formula/formula.sh @@ -3,10 +3,7 @@ runFormula() { echoColor "yellow" "Instalando Whoami..." VKPR_HOME=~/.vkpr - mkdir -p $VKPR_HOME/values/whoami - VKPR_WHOAMI_VALUES=$VKPR_HOME/values/whoami/values.yaml - touch $VKPR_WHOAMI_VALUES - echoColor "yellow" "Secure is a working in progress." + VKPR_WHOAMI_VALUES=$(dirname "$0")/utils/whoami.yaml addRepoWhoami installWhoami } @@ -25,8 +22,8 @@ verifyHasIngress(){ installWhoami(){ if [[ ! -n $(verifyHasIngress) ]]; then - . $(dirname "$0")/utils/whoami.sh $VKPR_WHOAMI_VALUES $INPUT_DOMAIN - helm upgrade -i -f $VKPR_WHOAMI_VALUES whoami cowboysysop/whoami + $VKPR_HOME/bin/yq eval '.ingress.hosts[0].host = "'$DOMAIN'" | .ingress.tls[0].hosts[0] = "'$DOMAIN'"' "$VKPR_WHOAMI_VALUES" \ + | helm upgrade -i -f - whoami cowboysysop/whoami else echoColor "red" "Não há ingress instalado, para utilizar o Whoami no localhost deve-se subir o ingress." helm upgrade -i whoami cowboysysop/whoami diff --git a/vkpr/whoami/install/src/utils/whoami.sh b/vkpr/whoami/install/src/utils/whoami.sh deleted file mode 100644 index 4c75d2a0..00000000 --- a/vkpr/whoami/install/src/utils/whoami.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -printf \ -"ingress: - enabled: true - annotations: - kubernetes.io/ingress.class: nginx - kubernetes.io/tls-acme: '"true"' - pathType: Prefix - hosts: - - host: $2 - paths: ['"/"'] - tls: - - hosts: - - $2 - secretName: whoami-cert" > $1 \ No newline at end of file diff --git a/vkpr/whoami/install/src/utils/whoami.yaml b/vkpr/whoami/install/src/utils/whoami.yaml new file mode 100644 index 00000000..a5906335 --- /dev/null +++ b/vkpr/whoami/install/src/utils/whoami.yaml @@ -0,0 +1,13 @@ +ingress: + enabled: true + annotations: + kubernetes.io/ingress.class: nginx + kubernetes.io/tls-acme: "true" + pathType: Prefix + hosts: + - host: domain + paths: ["/"] + tls: + - hosts: + - domain + secretName: whoami-cert \ No newline at end of file