feat: Add pool sharing for domains
Allow multiple domains to share the same backend pool using share_with parameter. This saves pool slots when domains point to the same servers. - Add share_with parameter to haproxy_add_domain - Add helper functions for shared domain management - Protect shared pools from being cleared on domain removal - Update documentation with pool sharing examples Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
27
CLAUDE.md
27
CLAUDE.md
@@ -102,6 +102,31 @@ This will:
|
||||
|
||||
**No HAProxy reload required!**
|
||||
|
||||
### Pool Sharing
|
||||
|
||||
Multiple domains can share the same pool/backend servers using `share_with`:
|
||||
|
||||
```bash
|
||||
# First domain gets its own pool
|
||||
haproxy_add_domain("example.com", "10.0.0.1")
|
||||
# Creates: example.com → pool_5
|
||||
|
||||
# Additional domains share the same pool
|
||||
haproxy_add_domain("www.example.com", share_with="example.com")
|
||||
haproxy_add_domain("api.example.com", share_with="example.com")
|
||||
# Both use: pool_5 (same backend servers)
|
||||
```
|
||||
|
||||
**Benefits:**
|
||||
- Saves pool slots (100 pools can serve unlimited domains)
|
||||
- Multiple domains → same backend servers
|
||||
- Shared domains stored as `_shares` reference in `servers.json`
|
||||
|
||||
**Behavior:**
|
||||
- Shared domains cannot specify `ip` (use existing servers)
|
||||
- Removing a shared domain keeps servers intact
|
||||
- Removing the last domain using a pool clears the servers
|
||||
|
||||
### Backend Configuration
|
||||
- Backends always use HTTP (port 80 or custom)
|
||||
- SSL/TLS termination happens at HAProxy frontend
|
||||
@@ -247,7 +272,7 @@ Returns backend server status for a specific domain:
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `haproxy_list_domains` | List domains (use `include_wildcards=true` for wildcards) |
|
||||
| `haproxy_add_domain` | Add domain to available pool (no reload), supports IPv6 |
|
||||
| `haproxy_add_domain` | Add domain to pool (no reload), supports `share_with` for pool sharing |
|
||||
| `haproxy_remove_domain` | Remove domain from pool (no reload) |
|
||||
|
||||
### Server Management
|
||||
|
||||
Reference in New Issue
Block a user