Skip to content

Implement HTTP API for deployment observability queries#77

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-76
Draft

Implement HTTP API for deployment observability queries#77
Copilot wants to merge 3 commits intomainfrom
copilot/fix-76

Conversation

Copy link

Copilot AI commented Jul 30, 2025

This PR implements a comprehensive HTTP API for the Kalypso Observability Hub, addressing the "TBD" API component mentioned in the README. The API enables external systems like GitHub CD workflows to query deployment observability data through RESTful endpoints.

Key Features

RESTful HTTP API Server

  • Built with Gorilla Mux for robust HTTP routing
  • Integrates with existing PostgreSQL storage layer
  • Runs optionally alongside the Kubernetes controller (disabled by default)

Core Endpoints

  • GET /health - Health check for monitoring
  • GET /api/v1/deployment-state - Query deployment states with manifests endpoint and commit ID filtering
  • GET /api/v1/environments/{name} - Retrieve environment information by name
  • GET /api/v1/deployments/{id} - Access deployment details by ID

Configuration & Integration

The HTTP API is configurable via command-line flags:

./bin/manager \
  --enable-http-api \
  --http-api-bind-address=:8082 \
  --postgres-host=localhost \
  --postgres-port=5432 \
  --postgres-user=postgres \
  --postgres-password=password \
  --postgres-dbname=kalypso \
  --postgres-sslmode=disable

Documentation & Testing

  • Complete OpenAPI 3.0 specification with schemas and examples
  • Comprehensive README with usage examples and configuration guide
  • Unit tests covering HTTP endpoints with 13.6% coverage
  • Demo script showing practical usage

Example Usage

# Health check
curl http://localhost:8082/health

# Query deployment state
curl 'http://localhost:8082/api/v1/deployment-state?manifests_endpoint=https://github.com/example/gitops&commit_id=abc123'

# Get environment information
curl http://localhost:8082/api/v1/environments/production

Technical Implementation

  • Minimal code changes following surgical modification principles
  • Reuses existing storage interfaces and database query functions
  • Proper error handling with appropriate HTTP status codes
  • JSON response formatting with structured data models
  • Graceful integration with existing controller manager architecture

The implementation provides exactly what external systems need to query deployment observability data without requiring gRPC knowledge or direct database access, completing the API component architecture described in the project README.

Fixes #76.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits July 30, 2025 17:35
Co-authored-by: eedorenko <20337555+eedorenko@users.noreply.github.com>
Co-authored-by: eedorenko <20337555+eedorenko@users.noreply.github.com>
Copilot AI changed the title [WIP] Test Issue Implement HTTP API for deployment observability queries Jul 30, 2025
Copilot AI requested a review from eedorenko July 30, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test Issue

2 participants