Skip to content

Commit 0f6de58

Browse files
committed
Refactor xdatabase-proxy configuration and deployment settings
- Updated environment variables in development and production deployment YAML files to enhance configurability. - Introduced new environment variables for TLS settings, including auto-generation and renewal options. - Modified health check endpoint from /healthz to /health for consistency. - Enhanced start-proxy-test and test-server scripts to align with new configuration standards. - Added comprehensive README documentation detailing features, installation, configuration, and usage scenarios. - Implemented a new configuration management system in config.go to handle environment variables and legacy support. - Created a factory pattern for proxy and resolver creation, allowing for better separation of concerns and easier future extensions. - Established TLS management with support for file-based, Kubernetes secret, and in-memory certificate handling. - Added validation for configuration settings to ensure coherence and correctness. - Introduced structured logging for better observability and debugging.
1 parent 381e42b commit 0f6de58

File tree

13 files changed

+1421
-489
lines changed

13 files changed

+1421
-489
lines changed

CHANGELOG.md

Lines changed: 73 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
- Multi-platform Docker build support for macOS, Linux (amd64, arm64, 386)
12-
- Automated TLS certificate creation in Kubernetes Secret when secret doesn't exist
13-
- Enhanced TLS configuration with three priority levels:
14-
- File-based TLS (TLS_CERT_FILE + TLS_KEY_FILE)
15-
- Kubernetes Secret TLS (TLS_SECRET_NAME)
16-
- Memory-based TLS with self-signed generation
17-
- Static backend support for non-Kubernetes deployments via STATIC_BACKENDS environment variable
18-
- Health check and readiness endpoints on port 8080 (/health, /ready)
19-
- Debug logging mode with DEBUG environment variable
20-
- Comprehensive environment variable documentation in README
21-
- Go module caching in GitHub Actions for faster builds
22-
- Matrix testing strategy for Ubuntu and macOS platforms in CI/CD
23-
24-
### Changed
25-
- Updated Dockerfile to explicitly set CGO_ENABLED=0 and GOOS=linux for cross-platform compatibility
26-
- Enhanced Dockerfile with ca-certificates, tzdata, health checks, and proper port exposure
27-
- Improved GitHub Actions workflow with separate test job for multiple platforms
28-
- Refactored TLS provider initialization logic for better multi-instance safety
29-
- Updated README.md with complete environment variable reference and usage examples
30-
- Improved logging for TLS provider selection and certificate operations
31-
32-
### Fixed
33-
- macOS build compatibility issues with Docker and GitHub Actions
34-
- Multi-instance race condition in TLS certificate generation
35-
- Kubernetes Secret auto-creation now properly handles concurrent pod startups
36-
37-
### Security
38-
- Self-signed certificates now only generated once at startup to prevent race conditions
39-
- Kubernetes Secret-based TLS provider automatically creates missing certificates securely
40-
41-
## [2.0.0] - 2026-01-12
42-
43-
### Added
11+
- **Runtime Environment Detection**: Auto-detect execution environment (Kubernetes/Container/VM)
12+
- **Flexible Discovery Modes**:
13+
- Kubernetes discovery from any runtime (in-cluster or remote with kubeconfig)
14+
- Static backend configuration for non-Kubernetes deployments
15+
- **Enterprise TLS Management**:
16+
- `TLS_AUTO_GENERATE`: Automatic self-signed certificate generation
17+
- `TLS_AUTO_RENEW`: Automatic certificate renewal for expired/invalid certs
18+
- `TLS_RENEWAL_THRESHOLD_DAYS`: Configurable renewal threshold
19+
- Certificate expiration validation
20+
- **Optional TLS**: `TLS_ENABLED` flag to make TLS completely optional
21+
- **Professional Configuration System**:
22+
- Runtime-aware configuration (kubernetes/container/vm)
23+
- Type-safe configuration with validation
24+
- Smart auto-detection for all modes (runtime, discovery, TLS)
25+
- **Enhanced Environment Variables**:
26+
- `DATABASE_TYPE`: Database type (postgresql)
27+
- `RUNTIME`: Explicit runtime environment setting
28+
- `DISCOVERY_MODE`: Explicit discovery mode
29+
- `TLS_MODE`: Explicit TLS provider mode
30+
- `TLS_ENABLED`: Enable/disable TLS
31+
- `NAMESPACE`: Professional naming (replaces POD_NAMESPACE)
32+
- **Multi-Runtime Kubernetes Access**:
33+
- Access Kubernetes from VM/Container using KUBECONFIG
34+
- Support for multiple Kubernetes contexts
35+
- Remote cluster discovery from non-Kubernetes environments
36+
- **Configuration Validation**: Comprehensive validation with helpful error messages
37+
- **Backward Compatibility**: Full support for legacy environment variables
4438
- New proxy manager component for advanced proxy infrastructure management
4539
- Comprehensive structured logger with improved console output formatting
4640
- Self-signed certificate generation capability for TLS
@@ -54,6 +48,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5448
- Filesystem-based TLS storage provider
5549

5650
### Changed
51+
- **Removed `PROXY_ENABLED`**: Proxy always runs when started (fail-fast on misconfiguration)
52+
- **Professional Configuration Architecture**:
53+
- Type-safe enums for modes (RuntimeEnvironment, DiscoveryMode, TLSMode)
54+
- Validation-first approach with clear error messages
55+
- Smart defaults for all settings
56+
- **Improved Factory Pattern**:
57+
- Runtime-aware resolver factory
58+
- TLS factory with certificate lifecycle management
59+
- Better error handling and logging
60+
- **Enhanced README**:
61+
- Complete rewrite with enterprise focus
62+
- Clear runtime scenarios and examples
63+
- Professional documentation structure
64+
- Architecture diagram
65+
- **Better Logging**:
66+
- Runtime information in startup logs
67+
- TLS mode and certificate status
68+
- Discovery mode details
5769
- Merged main branch into development branch for latest stable features
5870
- Updated Docker CMD path to reflect new folder structure (`cmd/proxy`)
5971
- Refactored connection handler to improve error handling and lifecycle management for production environments
@@ -65,26 +77,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6577
- Restructured folder hierarchy for better organization
6678
- Updated GitHub usernames and repository references across all configuration files
6779
- Modified platform support in deployment workflow (amd64, arm64, 386)
80+
- **TLS Now Optional**: Proxy can run without TLS if `TLS_ENABLED=false`
81+
- Updated all Kubernetes deployment YAMLs to use new environment variable scheme
82+
- Updated test and development scripts to use new configuration format
6883

69-
### Deprecated
84+
### Fixed
85+
- Multi-instance TLS certificate creation race conditions
86+
- Kubernetes discovery from non-Kubernetes runtimes
87+
- Certificate lifecycle management issues
88+
- Configuration validation edge cases
89+
- Connection lifecycle issues in production environments
90+
- Error response handling in connection handler
91+
- Binary file cleanup (removed `proxy` binary from tracking)
92+
- Certificate file management in repository
7093

7194
### Removed
95+
- `PROXY_ENABLED` environment variable (proxy always runs)
96+
- `POD_NAMESPACE` in favor of generic `NAMESPACE`
97+
- `POSTGRESQL_PROXY_ENABLED` in favor of `DATABASE_TYPE`
98+
- `TLS_ENABLE_SELF_SIGNED` in favor of `TLS_AUTO_GENERATE`
99+
- Unnecessary configuration complexity
72100
- Deleted old HTTP health check implementation (`cmd/proxy/internal/http/health.go`)
73101
- Removed legacy Kubernetes client implementation
74102
- Cleaned up old proxy server implementations and tests
75103
- Removed temporary binary and certificate files from repository root
76104

77-
### Fixed
78-
- Connection lifecycle issues in production environments
79-
- Error response handling in connection handler
80-
- Binary file cleanup (removed `proxy` binary from tracking)
81-
- Certificate file management in repository
82-
83105
### Security
106+
- Enhanced certificate validation
107+
- Automatic certificate renewal prevents expired certs
108+
- Multi-instance safe certificate generation
109+
- Better TLS configuration validation
84110
- Enhanced TLS configuration with improved certificate management
85111
- Added self-signed certificate generation for development environments
86112
- Improved certificate storage security with filesystem provider
87113

114+
### Architecture
115+
- **Configuration-Driven Design**: All behavior controlled by environment variables
116+
- **Runtime Awareness**: Detects and adapts to execution environment
117+
- **Fail-Fast Philosophy**: Clear errors on misconfiguration
118+
- **Production-Grade**: Enterprise-ready with proper validation and error handling
119+
- **Optional TLS**: Full support for non-TLS deployments
120+
88121
## [1.0.8] - 2025-07-07
89122

90123
### Fixed

0 commit comments

Comments
 (0)