$ gcloud iam service-accounts create callee
$ gcloud iam service-accounts create caller
$ gcloud builds submit -t gcr.io/${PROJECT_ID}/oidctest .
$ gcloud beta run deploy --image=gcr.io/${PROJECT_ID}/oidctest --allow-unauthenticated \
--service-account=caller@${PROJECT_ID}.iam.gserviceaccount.com caller
$ gcloud beta run deploy --image=gcr.io/${PROJECT_ID}/oidctest --no-allow-unauthenticated \
--service-account=callee@{PROJECT_ID}.iam.gserviceaccount.com callee
$ gcloud beta run services add-iam-policy-binding callee \
--member=serviceAccount:caller@${PROJECT_ID}.iam.gserviceaccount.com \
--role=roles/run.invoker
$ CALLER_URL=$(gcloud beta run services describe caller --format="value(status.domain)")
$ CALLEE_URL=$(gcloud beta run services describe callee --format="value(status.domain)")
# callee can't be called without auth
$ curl -i "${CALLEE_URL}"
HTTP/2 403
...
# callee can be called by caller
$ curl "${CALLER_URL}/call?destination=${CALLEE_URL}"
caller=caller: callee=callee