Few lines of scripting |
I heard that built-in support is on the roadmap. For now, I am using a Code Engine cron subscription for the job...
Scale up and down, scheduled
To change the configured values for the minimum and maximum scaling, it requires to update the deployed Code Engine app and specify the new values. This can be easily done on the command line (see screenshot above). But how to schedule such changes? It is similar to my data scraping project which I blogged about: Use Code Engine cron subscriptions to invoke a job with a simple script.
A secret? Environment variables!
I am using environment variables to parameterize the script for different Code Engine apps and configurations. Those variables are defined in a text file which I register as a secret and then make available to the job. Variables can also be set when invocing the job during a so-called jobrun. Passing environment variables from a cron event to the job is a little bit trickier, but doable.
With that, all is in place and I have the blueprint for my scheduled change of Code Engine app configurations, including the scheduled scaling up and down. See the code on GitHub for details and instructions.
If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.