@@ -103,29 +103,32 @@ then
103
103
fi
104
104
105
105
installHelmFunction
106
-
106
+
107
107
echo " Setting the Kube context"
108
108
az aks get-credentials -g $RGNAME -n $AKSNAME
109
109
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"
110
120
AKSLOCATION=$( az aks show -n ${AKSNAME} -g ${RGNAME} --query location -o tsv)
111
121
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
113
123
114
124
echo " Create namespace ${INGRESSNAME} "
115
125
kubectl create namespace $INGRESSNAME
116
-
126
+
117
127
# Use Helm to deploy a traefik ingress controller
118
128
echo " helm repo add && helm repo update"
119
129
${HELMDIR} /helm repo add stable https://kubernetes-charts.storage.googleapis.com/
120
130
${HELMDIR} /helm repo update
121
131
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"
129
132
${HELMDIR} /helm install $INGRESSNAME stable/traefik \
130
133
--namespace $INGRESSNAME \
131
134
--set kubernetes.ingressClass=traefik \
0 commit comments