Skip to content

Commit a9e1e85

Browse files
committed
Attempt to assign data reader role to MI
1 parent 1ac9271 commit a9e1e85

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

config/capz/manager_image_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ spec:
88
spec:
99
containers:
1010
# Change the value of image field below to your controller image URL
11-
- image: gcr.io/k8s-staging-cluster-api-azure/cluster-api-azure-controller:main
11+
- image: docker.io/jont828/cluster-api-azure-controller-amd64:dev
1212
name: manager

config/capz/manager_pull_policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ spec:
88
spec:
99
containers:
1010
- name: manager
11-
imagePullPolicy: Always
11+
imagePullPolicy: IfNotPresent

scripts/aks-as-mgmt.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ create_aks_cluster() {
201201
sleep 5
202202
done
203203

204+
# If storage account var is set:
205+
if [ -n "${AZURE_STORAGE_ACCOUNT}" ]; then
206+
echo "assigning storage blob data reader role to the service principal"
207+
until az role assignment create --assignee-object-id "${AKS_MI_OBJECT_ID}" --role "Storage Blob Data Reader" \
208+
--scope "/subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${AZURE_STORAGE_ACCOUNT_RESOURCE_GROUP}/providers/Microsoft.Storage/storageAccounts/${AZURE_STORAGE_ACCOUNT}/blobServices/default/containers/${AZURE_BLOB_CONTAINER_NAME}" \
209+
--assignee-principal-type ServicePrincipal; do
210+
echo "retrying to assign storage blob data reader role to the service principal"
211+
sleep 5
212+
done
213+
fi
214+
204215
echo "using ASO_CREDENTIAL_SECRET_MODE as podidentity"
205216
ASO_CREDENTIAL_SECRET_MODE="podidentity"
206217
}

0 commit comments

Comments
 (0)