-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Requirements
FR1: Embedded HTTP API Server
Objective: Embed an HTTP server within the khook controller to expose event data via REST API
Technical Requirements:
- Serve HTTP API on configurable port (default: 8082)
- Support graceful startup/shutdown with controller lifecycle
- Implement request routing, middleware, and error handling
- Add authentication and authorization mechanisms
- Include request logging and metrics collection
FR2: Event Query Endpoints
Objective: Provide REST endpoints for querying collected events with filtering capabilities
API Specification:
GET /api/v1/events
GET /api/v1/events/{namespace}
GET /api/v1/hooks/{namespace}/{name}/events
GET /api/v1/events/types/{eventType}Query Parameters:
startTime&endTime: Time-based filtering (RFC3339 format)eventType: Filter by event type (pod-restart, oom-kill, etc.)resourceName: Filter by Kubernetes resource namestatus: Filter by event status (firing, resolved, duplicate)limit&offset: Pagination supportsort: Sort by timestamp, eventType, resourceName
FR3: Event Statistics and Aggregation
Objective: Provide aggregated event statistics and metrics via API
Endpoints:
GET /api/v1/stats/events/summary
GET /api/v1/stats/events/by-type
GET /api/v1/stats/hooks/{namespace}/{name}/metrics
GET /api/v1/stats/trendsResponse Format:
{
"summary": {
"totalEvents": 1247,
"activeEvents": 23,
"duplicateEvents": 156,
"timeRange": "24h"
},
"byType": {
"pod-restart": {"count": 856, "percentage": 68.7},
"oom-kill": {"count": 234, "percentage": 18.8},
"pod-pending": {"count": 157, "percentage": 12.5}
}
}FR4: Real-time Event Streaming
Objective: Support real-time event streaming via WebSockets or Server-Sent Events
Technical Features:
- WebSocket endpoint:
ws://khook:8082/api/v1/events/stream - Server-Sent Events:
GET /api/v1/events/streamwithAccept: text/event-stream - Configurable event filtering for streams
- Connection management and automatic reconnection
- Rate limiting and backpressure handling
FR5: Hook Configuration Management
Objective: Provide API endpoints for managing Hook configurations
Endpoints:
GET /api/v1/hooks
GET /api/v1/hooks/{namespace}/{name}
POST /api/v1/hooks/validateFeatures:
- List all Hook configurations with status
- Validate Hook configurations before deployment
- Export Hook configurations in YAML format
- Display Hook processing statistics
FR6: Health and Diagnostics
Objective: Provide comprehensive health monitoring and diagnostic information
Endpoints:
GET /api/v1/health
GET /api/v1/diagnostics
GET /api/v1/metricsHealth Information:
- API server status and uptime
- Event processing pipeline health
- Kagent API connectivity status
- Plugin status (for pluggable event sources)
- Memory usage and performance metrics
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request