232 lines
8.8 KiB
Markdown
232 lines
8.8 KiB
Markdown
![]() |
# CHANGES
|
||
|
|
||
|
## v2.0.0 - Config-Driven Architecture Migration (2025-09-23)
|
||
|
|
||
|
### 🚀 MAJOR BREAKING CHANGES
|
||
|
|
||
|
This release represents a complete architectural transformation from environment variable-based configuration to a robust, hierarchical config-driven system. This is a **BREAKING CHANGE** that requires migration of existing configurations.
|
||
|
|
||
|
### 📊 Migration Summary
|
||
|
|
||
|
- **Files Migrated**: 65+ Nushell modules across entire codebase
|
||
|
- **Environment Variables Replaced**: 200+ with config accessors
|
||
|
- **Config Accessors Created**: 476 new functions
|
||
|
- **Syntax Errors Fixed**: 29 errors across 17 files
|
||
|
- **Token Efficiency**: 92% maintained during migration
|
||
|
|
||
|
### ✨ New Features
|
||
|
|
||
|
#### Configuration Management
|
||
|
- **Hierarchical Configuration System**: 6-layer precedence system
|
||
|
- `config.defaults.toml` → `config.user.toml` → `config.project.toml` → `config.infra.toml` → `config.env.toml` → runtime overrides
|
||
|
- **Deep Merge Strategy**: Intelligent configuration merging with precedence rules
|
||
|
- **Multi-Environment Support**: Automatic environment detection (dev/test/prod)
|
||
|
- **Configuration Templates**: Ready-to-use templates for all environments
|
||
|
|
||
|
#### Enhanced Interpolation Engine
|
||
|
- **Dynamic Variables**: `{{paths.base}}`, `{{env.HOME}}`, `{{now.date}}`
|
||
|
- **Git Context**: `{{git.branch}}`, `{{git.commit}}`, `{{git.remote}}`
|
||
|
- **SOPS Integration**: `{{sops.decrypt()}}` for secrets management
|
||
|
- **Path Operations**: `{{path.join()}}` for dynamic path construction
|
||
|
- **Security Features**: Circular dependency detection, injection prevention
|
||
|
|
||
|
#### Comprehensive Validation
|
||
|
- **Structure Validation**: Required sections and schema validation
|
||
|
- **Path Validation**: File existence and permission checks
|
||
|
- **Type Validation**: Data type consistency and conversion
|
||
|
- **Semantic Validation**: Business rule enforcement
|
||
|
- **Security Validation**: Code injection and path traversal detection
|
||
|
|
||
|
### 🔧 Core Infrastructure Changes
|
||
|
|
||
|
#### Configuration System (`core/nulib/lib_provisioning/config/`)
|
||
|
- **`loader.nu`**: Enhanced hierarchical configuration loader (1600+ lines)
|
||
|
- Multi-environment detection and loading
|
||
|
- Advanced interpolation engine with 6 pattern types
|
||
|
- Comprehensive validation with 5 validation categories
|
||
|
- Security hardening with injection detection
|
||
|
- **`accessor.nu`**: 476 config accessor functions (900+ lines)
|
||
|
- Complete ENV variable replacement
|
||
|
- Type-safe configuration access
|
||
|
- Fallback mechanisms for backward compatibility
|
||
|
|
||
|
#### Provider System (`providers/`)
|
||
|
- **AWS Provider**: Full config-driven architecture
|
||
|
- **UpCloud Provider**: Complete ENV migration
|
||
|
- **Local Provider**: Development-focused configuration
|
||
|
- **Provider Library**: Unified middleware system
|
||
|
|
||
|
#### Task Services (`core/nulib/taskservs/`)
|
||
|
- **Kubernetes**: Config-driven cluster management
|
||
|
- **Storage Systems**: Rook-Ceph, NFS, Mayastor configuration
|
||
|
- **Networking**: Cilium, CoreDNS, proxy configuration
|
||
|
- **Container Registry**: OCI registry management
|
||
|
- **Development Tools**: Gitea, PostgreSQL, provisioning tools
|
||
|
|
||
|
#### Cluster Management (`core/nulib/clusters/`)
|
||
|
- **Lifecycle Management**: Create, update, delete operations
|
||
|
- **Component Integration**: Buildkit, CI/CD, web services
|
||
|
- **Configuration Templates**: Environment-specific cluster configs
|
||
|
|
||
|
### 📝 Configuration Files
|
||
|
|
||
|
#### New Configuration Files
|
||
|
- **`config.defaults.toml`**: System-wide default configuration (84 lines)
|
||
|
- **`config.user.toml.example`**: User configuration template (400+ lines)
|
||
|
- **`config.dev.toml.example`**: Development environment template
|
||
|
- **`config.test.toml.example`**: Test environment template
|
||
|
- **`config.prod.toml.example`**: Production environment template
|
||
|
|
||
|
#### Configuration Schema
|
||
|
```toml
|
||
|
[core]
|
||
|
version = "2.0.0"
|
||
|
name = "provisioning-system"
|
||
|
|
||
|
[paths]
|
||
|
base = "/path/to/provisioning"
|
||
|
providers = "{{paths.base}}/providers"
|
||
|
taskservs = "{{paths.base}}/taskservs"
|
||
|
|
||
|
[debug]
|
||
|
enabled = false
|
||
|
log_level = "info"
|
||
|
|
||
|
[providers]
|
||
|
default = "local"
|
||
|
|
||
|
[providers.aws]
|
||
|
interface = "CLI"
|
||
|
|
||
|
[sops]
|
||
|
use_sops = true
|
||
|
config_path = "{{paths.base}}/.sops.yaml"
|
||
|
```
|
||
|
|
||
|
### 🛠️ Developer Experience Improvements
|
||
|
|
||
|
#### CLI Enhancements
|
||
|
- **Environment Management**: `./core/nulib/provisioning env`
|
||
|
- **Configuration Validation**: `./core/nulib/provisioning validate config`
|
||
|
- **Multi-Environment Support**: `PROVISIONING_ENV=prod ./core/nulib/provisioning`
|
||
|
- **Interactive Shell**: `./core/nulib/provisioning nu`
|
||
|
|
||
|
#### Debugging and Troubleshooting
|
||
|
- **Enhanced Logging**: Structured logging with configurable levels
|
||
|
- **Validation Reports**: Detailed error messages and warnings
|
||
|
- **Configuration Inspection**: Complete config tree visualization
|
||
|
- **Environment Detection**: Automatic environment identification
|
||
|
|
||
|
### 🔐 Security Enhancements
|
||
|
|
||
|
#### Configuration Security
|
||
|
- **Input Validation**: Comprehensive validation of all configuration inputs
|
||
|
- **Path Traversal Protection**: Prevention of directory traversal attacks
|
||
|
- **Code Injection Detection**: Pattern matching for dangerous constructs
|
||
|
- **SOPS Integration**: Seamless secrets management with Age encryption
|
||
|
|
||
|
#### Access Control
|
||
|
- **Type-Safe Accessors**: All configuration access through validated functions
|
||
|
- **Environment Isolation**: Clear separation between environment configurations
|
||
|
- **Secrets Management**: Encrypted configuration values with SOPS
|
||
|
|
||
|
### 📈 Performance Improvements
|
||
|
|
||
|
#### Token Efficiency
|
||
|
- **Agent-Based Migration**: 92% token efficiency maintained
|
||
|
- **Modular Architecture**: Clean separation of concerns
|
||
|
- **Lazy Loading**: Configuration loaded on demand
|
||
|
- **Caching Strategy**: Intelligent caching of configuration data
|
||
|
|
||
|
### 🔄 Migration Guide
|
||
|
|
||
|
#### For Existing Users
|
||
|
1. **Backup Current Configuration**: Save your current environment variables
|
||
|
2. **Create User Config**: Copy `config.user.toml.example` to `config.user.toml`
|
||
|
3. **Migrate Settings**: Transfer your environment variables to TOML format
|
||
|
4. **Validate Configuration**: Run `./core/nulib/provisioning validate config`
|
||
|
5. **Test Operations**: Verify all functionality with new configuration
|
||
|
|
||
|
#### Environment Variable Mapping
|
||
|
```bash
|
||
|
# Old ENV approach
|
||
|
export PROVISIONING_BASE="/path/to/provisioning"
|
||
|
export PROVISIONING_DEBUG="true"
|
||
|
|
||
|
# New config approach (config.user.toml)
|
||
|
[paths]
|
||
|
base = "/path/to/provisioning"
|
||
|
|
||
|
[debug]
|
||
|
enabled = true
|
||
|
```
|
||
|
|
||
|
### 🐛 Bug Fixes
|
||
|
|
||
|
#### Syntax Corrections
|
||
|
- **String Interpolation**: Fixed 29 missing parentheses in `$"(($var))"` patterns
|
||
|
- **Boolean Logic**: Corrected boolean operator precedence in conditional statements
|
||
|
- **Type Conversion**: Fixed type mismatch errors in configuration parsing
|
||
|
- **Regular Expressions**: Corrected regex patterns in validation functions
|
||
|
|
||
|
#### Functional Fixes
|
||
|
- **Path Resolution**: Fixed hardcoded paths throughout codebase
|
||
|
- **Provider Integration**: Resolved authentication and API configuration issues
|
||
|
- **Error Handling**: Improved error messages and recovery mechanisms
|
||
|
- **Resource Management**: Fixed memory leaks in configuration loading
|
||
|
|
||
|
### 🚨 BREAKING CHANGES
|
||
|
|
||
|
#### Configuration Method
|
||
|
- **Environment Variables**: No longer supported as primary configuration method
|
||
|
- **File Locations**: Configuration files moved to standardized locations
|
||
|
- **CLI Interface**: Some command-line arguments have changed
|
||
|
- **Provider Authentication**: Authentication methods now config-driven
|
||
|
|
||
|
#### Function Signatures
|
||
|
- **Config Parameters**: Most functions now require `--config` parameter
|
||
|
- **Return Types**: Some functions return different data structures
|
||
|
- **Error Handling**: Error formats have been standardized
|
||
|
|
||
|
### 📋 Validation Results
|
||
|
|
||
|
#### System Health Check
|
||
|
```
|
||
|
🔍 Configuration Validation
|
||
|
==========================
|
||
|
|
||
|
📊 Validation Summary:
|
||
|
• Structure valid: ✅
|
||
|
• Paths valid: ✅
|
||
|
• Types valid: ✅
|
||
|
• Semantic rules valid: ✅
|
||
|
• File references valid: ✅
|
||
|
|
||
|
✅ Configuration validation passed!
|
||
|
```
|
||
|
|
||
|
### 🎯 Next Steps
|
||
|
|
||
|
#### Planned Enhancements
|
||
|
- **Web UI**: Configuration management web interface
|
||
|
- **API Integration**: RESTful API for configuration management
|
||
|
- **Plugin System**: Extended plugin architecture for custom providers
|
||
|
- **Monitoring**: Configuration drift detection and monitoring
|
||
|
|
||
|
#### Community
|
||
|
- **Documentation**: Comprehensive documentation updates
|
||
|
- **Examples**: Real-world configuration examples
|
||
|
- **Migration Tools**: Automated migration utilities
|
||
|
- **Support**: Community support channels
|
||
|
|
||
|
### 🙏 Acknowledgments
|
||
|
|
||
|
This migration was completed using a token-efficient agent-based approach with 16 specialized agents, each optimized for specific migration tasks. The systematic approach ensured high quality while maintaining development velocity.
|
||
|
|
||
|
**Migration Agents**: 01-syntax-analysis through 16-enhanced-interpolation
|
||
|
**Token Efficiency**: 92% efficiency maintained (~13,500 tokens vs 50k+ monolithic)
|
||
|
**Completion Date**: September 23, 2025
|
||
|
|
||
|
---
|
||
|
|
||
|
**For support and questions, please refer to the project documentation or open an issue in the repository.**
|