-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do an example of scheduling a Cloud Run app for R code #114
Comments
Need to add the scheduler email as a role: auth_step <- cr_buildstep_gcloud(
args = c("gcloud",
"run", "services", "add-iam-policy-binding",
name,
sprintf("--member=serviceAccount:%s",cr_email_get()),
"--role=roles/run.invoker",
"--platform", "managed",
name),
id = "auth cloudrun",
...) ?? |
It seems impossible for the invoker for private Cloud Run to be the same email as the one deploying it (which is weird if you ask me - the error was "this@email does not have permission to act on behalf of this@email"). Down that rabbit hole the Cloud run deployment process (via # for unauthenticated apps create a HttpTarget
run_me <- HttpTarget(
uri = "https://public-ewjogewawq-ew.a.run.app/echo?msg=blah",
http_method = "GET"
)
cr_schedule("cloud-run-scheduled", schedule = "16 4 * * *",
httpTarget = run_me)
# for authenticated Cloud Run apps - create with allowUnauthenticated=FALSE
cr_deploy_run("my-app", allowUnauthenticated = TRUE)
## End(Not run)
# deploying via R will help create a service email called my-app-cloudrun-invoker
cr_run_email("my-app")
## Not run:
# use that email to schedule the Cloud Run private micro-service
# schedule the endpoint
my_run_name <- "my-app"
my_app <- cr_run_get(my_run_name)
email <- cr_run_email(my_run_name)
endpoint <- paste0(my_app$status$url, "/fetch_stuff")
app_sched <- cr_run_schedule_http(endpoint,
http_method = "GET",
email = email)
cr_schedule("cloud-run-scheduled-1",
schedule = "4 16 * * *",
httpTarget = app_sched) |
Maybe add the option to the "Schedule R script" gadget to have a plumber API endpoint as an option.
The text was updated successfully, but these errors were encountered: