test: k8s: test acr integration
@@ -23,6 +23,14 @@ function teardown {
# TODO: cleanup the loops more
# TODO: the wc|awk business can just be kubectl with an output format and wc -l
+###### Deploy ACR
+ACR_NAME="${INSTANCE_NAME//[-._]/}1"
+ACR_REGISTRY="${ACR_NAME}-microsoft.azurecr.io" # fix this for non-ms tenant users
+IMAGE="${ACR_REGISTRY}/test/nginx:latest" # ?
+if ! az acr show --resource-group "${INSTANCE_NAME}" --name "${ACR_NAME}" ; then
+ az acr create --location "${LOCATION}" --resource-group "${INSTANCE_NAME}" --name "${ACR_NAME}" &
+fi
+
###### Check node count
wait=5
count=12
@@ -39,7 +47,7 @@ fi
wait=5
count=12
while (( $count > 0 )); do
- creating_count=$(kubectl get nodes --no-headers | grep 'ContainerCreating' | wc | awk '{print $1}')
+ creating_count=$(kubectl get nodes --no-headers | grep 'CreatingContainer' | wc | awk '{print $1}')
if (( ${creating_count} == 0 )); then break; fi
sleep 5; count=$((count-1))
done
@@ -88,7 +96,15 @@ fi
echo "Testing deployments"
kubectl create namespace ${namespace}
-kubectl run --image=nginx nginx --namespace=${namespace}
+# wait for acr
+wait
+# TODO: how to do this without polluting user home dir?
+docker login --username="${SERVICE_PRINCIPAL_CLIENT_ID}" --password="${SERVICE_PRINCIPAL_CLIENT_SECRET}" "${ACR_REGISTRY}"
+docker pull docker.io/library/nginx:latest
+docker tag docker.io/library/nginx:latest "${IMAGE}"
+docker push "${IMAGE}"
+
+kubectl run --image="${IMAGE}" nginx --namespace=${namespace}
wait=5
count=12
while (( $count > 0 )); do
