Cloud Scheduler
Cloud Scheduler is a fully managed cron job service in GCP.
Technical characteristics
- Based on standard cron rules (* * * * *)
- Runs jobs at regular intervals or specific times (for example, every hour, daily, on Mondays, etc.)
- Can trigger different target types:
- HTTP/HTTPS (REST API)
- Pub/Sub (event-driven)
Relationship between Cloud Scheduler, HTTP, and Pub/Sub
Cloud Scheduler can integrate with both:
| Method | What it does | Example |
|---|---|---|
| HTTP | Calls an endpoint directly via HTTP | Sends a POST to an API that shuts down instances |
| Pub/Sub | Publishes a message to a topic | Triggers a function that listens to a topic and executes logic |
⚙️ Main Features
1. Scheduler Creation
Pub/Sub Type Scheduler
Allows scheduling messages to a Pub/Sub topic.
Form inputs:
- GCP Project (Required): Google Cloud project (Example: trmdomain-prod)
- Job Name (Required): Unique job name (Example: andes-load-cost)
- Payload Message: Message in JSON format to send (Example:
{ "key": "value" }) - Description: Brief description (Example: Automatic cost loading)
- Schedule (Required): Cron expression for execution frequency (Example: 0 */1 * * *)
- Topic (Required): Pub/Sub topic (Example: projects/trmdomain-prod/topics/latam-cost)
- Time Zone: Cron time zone (Example: Etc/UTC)
- Retry Configurations (Optional): Retry configuration:
- Max Backoff Duration: 320s
- Max Doublings: 5
- Min Backoff Duration: 5s
- Max Retry Duration: 10s
- Retry Count: 3
HTTP Type Scheduler
Allows scheduling HTTP requests to a specific URL.
Form inputs:
- GCP Project (Required): Google Cloud project (Example: trmdomain-intg)
- Job Name (Required): Job name (Example: andes-update-opcon)
- Http Target URL (Required): Target URL (Example: https://andes-prod-api-gateway.example.com)
- Http Target Headers: Additional HTTP headers
(Example:
{ "Content-Type": "application/json", "Authorization": "Bearer token" }) - Http Method: HTTP method (GET or POST)
- OIDC Auth (Optional): OIDC authentication configuration:
- OIDC Audience (Example: https://example.com)
- OIDC SA Email (Example: service-account@example.com)
- Schedule (Required): Cron expression (Example: 0 4 * * *)
- Retry Configurations (Optional): Same as Pub/Sub
2. Scheduler Synchronization
Allows synchronizing all Schedulers in a selected project.
Process:- Select the project in the GCP Project field (Example: operationsdomain-intg)
- Click Sync Scheduler
- The system detects and registers all existing Schedulers within the project
3. Day-2 Operations
Allows managing each job individually.
Available Options:
- Force Run: Immediately executes the selected job
- Pause Job: Temporarily pauses job execution
- Resume Job: Reactivates a paused job
- Edit Pub/Sub or HTTP Scheduler: Allows modifying values and reflecting them in GCP
- Delete Scheduler: Deletes the Scheduler and its workspace
Note: Schedulers created outside ANDES can now be edited, but changes must be made directly in the Google API and will be recorded in ANDES.
Process:
- Select the job in the list
- Access the actions menu
- Choose the required operation
Technical Description of the Scheduler Creation Process
The system diagram represents the workflow for creating and managing Schedulers in Google Cloud through integrated tools.
System Flow
- Port: Entry point where the user sends a POST request with JSON to the API Gateway
- API Gateway: Redirects data to the Cloudrun Scheduler Sync service
- Cloudrun Scheduler Sync:
- Validates the information
- Sends a request to create a workspace in Terraform Cloud
- Terraform Cloud:
- Executes the plan to create or update the Scheduler in Google Cloud
- Sends notifications about the workspace status
- Google Cloud: The Scheduler is created in the corresponding project
- Port: When creation completes, a blueprint is generated in Port as a visual record
🔹 Key Components:
- Port: Initial interface
- API Gateway: Manages incoming requests
- Cloudrun Scheduler Sync: Integration service
- Terraform Cloud: Infrastructure as code management
- Google Cloud: Platform where schedulers run
Permissions and Access
🔹 Who can view?
- All users with access to the corresponding GCP project
🔹 Who can create?
- Users with permissions in Google Cloud Scheduler and access to the API Gateway
🔹 Who can modify?
- Project administrators
- Users with access to the workspace in Terraform Cloud
User Interface
The interface shows:
- List of active Schedulers with their status
- Synchronization options and Day-2 operations
- Forms to create and edit schedulers
Forms and Data Delivery
🔹 What can you do in the form?
- Create a Scheduler from scratch
- Edit an existing Scheduler
- Configure advanced parameters such as retries, authentication, and payloads
🔹 How is data delivered?
- It is sent as a POST request in JSON format to the API Gateway
JSON Payload Example:
{
"gcp_project": "trmdomain-prod",
"job_name": "andes-load-cost",
"schedule": "0 */1 * * *",
"topic": "projects/trmdomain-prod/topics/latam-cost",
"payload": { "key": "value" },
"retry_config": { "max_backoff_duration": "320s", "max_doublings": 5 }
}