Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into VKPR-110-create-cert-…
Browse files Browse the repository at this point in the history
…manager-formula-in-cli
  • Loading branch information
HumbertoPeluso committed Aug 16, 2021
2 parents 7c291dd + 378e9c3 commit e882f7a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions vkpr/external-dns/install/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"AWS"
],
"label": "What is your cloud provider? ",
"name": "input_cloud_provider",
"name": "provider",
"required": true,
"type": "text"
},
{
"name": "digitalocean_apitoken",
"name": "token",
"type": "CREDENTIAL_DIGITALOCEAN_APITOKEN"
}
],
Expand Down
23 changes: 18 additions & 5 deletions vkpr/external-dns/install/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ runFormula() {
VKPR_EXTERNAL_DNS_LOCAL=$VKPR_HOME/values/external-dns
VKPR_EXTERNAL_DNS_VALUES=$VKPR_EXTERNAL_DNS_LOCAL/external-dns.yaml
mkdir -p $VKPR_EXTERNAL_DNS_LOCAL
VKPR_EXTERNAL_DNS_VALUES=$(dirname "$0")/utils/external-dns.yaml

getProvider $PROVIDER
add_repo_external_dns
install_external_dns
}
Expand All @@ -17,17 +19,28 @@ add_repo_external_dns() {
}

install_external_dns() {
getProvider $INPUT_CLOUD_PROVIDER
if [[ ! -e $VKPR_EXTERNAL_DNS_VALUES ]]; then
. $(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
}

get_credentials() {
# CREDENTIAL INPUT NOT WORKING IN SHELL FORMULA
# PARSING FILE DIRECTLY AND IGNORING INPUT ("-r" is important!!!)
#VKPR_ACCESS_TOKEN_INPUT=$(jq -r .credential.token ~/.rit/credentials/default/digitalocean)
if [ -z "$TOKEN" ]; then
echo "yellow" "No digitalocean token found in rit credentials. Falling back to DO_AUTH_TOKEN env variable."
TOKEN="$DO_AUTH_TOKEN"
fi
if [ -z "$TOKEN" ]; then
echoColor "red" "No digitalocean token found in both rit credentials or DO_AUTH_TOKEN env variable."
echoColor "red" "Cert-manager will fail to negotiate certificates unless you provide the digitalocean-dns secret manually."
echoColor "red" "Please check https://cert-manager.io/docs/configuration/acme/dns01/digitalocean/"
fi
}

getProvider(){
case $1 in
DIGITALOCEAN)
export DO_AUTH_TOKEN=$DIGITALOCEAN_APITOKEN
get_credentials
;;
AWS)
echoColor "yellow" "AWS is a working in progress."
Expand Down
11 changes: 0 additions & 11 deletions vkpr/external-dns/install/src/utils/external-dns.sh

This file was deleted.

9 changes: 9 additions & 0 deletions vkpr/external-dns/install/src/utils/external-dns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rbac:
create: true
sources:
- ingress
- service
provider: digitalocean
interval: "1m"
digitalocean:
apiToken: $Token

0 comments on commit e882f7a

Please sign in to comment.