Welcome to the DevOps challenge! This repository contains a simple Go web application that you need to containerize, test, and deploy using modern DevOps practices.
Your task is to implement a complete DevOps pipeline for this Go application. You'll be evaluated on your ability to:
- Containerize the application with Docker
- Implement CI/CD using GitHub Actions
- Deploy to Kubernetes
Create a production-ready Dockerfile
Create a comprehensive CI/CD pipeline.
Create the K8s resources
This is a simple Go web service with the following endpoints:
GET /- Homepage with application infoGET /health- Health check endpoint (returns 204 No Content)GET /info- Application informationGET /nytime- Current New York timeGET /fetch- Fetches data from an external API with API key authentication
Environment Variables:
PORT- Server port (default: 8080)ENVIRONMENT- Environment name (default: development)VERSION- Application version (default: 1.0.0)API_KEY- API key for external API authentication (default: dummy-secret-key-12345)
-
Clone and explore the repository
-
Run locally to understand the application:
go run main.go curl -v http://localhost:8080/health curl http://localhost:8080/nytime
-
Run tests to ensure everything works:
go test -v go test -v -cover
-
Test the fetch endpoint with API key:
# Set a custom API key export API_KEY="your-secret-api-key" # Test the fetch endpoint curl http://localhost:8080/fetch # Or test with the default API key curl http://localhost:8080/fetch
The application uses an API_KEY environment variable to authenticate with external APIs. The fetch endpoint (/fetch) automatically includes this API key in the X-API-Key header when making requests to external services.
- Default value:
dummy-secret-key-12345(for development/testing) - Production use: Set
API_KEYto your actual API key - Security: Never commit real API keys to version control