Webhooks
Webhooks in Kontroler
Webhooks allow external systems to receive real-time notifications about task execution status. When configured, Kontroler sends HTTP POST requests with task status information to your specified endpoints.
Basic Configuration
Add webhook configuration to your DAG:
apiVersion: kontroler.greedykomodo/v1alpha1
kind: DAG
metadata:
name: webhook-example
spec:
webhook:
verifySSL: true
url: "http://your-webhook-endpoint:8080/webhook"
task:
- name: "example-task"
# ... task configuration ...
Webhook Payload
When a task completes, Kontroler sends a JSON payload to your webhook endpoint:
{
"status": "success", // or "failed"
"dagRunId": 123, // unique identifier for the DAG run
"taskName": "task-1" // name of the task that completed
}
Configuration Options
SSL Verification
webhook:
verifySSL: true # Enable SSL certificate verification
url: "https://secure-endpoint.com/webhook"
Multiple Tasks
spec:
webhook:
url: "http://notification-service/webhook"
task:
- name: "task-1"
# ... task config ...
- name: "task-2"
# ... task config ...
Best Practices
-
Endpoint Reliability
- Ensure webhook endpoints are highly available
- Implement proper error handling
-
Security
- Use HTTPS endpoints
- Allows insecure if needed
- Enable SSL verification when possible
Example Implementation
Here’s a complete example:
apiVersion: kontroler.greedykomodo/v1alpha1
kind: DAG
metadata:
name: notification-workflow
spec:
webhook:
verifySSL: true
url: "https://notification-service.example.com/webhook"
task:
- name: "processing-task"
command: ["python"]
args: ["process.py"]
image: "python:3.9"
Possible Use Cases
-
Notification Systems
- Alert teams about task completion
- Trigger notifications on failures
- Update status dashboards
-
Workflow Coordination
- Trigger external processes
- Update related systems
- Maintain audit trails
-
Monitoring
- Track task completion rates
- Monitor execution times
- Collect performance metrics
Troubleshooting
-
Connection Issues
- Verify endpoint accessibility
- Check network policies
- Validate SSL certificates
-
Payload Problems
- Validate JSON format
- Check payload size
- Verify content types
-
Security
- Check SSL configuration
- Verify authentication
- Review access permissions