Skip to content

Add Web Config File Support and Enhanced Helm Chart Features#909

Open
zofer1zohargo wants to merge 10 commits intoburningalchemist:masterfrom
zofer1zohargo:web-file-tls
Open

Add Web Config File Support and Enhanced Helm Chart Features#909
zofer1zohargo wants to merge 10 commits intoburningalchemist:masterfrom
zofer1zohargo:web-file-tls

Conversation

@zofer1zohargo
Copy link

Summary

This PR introduces comprehensive support for web configuration files (TLS and Basic Authentication) in the SQL Exporter Helm chart, along with dynamic configuration generation and extensive deployment examples. These enhancements make it easier to deploy SQL Exporter in production environments with proper security configurations.

Key Features

🔐 Web Config File Support

  • Added support for mounting and using web configuration files for TLS and Basic Authentication
  • Automatic HTTPS/HTTP scheme detection based on TLS configuration
  • Support for custom TLS certificates via Kubernetes secrets
  • Built-in bcrypt password hashing via init container for Basic Auth

⚙️ Dynamic Configuration Generation

  • New dynamicConfig option to generate sql_exporter.yml at runtime from secrets
  • Separates sensitive connection strings (DSN) from collector definitions
  • Supports application_name injection into database connection strings
  • Template-based configuration with variable substitution

📦 Init Container Integration

  • New init container script (helm/scripts/init.sh) for:
    • Dynamic config generation from secret-held DSNs
    • Bcrypt password hashing for Basic Auth
    • ECS-compliant structured logging
    • Flexible configuration mounting

🚀 Smart Service Configuration

  • Service port automatically defaults to 80 (HTTP) or 443 (HTTPS) based on TLS settings
  • Auto-generated health probes that adapt to TLS configuration
  • Customizable probe parameters without overriding the entire probe definition

📚 Comprehensive Examples

Added 7 detailed deployment examples with documentation:

  • auth-only: Basic Authentication without TLS
  • tls-only: TLS configuration without authentication
  • tls-auth-dynamic: Combined TLS + Auth + Dynamic Config (full production setup)
  • dynamic-config-only: Dynamic configuration from secrets
  • azure-sql-mi: Azure SQL Managed Instance deployment
  • mssql: Microsoft SQL Server deployment
  • postgres: PostgreSQL deployment

Each example includes complete README with step-by-step instructions, sample Kubernetes secret YAML files, example Helm values configurations, and testing commands.

Changes Overview

Modified Components

  • Enhanced deployment template with init container and flexible mounting
  • Added TLS detection and web config helpers
  • Smart port selection based on TLS configuration
  • Added 116+ lines of new configuration options in values.yaml

New Components

  • Init container script for dynamic config generation
  • ConfigMap for init script
  • 7 comprehensive deployment examples with full documentation

Use Cases

This PR enables several important deployment patterns:

  1. Secure Production Deployment: TLS + Basic Auth + Dynamic Config from secrets
  2. Multi-Database Support: Dynamic config allows different DSNs per environment
  3. Certificate Management: Easy integration with cert-manager or custom PKI
  4. Cloud-Native Secrets: Leverage Kubernetes secrets for sensitive data
  5. Zero-Config Collectors: Reusable collector definitions across deployments

Backward Compatibility

✅ All changes are backward compatible:

  • Existing deployments continue to work without modification
  • New features are opt-in via dynamicConfig.enabled and webConfig.enabled
  • Default behavior unchanged when new options are not specified

Testing

All examples have been tested and include:

  • Secret creation commands
  • Helm installation with values
  • Verification steps (curl commands, log checks)
  • Expected output samples

@burningalchemist
Copy link
Owner

burningalchemist commented Feb 25, 2026

Hey @zofer1zohargo, thank you for your contribution! 👏 Let me go through the change set and I will get back to you. 😃

UPD: Could you please bump up the chart in Chart.yaml to 0.15.0 and run make gen_docs (as per the docs here)?

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.

2 participants