Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Commit 4951acf

Browse files
author
DrEsteban
authored
Moving role assignment command to before public IP creation (#352)
1 parent b605382 commit 4951acf

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

local-process-quickstart.sh

+13-10
Original file line numberDiff line numberDiff line change
@@ -103,29 +103,32 @@ then
103103
fi
104104

105105
installHelmFunction
106-
106+
107107
echo "Setting the Kube context"
108108
az aks get-credentials -g $RGNAME -n $AKSNAME
109109

110+
echo "Applying role assignment"
111+
SUB=$(az account show --query id -o tsv)
112+
SPID=$(az aks show -n ${AKSNAME} -g ${RGNAME} --query servicePrincipalProfile.clientId -o tsv)
113+
if [[ "${SPID}" == "msi" ]]; then
114+
# Managed identity cluster
115+
SPID=$(az aks show -n ${AKSNAME} -g ${RGNAME} --query identity.principalId -o tsv)
116+
fi
117+
az role assignment create --assignee ${SPID} --scope "/subscriptions/${SUB}/resourceGroups/${RGNAME}" --role "Network Contributor"
118+
119+
echo "Creating Public IP"
110120
AKSLOCATION=$(az aks show -n ${AKSNAME} -g ${RGNAME} --query location -o tsv)
111121
PUBLICIP=$(az network public-ip create --resource-group $RGNAME --name $PIPNAME --location $AKSLOCATION --sku Standard --allocation-method static --query publicIp.ipAddress -o tsv)
112-
echo "BikeSharing ingress Public ip: " $PUBLICIP
122+
echo "BikeSharing ingress Public IP: " $PUBLICIP
113123

114124
echo "Create namespace ${INGRESSNAME}"
115125
kubectl create namespace $INGRESSNAME
116-
126+
117127
# Use Helm to deploy a traefik ingress controller
118128
echo "helm repo add && helm repo update"
119129
${HELMDIR}/helm repo add stable https://kubernetes-charts.storage.googleapis.com/
120130
${HELMDIR}/helm repo update
121131
echo "helm install traefik ingress controller"
122-
SUB=$(az account show --query id -o tsv)
123-
SPID=$(az aks show -n ${AKSNAME} -g ${RGNAME} --query servicePrincipalProfile.clientId -o tsv)
124-
if [[ "${SPID}" == "msi" ]]; then
125-
# Managed identity cluster
126-
SPID=$(az aks show -n ${AKSNAME} -g ${RGNAME} --query identity.principalId -o tsv)
127-
fi
128-
az role assignment create --assignee ${SPID} --scope "/subscriptions/${SUB}/resourceGroups/${RGNAME}" --role "Network Contributor"
129132
${HELMDIR}/helm install $INGRESSNAME stable/traefik \
130133
--namespace $INGRESSNAME \
131134
--set kubernetes.ingressClass=traefik \

0 commit comments

Comments
 (0)