Last active
June 10, 2021 21:28
-
-
Save alchen99/b9fbd343e59766346636e5869fc7fee9 to your computer and use it in GitHub Desktop.
Add SAN entries to Traefik 2 dynamic config for minnaker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# if parent path to minnaker is passed in then use that otherwise assume it's /home/ubuntu/minnaker | |
MINNAKER_HOME="${1:-/home/ubuntu/minnaker}" | |
TRAEFIK2_CONFIG_PATH="${MINNAKER_HOME}/templates/addons/traefik2/config/traefik2-config.yml" | |
PUBLIC_IP=$(cat ${MINNAKER_HOME}/spinsvc/secrets/public_ip) | |
DOMAINS="spinnaker api alertmanager prometheus grafana jenkins ldap consul vault" | |
echo "[INFO] SAN addresses to be added to Traefik 2 ..." | |
for i in $DOMAINS | |
do | |
SAN="${i}.${PUBLIC_IP}.nip.io" | |
echo "[INFO] ${SAN}" | |
yq w -i "${TRAEFIK2_CONFIG_PATH}" 'entryPoints.https.http.tls.domains[0].sans[+]' "${SAN}" | |
done | |
# reapply changed config | |
kubectl kustomize "${MINNAKER_HOME}/templates/addons/traefik2" | kubectl apply -f - | |
# delete Traefik2 pod to reload config | |
#traefikPod=`kubectl -n kube-system get pods | grep -e '^traefik-.*' | cut -d' ' -f1` | |
#kubectl -n kube-system delete pod $traefikPod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment