Add Schedule to an Environment Template - Rafay Product Documentation
Schedules
In this section, you will update the "environment template" to use a schedule. The schedule will control when an environment will be executed (i.e created or destroyed automatically). You will implement the steps described below
- You will first update the existing environment template and add a schedule to the template.
- You will then launch the template and view the actions kick off based on the configured schedule.
Step 1: Create Schedule
In this step, you will update the existing environment template used in the Introductory Exercise by adding a schedule to the template. The schedule will be configured to destroy the environment after a preset amount of time.
In your project, navigate to Environments -> Environment Templates
Click on the name of the environment template
Edit the template
Navigate to Schedules
Click + Schedule
Enter a name for the schedule
Select One-time for the Frequency Type
Enter 5 for the Time to live field
Select Destroy for the Action Type
Click Save
Click Save as Draft
Step 2: Create Environment
In this step, we will create a new environment using the recently updated environment template. The environment will be created and then automatically be destroyed after a predefined amount of time.
- In your project, navigate to Environments -> Environments
- Click Launch on the environment template card
- Enter a name for the environment
- Enter a value for the username variable
- Click Save & Deploy
As the environment is being created, you can see countdown to the next scheduled action.
Once the scheduled time is reached, the schedule will automatically take action to destroy the environment.
- Click View All Runs
You will see the initial deployment as well as the automated scheduled destroy of the environment.
Recap
In this part, you attached a schedule to your environment template. The schedule was configured to automatically destroy the environment after a predefined amount of time. In the next part, we will extend and build on this by attaching a hook that will allow us to insert custom logic into our template.