0
votes

Attempting to migrate from k8s to Cloud Run... I have one container that ordinarily gets started via CMD ["npm","start"] but it has some utility methods that k8s invokes on cron. k8s conveniently allowed me to define the CMD override so I defined the same container but in the cron definition could set the CMD to a different script.

For Cloud-Run I was planning on duplicating this using cloud scheduler - hitting the endpoint of the cloud run service that would have the special cron CMD defined... but it seems like there is nowehere in the console and no args in gcloud beta run that let me define a command to run or enrtypoint. So do I have to build a separate image off a second Dockerfile for the separate command if I want to do this?

1

1 Answers

0
votes

For customizing your execution, you can:

  1. Use environment variable. So with the same container, but with different deployment, you can customize your run (for information, there is a limit at 100 services per project)

  2. Pass parameter to your http endpoints. According with this param do what you want. But you have to package all your run into the same endpoint.

  3. Alternative to point 2, you can have 1 endpoint per execution, but here again, all your scripts are packaged in the same execution

In definitive, you have always the same CMD command and you can only customize it with environment variable.