From d4d8565bcc0b99d6fb36e296c513d8e4de2db4d7 Mon Sep 17 00:00:00 2001 From: FOSSO <7119916+jtande@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:03:37 -0400 Subject: [PATCH] script to bind FQDN (available) to the jupyterhub IP address This is valid for Azure Example: jhub-mat454-654.eastus.cloudapp.azure.com --- bind-jhub-fqdn2IP.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 bind-jhub-fqdn2IP.sh diff --git a/bind-jhub-fqdn2IP.sh b/bind-jhub-fqdn2IP.sh new file mode 100644 index 0000000..c6e5f61 --- /dev/null +++ b/bind-jhub-fqdn2IP.sh @@ -0,0 +1,39 @@ +#! /bin/bash +############################################ +# This script will help bind the fqdn +# to the Jupyterhub static IP address. +# This usefull on Azure. You probably have +# similar process on other cloud provide +# +# Original script from here +# https://docs.microsoft.com/en-us/azure/aks/ingress-tls +# Synopsis: +# ./bind-jhub-fqdn2IP.sh +# CC 2023-04-11 Jacob Fosso Tande +######################################### +# configure an FQDN for the ingress controller IP address +# Public IP address of your ingress controller +IPADDRESS=$1 +NAME=$2 +IP="$IPADDRESS" + +# Name to associate with public IP address +DNSNAME="$NAME" + +# Get the resource-id of the public ip +PUBLICIPID=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[id]" --output tsv) + +# Update public ip address with DNS name +az network public-ip update --ids $PUBLICIPID --dns-name $DNSNAME + +# Display the FQDN +FQDN=$(az network public-ip show --ids $PUBLICIPID --query "[dnsSettings.fqdn]" --output tsv) + +echo " " +echo " " +echo " Got FQDN " +echo " " +echo " " +echo $FQDN +echo " " +echo " "