refactor: canonicalize gordon.proxy.port, deprecate gordon.port
gordon.proxy.port is more explicit about its purpose. Flip precedence so gordon.proxy.port is checked first everywhere, keep gordon.port as a deprecated alias for backward compatibility, and update all docs and tests to use gordon.proxy.port exclusively.
- commit
- 5dc1b42b651dc8a3933fb3efd7936beba8c61606
- author
- brice · · 2026-03-15 08:20 UTC
- parent
- c672160
- signature
- unsigned
11 files · +61 -59
M docs/config/auto-route.md +5 -5
| @@ -175,7 +175,7 @@ The preferred method for automatic routing uses Dockerfile labels. This gives yo | |||
| 175 | 175 | | Label | Description | Example | | |
| 176 | 176 | |-------|-------------|---------| | |
| 177 | 177 | | `gordon.domains` | Comma-separated list of domains | `app.example.com,www.app.example.com` | | |
| 178 | - | | `gordon.port` | Container port to proxy | `3000` | | |
| 178 | + | | `gordon.proxy.port` | Container port to proxy | `3000` | | |
| 179 | 179 | | `gordon.health` | Health check endpoint path | `/health` | | |
| 180 | 180 | | `gordon.env-file` | Path to .env file in image | `/app/.env.example` | | |
| 181 | 181 | ||
| @@ -189,7 +189,7 @@ RUN npm install | |||
| 189 | 189 | ||
| 190 | 190 | # Gordon routing labels | |
| 191 | 191 | LABEL gordon.domains="myapp.example.com,www.myapp.example.com" | |
| 192 | - | LABEL gordon.port="3000" | |
| 192 | + | LABEL gordon.proxy.port="3000" | |
| 193 | 193 | LABEL gordon.health="/api/health" | |
| 194 | 194 | LABEL gordon.env-file="/app/.env.example" | |
| 195 | 195 | ||
| @@ -203,7 +203,7 @@ When you push an image with Gordon labels: | |||
| 203 | 203 | ||
| 204 | 204 | 1. Gordon reads the `gordon.domains` label | |
| 205 | 205 | 2. Creates routes for each domain automatically | |
| 206 | - | 3. Uses `gordon.port` for the proxy target (or first EXPOSE port) | |
| 206 | + | 3. Uses `gordon.proxy.port` for the proxy target (or first EXPOSE port) | |
| 207 | 207 | 4. Configures health checks if `gordon.health` is set | |
| 208 | 208 | 5. Extracts environment variables from `gordon.env-file` if specified | |
| 209 | 209 | ||
| @@ -241,7 +241,7 @@ Gordon will: | |||
| 241 | 241 | ||
| 242 | 242 | ### Best Practices | |
| 243 | 243 | ||
| 244 | - | 1. **Always set `gordon.port`** - Don't rely on EXPOSE detection | |
| 244 | + | 1. **Always set `gordon.proxy.port`** - Don't rely on EXPOSE detection | |
| 245 | 245 | 2. **Use `gordon.health`** - Enables reliable deployment verification | |
| 246 | 246 | 3. **Include `.env.example`** - Self-documenting environment requirements | |
| 247 | 247 | 4. **Separate domains with commas** - No spaces around commas | |
| @@ -261,7 +261,7 @@ COPY .env.example . | |||
| 261 | 261 | ||
| 262 | 262 | # Gordon labels | |
| 263 | 263 | LABEL gordon.domains="api.mycompany.com" | |
| 264 | - | LABEL gordon.port="8080" | |
| 264 | + | LABEL gordon.proxy.port="8080" | |
| 265 | 265 | LABEL gordon.health="/health" | |
| 266 | 266 | LABEL gordon.env-file="/app/.env.example" | |
| 267 | 267 | ||
| @@ -175,7 +175,7 @@ The preferred method for automatic routing uses Dockerfile labels. This gives yo | |||||
| 175 | | Label | Description | Example | | 175 | | Label | Description | Example | | ||
| 176 | |-------|-------------|---------| | 176 | |-------|-------------|---------| | ||
| 177 | | `gordon.domains` | Comma-separated list of domains | `app.example.com,www.app.example.com` | | 177 | | `gordon.domains` | Comma-separated list of domains | `app.example.com,www.app.example.com` | | ||
| 178 | - | | `gordon.port` | Container port to proxy | `3000` | | 178 | + | | `gordon.proxy.port` | Container port to proxy | `3000` | |
| 179 | | `gordon.health` | Health check endpoint path | `/health` | | 179 | | `gordon.health` | Health check endpoint path | `/health` | | ||
| 180 | | `gordon.env-file` | Path to .env file in image | `/app/.env.example` | | 180 | | `gordon.env-file` | Path to .env file in image | `/app/.env.example` | | ||
| 181 | 181 | ||||
| @@ -189,7 +189,7 @@ RUN npm install | |||||
| 189 | 189 | ||||
| 190 | # Gordon routing labels | 190 | # Gordon routing labels | ||
| 191 | LABEL gordon.domains="myapp.example.com,www.myapp.example.com" | 191 | LABEL gordon.domains="myapp.example.com,www.myapp.example.com" | ||
| 192 | - | LABEL gordon.port="3000" | 192 | + | LABEL gordon.proxy.port="3000" |
| 193 | LABEL gordon.health="/api/health" | 193 | LABEL gordon.health="/api/health" | ||
| 194 | LABEL gordon.env-file="/app/.env.example" | 194 | LABEL gordon.env-file="/app/.env.example" | ||
| 195 | 195 | ||||
| @@ -203,7 +203,7 @@ When you push an image with Gordon labels: | |||||
| 203 | 203 | ||||
| 204 | 1. Gordon reads the `gordon.domains` label | 204 | 1. Gordon reads the `gordon.domains` label | ||
| 205 | 2. Creates routes for each domain automatically | 205 | 2. Creates routes for each domain automatically | ||
| 206 | - | 3. Uses `gordon.port` for the proxy target (or first EXPOSE port) | 206 | + | 3. Uses `gordon.proxy.port` for the proxy target (or first EXPOSE port) |
| 207 | 4. Configures health checks if `gordon.health` is set | 207 | 4. Configures health checks if `gordon.health` is set | ||
| 208 | 5. Extracts environment variables from `gordon.env-file` if specified | 208 | 5. Extracts environment variables from `gordon.env-file` if specified | ||
| 209 | 209 | ||||
| @@ -241,7 +241,7 @@ Gordon will: | |||||
| 241 | 241 | ||||
| 242 | ### Best Practices | 242 | ### Best Practices | ||
| 243 | 243 | ||||
| 244 | - | 1. **Always set `gordon.port`** - Don't rely on EXPOSE detection | 244 | + | 1. **Always set `gordon.proxy.port`** - Don't rely on EXPOSE detection |
| 245 | 2. **Use `gordon.health`** - Enables reliable deployment verification | 245 | 2. **Use `gordon.health`** - Enables reliable deployment verification | ||
| 246 | 3. **Include `.env.example`** - Self-documenting environment requirements | 246 | 3. **Include `.env.example`** - Self-documenting environment requirements | ||
| 247 | 4. **Separate domains with commas** - No spaces around commas | 247 | 4. **Separate domains with commas** - No spaces around commas | ||
| @@ -261,7 +261,7 @@ COPY .env.example . | |||||
| 261 | 261 | ||||
| 262 | # Gordon labels | 262 | # Gordon labels | ||
| 263 | LABEL gordon.domains="api.mycompany.com" | 263 | LABEL gordon.domains="api.mycompany.com" | ||
| 264 | - | LABEL gordon.port="8080" | 264 | + | LABEL gordon.proxy.port="8080" |
| 265 | LABEL gordon.health="/health" | 265 | LABEL gordon.health="/health" | ||
| 266 | LABEL gordon.env-file="/app/.env.example" | 266 | LABEL gordon.env-file="/app/.env.example" | ||
| 267 | 267 | ||||
M docs/reference/docker-labels.md +1 -2
| @@ -42,8 +42,7 @@ Labels you can set in your Dockerfile: | |||
| 42 | 42 | | Label | Example | Description | | |
| 43 | 43 | |-------|---------|-------------| | |
| 44 | 44 | | `gordon.domains` | `"app.example.com,www.app.example.com"` | Comma-separated domains for auto-route | | |
| 45 | - | | `gordon.port` | `"3000"` | Port to proxy HTTP traffic to | | |
| 46 | - | | `gordon.proxy.port` | `"3000"` | Port to proxy HTTP traffic to (legacy alias for `gordon.port`) | | |
| 45 | + | | `gordon.proxy.port` | `"3000"` | Port to proxy HTTP traffic to | | |
| 47 | 46 | | `gordon.health` | `"/healthz"` | HTTP health check endpoint path for readiness probing | | |
| 48 | 47 | | `gordon.env-file` | `"/app/.env.example"` | Path to env template file inside the image | | |
| 49 | 48 | ||
| @@ -42,8 +42,7 @@ Labels you can set in your Dockerfile: | |||||
| 42 | | Label | Example | Description | | 42 | | Label | Example | Description | | ||
| 43 | |-------|---------|-------------| | 43 | |-------|---------|-------------| | ||
| 44 | | `gordon.domains` | `"app.example.com,www.app.example.com"` | Comma-separated domains for auto-route | | 44 | | `gordon.domains` | `"app.example.com,www.app.example.com"` | Comma-separated domains for auto-route | | ||
| 45 | - | | `gordon.port` | `"3000"` | Port to proxy HTTP traffic to | | 45 | + | | `gordon.proxy.port` | `"3000"` | Port to proxy HTTP traffic to | |
| 46 | - | | `gordon.proxy.port` | `"3000"` | Port to proxy HTTP traffic to (legacy alias for `gordon.port`) | | |||
| 47 | | `gordon.health` | `"/healthz"` | HTTP health check endpoint path for readiness probing | | 46 | | `gordon.health` | `"/healthz"` | HTTP health check endpoint path for readiness probing | | ||
| 48 | | `gordon.env-file` | `"/app/.env.example"` | Path to env template file inside the image | | 47 | | `gordon.env-file` | `"/app/.env.example"` | Path to env template file inside the image | | ||
| 49 | 48 | ||||
M internal/adapters/in/cli/push_test.go +11 -11
| @@ -357,20 +357,20 @@ func TestParseDockerfileLabels(t *testing.T) { | |||
| 357 | 357 | { | |
| 358 | 358 | name: "multiple labels", | |
| 359 | 359 | content: `LABEL gordon.domain="myapp.example.com" | |
| 360 | - | LABEL gordon.port="8080" | |
| 360 | + | LABEL gordon.proxy.port="8080" | |
| 361 | 361 | LABEL gordon.health="/health"`, | |
| 362 | 362 | expected: map[string]string{ | |
| 363 | - | "gordon.domain": "myapp.example.com", | |
| 364 | - | "gordon.port": "8080", | |
| 365 | - | "gordon.health": "/health", | |
| 363 | + | "gordon.domain": "myapp.example.com", | |
| 364 | + | "gordon.proxy.port": "8080", | |
| 365 | + | "gordon.health": "/health", | |
| 366 | 366 | }, | |
| 367 | 367 | }, | |
| 368 | 368 | { | |
| 369 | 369 | name: "multi-label on one line", | |
| 370 | - | content: `LABEL gordon.domain="myapp.example.com" gordon.port="8080"`, | |
| 370 | + | content: `LABEL gordon.domain="myapp.example.com" gordon.proxy.port="8080"`, | |
| 371 | 371 | expected: map[string]string{ | |
| 372 | - | "gordon.domain": "myapp.example.com", | |
| 373 | - | "gordon.port": "8080", | |
| 372 | + | "gordon.domain": "myapp.example.com", | |
| 373 | + | "gordon.proxy.port": "8080", | |
| 374 | 374 | }, | |
| 375 | 375 | }, | |
| 376 | 376 | { | |
| @@ -471,13 +471,13 @@ func TestSplitLabelPairs(t *testing.T) { | |||
| 471 | 471 | }, | |
| 472 | 472 | { | |
| 473 | 473 | name: "two pairs", | |
| 474 | - | content: `gordon.domain="test.com" gordon.port="8080"`, | |
| 475 | - | expected: []string{`gordon.domain="test.com"`, `gordon.port="8080"`}, | |
| 474 | + | content: `gordon.domain="test.com" gordon.proxy.port="8080"`, | |
| 475 | + | expected: []string{`gordon.domain="test.com"`, `gordon.proxy.port="8080"`}, | |
| 476 | 476 | }, | |
| 477 | 477 | { | |
| 478 | 478 | name: "unquoted", | |
| 479 | - | content: `gordon.domain=test.com gordon.port=8080`, | |
| 480 | - | expected: []string{`gordon.domain=test.com`, `gordon.port=8080`}, | |
| 479 | + | content: `gordon.domain=test.com gordon.proxy.port=8080`, | |
| 480 | + | expected: []string{`gordon.domain=test.com`, `gordon.proxy.port=8080`}, | |
| 481 | 481 | }, | |
| 482 | 482 | { | |
| 483 | 483 | name: "quoted with spaces in value", | |
| @@ -357,20 +357,20 @@ func TestParseDockerfileLabels(t *testing.T) { | |||||
| 357 | { | 357 | { | ||
| 358 | name: "multiple labels", | 358 | name: "multiple labels", | ||
| 359 | content: `LABEL gordon.domain="myapp.example.com" | 359 | content: `LABEL gordon.domain="myapp.example.com" | ||
| 360 | - | LABEL gordon.port="8080" | 360 | + | LABEL gordon.proxy.port="8080" |
| 361 | LABEL gordon.health="/health"`, | 361 | LABEL gordon.health="/health"`, | ||
| 362 | expected: map[string]string{ | 362 | expected: map[string]string{ | ||
| 363 | - | "gordon.domain": "myapp.example.com", | 363 | + | "gordon.domain": "myapp.example.com", |
| 364 | - | "gordon.port": "8080", | 364 | + | "gordon.proxy.port": "8080", |
| 365 | - | "gordon.health": "/health", | 365 | + | "gordon.health": "/health", |
| 366 | }, | 366 | }, | ||
| 367 | }, | 367 | }, | ||
| 368 | { | 368 | { | ||
| 369 | name: "multi-label on one line", | 369 | name: "multi-label on one line", | ||
| 370 | - | content: `LABEL gordon.domain="myapp.example.com" gordon.port="8080"`, | 370 | + | content: `LABEL gordon.domain="myapp.example.com" gordon.proxy.port="8080"`, |
| 371 | expected: map[string]string{ | 371 | expected: map[string]string{ | ||
| 372 | - | "gordon.domain": "myapp.example.com", | 372 | + | "gordon.domain": "myapp.example.com", |
| 373 | - | "gordon.port": "8080", | 373 | + | "gordon.proxy.port": "8080", |
| 374 | }, | 374 | }, | ||
| 375 | }, | 375 | }, | ||
| 376 | { | 376 | { | ||
| @@ -471,13 +471,13 @@ func TestSplitLabelPairs(t *testing.T) { | |||||
| 471 | }, | 471 | }, | ||
| 472 | { | 472 | { | ||
| 473 | name: "two pairs", | 473 | name: "two pairs", | ||
| 474 | - | content: `gordon.domain="test.com" gordon.port="8080"`, | 474 | + | content: `gordon.domain="test.com" gordon.proxy.port="8080"`, |
| 475 | - | expected: []string{`gordon.domain="test.com"`, `gordon.port="8080"`}, | 475 | + | expected: []string{`gordon.domain="test.com"`, `gordon.proxy.port="8080"`}, |
| 476 | }, | 476 | }, | ||
| 477 | { | 477 | { | ||
| 478 | name: "unquoted", | 478 | name: "unquoted", | ||
| 479 | - | content: `gordon.domain=test.com gordon.port=8080`, | 479 | + | content: `gordon.domain=test.com gordon.proxy.port=8080`, |
| 480 | - | expected: []string{`gordon.domain=test.com`, `gordon.port=8080`}, | 480 | + | expected: []string{`gordon.domain=test.com`, `gordon.proxy.port=8080`}, |
| 481 | }, | 481 | }, | ||
| 482 | { | 482 | { | ||
| 483 | name: "quoted with spaces in value", | 483 | name: "quoted with spaces in value", | ||
M internal/domain/labels.go +3 -3
| @@ -15,8 +15,7 @@ const ( | |||
| 15 | 15 | // exposing secret values. | |
| 16 | 16 | LabelEnvHash = "gordon.env-hash" | |
| 17 | 17 | ||
| 18 | - | // LabelProxyPort is a deprecated alias for LabelPort. | |
| 19 | - | // Kept for backward compatibility; prefer LabelPort for new images. | |
| 18 | + | // LabelProxyPort specifies the container port to proxy HTTP traffic to. | |
| 20 | 19 | LabelProxyPort = "gordon.proxy.port" | |
| 21 | 20 | ||
| 22 | 21 | // Auto-route image labels (for automatic route discovery) | |
| @@ -24,7 +23,8 @@ const ( | |||
| 24 | 23 | LabelDomains = "gordon.domains" | |
| 25 | 24 | // LabelHealth specifies the health check endpoint path. | |
| 26 | 25 | LabelHealth = "gordon.health" | |
| 27 | - | // LabelPort specifies the container port to proxy. | |
| 26 | + | // LabelPort is a deprecated alias for LabelProxyPort. | |
| 27 | + | // Kept for backward compatibility; prefer LabelProxyPort for new images. | |
| 28 | 28 | LabelPort = "gordon.port" | |
| 29 | 29 | // LabelEnvFile specifies the path to .env file inside the image. | |
| 30 | 30 | LabelEnvFile = "gordon.env-file" | |
| @@ -15,8 +15,7 @@ const ( | |||||
| 15 | // exposing secret values. | 15 | // exposing secret values. | ||
| 16 | LabelEnvHash = "gordon.env-hash" | 16 | LabelEnvHash = "gordon.env-hash" | ||
| 17 | 17 | ||||
| 18 | - | // LabelProxyPort is a deprecated alias for LabelPort. | 18 | + | // LabelProxyPort specifies the container port to proxy HTTP traffic to. |
| 19 | - | // Kept for backward compatibility; prefer LabelPort for new images. | |||
| 20 | LabelProxyPort = "gordon.proxy.port" | 19 | LabelProxyPort = "gordon.proxy.port" | ||
| 21 | 20 | ||||
| 22 | // Auto-route image labels (for automatic route discovery) | 21 | // Auto-route image labels (for automatic route discovery) | ||
| @@ -24,7 +23,8 @@ const ( | |||||
| 24 | LabelDomains = "gordon.domains" | 23 | LabelDomains = "gordon.domains" | ||
| 25 | // LabelHealth specifies the health check endpoint path. | 24 | // LabelHealth specifies the health check endpoint path. | ||
| 26 | LabelHealth = "gordon.health" | 25 | LabelHealth = "gordon.health" | ||
| 27 | - | // LabelPort specifies the container port to proxy. | 26 | + | // LabelPort is a deprecated alias for LabelProxyPort. |
| 27 | + | // Kept for backward compatibility; prefer LabelProxyPort for new images. | |||
| 28 | LabelPort = "gordon.port" | 28 | LabelPort = "gordon.port" | ||
| 29 | // LabelEnvFile specifies the path to .env file inside the image. | 29 | // LabelEnvFile specifies the path to .env file inside the image. | ||
| 30 | LabelEnvFile = "gordon.env-file" | 30 | LabelEnvFile = "gordon.env-file" | ||
M internal/usecase/container/autoroute.go +5 -2
| @@ -414,8 +414,11 @@ func parseImageLabels(configData []byte) (*domain.ImageLabels, error) { | |||
| 414 | 414 | labels.Health = strings.TrimSpace(v) | |
| 415 | 415 | } | |
| 416 | 416 | ||
| 417 | - | if v, ok := config.Config.Labels[domain.LabelPort]; ok { | |
| 418 | - | labels.Port = strings.TrimSpace(v) | |
| 417 | + | for _, key := range []string{domain.LabelProxyPort, domain.LabelPort} { | |
| 418 | + | if v, ok := config.Config.Labels[key]; ok { | |
| 419 | + | labels.Port = strings.TrimSpace(v) | |
| 420 | + | break | |
| 421 | + | } | |
| 419 | 422 | } | |
| 420 | 423 | ||
| 421 | 424 | if v, ok := config.Config.Labels[domain.LabelEnvFile]; ok { | |
| @@ -414,8 +414,11 @@ func parseImageLabels(configData []byte) (*domain.ImageLabels, error) { | |||||
| 414 | labels.Health = strings.TrimSpace(v) | 414 | labels.Health = strings.TrimSpace(v) | ||
| 415 | } | 415 | } | ||
| 416 | 416 | ||||
| 417 | - | if v, ok := config.Config.Labels[domain.LabelPort]; ok { | 417 | + | for _, key := range []string{domain.LabelProxyPort, domain.LabelPort} { |
| 418 | - | labels.Port = strings.TrimSpace(v) | 418 | + | if v, ok := config.Config.Labels[key]; ok { |
| 419 | + | labels.Port = strings.TrimSpace(v) | |||
| 420 | + | break | |||
| 421 | + | } | |||
| 419 | } | 422 | } | ||
| 420 | 423 | ||||
| 421 | if v, ok := config.Config.Labels[domain.LabelEnvFile]; ok { | 424 | if v, ok := config.Config.Labels[domain.LabelEnvFile]; ok { | ||
M internal/usecase/container/autoroute_test.go +4 -4
| @@ -263,10 +263,10 @@ func TestParseImageLabels(t *testing.T) { | |||
| 263 | 263 | config: map[string]any{ | |
| 264 | 264 | "config": map[string]any{ | |
| 265 | 265 | "Labels": map[string]any{ | |
| 266 | - | "gordon.domain": "app.example.com", | |
| 267 | - | "gordon.health": "/healthz", | |
| 268 | - | "gordon.port": "8080", | |
| 269 | - | "gordon.env-file": ".env.prod", | |
| 266 | + | "gordon.domain": "app.example.com", | |
| 267 | + | "gordon.health": "/healthz", | |
| 268 | + | "gordon.proxy.port": "8080", | |
| 269 | + | "gordon.env-file": ".env.prod", | |
| 270 | 270 | }, | |
| 271 | 271 | }, | |
| 272 | 272 | }, | |
| @@ -263,10 +263,10 @@ func TestParseImageLabels(t *testing.T) { | |||||
| 263 | config: map[string]any{ | 263 | config: map[string]any{ | ||
| 264 | "config": map[string]any{ | 264 | "config": map[string]any{ | ||
| 265 | "Labels": map[string]any{ | 265 | "Labels": map[string]any{ | ||
| 266 | - | "gordon.domain": "app.example.com", | 266 | + | "gordon.domain": "app.example.com", |
| 267 | - | "gordon.health": "/healthz", | 267 | + | "gordon.health": "/healthz", |
| 268 | - | "gordon.port": "8080", | 268 | + | "gordon.proxy.port": "8080", |
| 269 | - | "gordon.env-file": ".env.prod", | 269 | + | "gordon.env-file": ".env.prod", |
| 270 | }, | 270 | }, | ||
| 271 | }, | 271 | }, | ||
| 272 | }, | 272 | }, | ||
M internal/usecase/container/service.go +1 -1
| @@ -2555,7 +2555,7 @@ func (s *Service) resolveProbeEndpoint(ctx context.Context, containerID string, | |||
| 2555 | 2555 | internalPort := 0 | |
| 2556 | 2556 | if containerConfig != nil { | |
| 2557 | 2557 | if labels := containerConfig.Labels; labels != nil { | |
| 2558 | - | for _, key := range []string{domain.LabelPort, domain.LabelProxyPort} { | |
| 2558 | + | for _, key := range []string{domain.LabelProxyPort, domain.LabelPort} { | |
| 2559 | 2559 | if portStr, ok := labels[key]; ok && portStr != "" { | |
| 2560 | 2560 | port, err := strconv.Atoi(portStr) | |
| 2561 | 2561 | if err == nil && port > 0 && port <= 65535 { | |
| @@ -2555,7 +2555,7 @@ func (s *Service) resolveProbeEndpoint(ctx context.Context, containerID string, | |||||
| 2555 | internalPort := 0 | 2555 | internalPort := 0 | ||
| 2556 | if containerConfig != nil { | 2556 | if containerConfig != nil { | ||
| 2557 | if labels := containerConfig.Labels; labels != nil { | 2557 | if labels := containerConfig.Labels; labels != nil { | ||
| 2558 | - | for _, key := range []string{domain.LabelPort, domain.LabelProxyPort} { | 2558 | + | for _, key := range []string{domain.LabelProxyPort, domain.LabelPort} { |
| 2559 | if portStr, ok := labels[key]; ok && portStr != "" { | 2559 | if portStr, ok := labels[key]; ok && portStr != "" { | ||
| 2560 | port, err := strconv.Atoi(portStr) | 2560 | port, err := strconv.Atoi(portStr) | ||
| 2561 | if err == nil && port > 0 && port <= 65535 { | 2561 | if err == nil && port > 0 && port <= 65535 { | ||
M internal/usecase/container/service_readiness_test.go +11 -11
| @@ -217,7 +217,7 @@ func TestService_WaitForHealthy_EmptyStatusIsReportedAsStarting(t *testing.T) { | |||
| 217 | 217 | assert.True(t, strings.Contains(err.Error(), "last status: starting")) | |
| 218 | 218 | } | |
| 219 | 219 | ||
| 220 | - | func TestService_WaitForReady_ProbeUsesGordonPortLabel(t *testing.T) { | |
| 220 | + | func TestService_WaitForReady_ProbeUsesGordonProxyPortLabel(t *testing.T) { | |
| 221 | 221 | runtime := mocks.NewMockContainerRuntime(t) | |
| 222 | 222 | svc := NewService(runtime, nil, nil, nil, Config{ | |
| 223 | 223 | ReadinessMode: "auto", | |
| @@ -231,11 +231,11 @@ func TestService_WaitForReady_ProbeUsesGordonPortLabel(t *testing.T) { | |||
| 231 | 231 | probeIP, probePort := reserveEphemeralAddr(t) | |
| 232 | 232 | _ = probeIP | |
| 233 | 233 | ||
| 234 | - | // Container config has gordon.port label — should be used for probe endpoint | |
| 234 | + | // Container config has gordon.proxy.port label — should be used for probe endpoint | |
| 235 | 235 | containerConfig := &domain.ContainerConfig{ | |
| 236 | 236 | Ports: []int{22, 3000}, | |
| 237 | 237 | Labels: map[string]string{ | |
| 238 | - | domain.LabelPort: "3000", | |
| 238 | + | domain.LabelProxyPort: "3000", | |
| 239 | 239 | }, | |
| 240 | 240 | } | |
| 241 | 241 | ||
| @@ -250,7 +250,7 @@ func TestService_WaitForReady_ProbeUsesGordonPortLabel(t *testing.T) { | |||
| 250 | 250 | assert.Contains(t, err.Error(), "HTTP alive probe timeout") | |
| 251 | 251 | } | |
| 252 | 252 | ||
| 253 | - | func TestService_WaitForReady_ProbeUsesDeprecatedProxyPortLabel(t *testing.T) { | |
| 253 | + | func TestService_WaitForReady_ProbeUsesDeprecatedPortLabel(t *testing.T) { | |
| 254 | 254 | runtime := mocks.NewMockContainerRuntime(t) | |
| 255 | 255 | svc := NewService(runtime, nil, nil, nil, Config{ | |
| 256 | 256 | ReadinessMode: "auto", | |
| @@ -264,11 +264,11 @@ func TestService_WaitForReady_ProbeUsesDeprecatedProxyPortLabel(t *testing.T) { | |||
| 264 | 264 | probeIP, probePort := reserveEphemeralAddr(t) | |
| 265 | 265 | _ = probeIP // probeIP not used directly but port is | |
| 266 | 266 | ||
| 267 | - | // Container config has deprecated gordon.proxy.port — should still work | |
| 267 | + | // Container config has deprecated gordon.port — should still work | |
| 268 | 268 | containerConfig := &domain.ContainerConfig{ | |
| 269 | 269 | Ports: []int{22, 3000}, | |
| 270 | 270 | Labels: map[string]string{ | |
| 271 | - | domain.LabelProxyPort: "3000", | |
| 271 | + | domain.LabelPort: "3000", | |
| 272 | 272 | }, | |
| 273 | 273 | } | |
| 274 | 274 | ||
| @@ -281,7 +281,7 @@ func TestService_WaitForReady_ProbeUsesDeprecatedProxyPortLabel(t *testing.T) { | |||
| 281 | 281 | assert.Contains(t, err.Error(), "HTTP alive probe timeout") | |
| 282 | 282 | } | |
| 283 | 283 | ||
| 284 | - | func TestService_WaitForReady_GordonPortTakesPriorityOverProxyPort(t *testing.T) { | |
| 284 | + | func TestService_WaitForReady_ProxyPortTakesPriorityOverPort(t *testing.T) { | |
| 285 | 285 | runtime := mocks.NewMockContainerRuntime(t) | |
| 286 | 286 | svc := NewService(runtime, nil, nil, nil, Config{ | |
| 287 | 287 | ReadinessMode: "auto", | |
| @@ -294,18 +294,18 @@ func TestService_WaitForReady_GordonPortTakesPriorityOverProxyPort(t *testing.T) | |||
| 294 | 294 | probeIP, probePort := reserveEphemeralAddr(t) | |
| 295 | 295 | _ = probeIP | |
| 296 | 296 | ||
| 297 | - | // Both labels set — gordon.port (8080) should win over gordon.proxy.port (3000) | |
| 297 | + | // Both labels set — gordon.proxy.port (8080) should win over gordon.port (3000) | |
| 298 | 298 | containerConfig := &domain.ContainerConfig{ | |
| 299 | 299 | Ports: []int{22, 3000, 8080}, | |
| 300 | 300 | Labels: map[string]string{ | |
| 301 | - | domain.LabelPort: "8080", | |
| 302 | - | domain.LabelProxyPort: "3000", | |
| 301 | + | domain.LabelProxyPort: "8080", | |
| 302 | + | domain.LabelPort: "3000", | |
| 303 | 303 | }, | |
| 304 | 304 | } | |
| 305 | 305 | ||
| 306 | 306 | runtime.EXPECT().IsContainerRunning(mock.Anything, containerID).Return(true, nil).Once() | |
| 307 | 307 | runtime.EXPECT().GetContainerHealthStatus(mock.Anything, containerID).Return("", false, nil).Once() | |
| 308 | - | // Should use gordon.port=8080, NOT gordon.proxy.port=3000 | |
| 308 | + | // Should use gordon.proxy.port=8080, NOT gordon.port=3000 | |
| 309 | 309 | runtime.EXPECT().GetContainerPort(mock.Anything, containerID, 8080).Return(probePort, nil).Once() | |
| 310 | 310 | ||
| 311 | 311 | err := svc.waitForReady(ctx, containerID, containerConfig) | |
| @@ -217,7 +217,7 @@ func TestService_WaitForHealthy_EmptyStatusIsReportedAsStarting(t *testing.T) { | |||||
| 217 | assert.True(t, strings.Contains(err.Error(), "last status: starting")) | 217 | assert.True(t, strings.Contains(err.Error(), "last status: starting")) | ||
| 218 | } | 218 | } | ||
| 219 | 219 | ||||
| 220 | - | func TestService_WaitForReady_ProbeUsesGordonPortLabel(t *testing.T) { | 220 | + | func TestService_WaitForReady_ProbeUsesGordonProxyPortLabel(t *testing.T) { |
| 221 | runtime := mocks.NewMockContainerRuntime(t) | 221 | runtime := mocks.NewMockContainerRuntime(t) | ||
| 222 | svc := NewService(runtime, nil, nil, nil, Config{ | 222 | svc := NewService(runtime, nil, nil, nil, Config{ | ||
| 223 | ReadinessMode: "auto", | 223 | ReadinessMode: "auto", | ||
| @@ -231,11 +231,11 @@ func TestService_WaitForReady_ProbeUsesGordonPortLabel(t *testing.T) { | |||||
| 231 | probeIP, probePort := reserveEphemeralAddr(t) | 231 | probeIP, probePort := reserveEphemeralAddr(t) | ||
| 232 | _ = probeIP | 232 | _ = probeIP | ||
| 233 | 233 | ||||
| 234 | - | // Container config has gordon.port label — should be used for probe endpoint | 234 | + | // Container config has gordon.proxy.port label — should be used for probe endpoint |
| 235 | containerConfig := &domain.ContainerConfig{ | 235 | containerConfig := &domain.ContainerConfig{ | ||
| 236 | Ports: []int{22, 3000}, | 236 | Ports: []int{22, 3000}, | ||
| 237 | Labels: map[string]string{ | 237 | Labels: map[string]string{ | ||
| 238 | - | domain.LabelPort: "3000", | 238 | + | domain.LabelProxyPort: "3000", |
| 239 | }, | 239 | }, | ||
| 240 | } | 240 | } | ||
| 241 | 241 | ||||
| @@ -250,7 +250,7 @@ func TestService_WaitForReady_ProbeUsesGordonPortLabel(t *testing.T) { | |||||
| 250 | assert.Contains(t, err.Error(), "HTTP alive probe timeout") | 250 | assert.Contains(t, err.Error(), "HTTP alive probe timeout") | ||
| 251 | } | 251 | } | ||
| 252 | 252 | ||||
| 253 | - | func TestService_WaitForReady_ProbeUsesDeprecatedProxyPortLabel(t *testing.T) { | 253 | + | func TestService_WaitForReady_ProbeUsesDeprecatedPortLabel(t *testing.T) { |
| 254 | runtime := mocks.NewMockContainerRuntime(t) | 254 | runtime := mocks.NewMockContainerRuntime(t) | ||
| 255 | svc := NewService(runtime, nil, nil, nil, Config{ | 255 | svc := NewService(runtime, nil, nil, nil, Config{ | ||
| 256 | ReadinessMode: "auto", | 256 | ReadinessMode: "auto", | ||
| @@ -264,11 +264,11 @@ func TestService_WaitForReady_ProbeUsesDeprecatedProxyPortLabel(t *testing.T) { | |||||
| 264 | probeIP, probePort := reserveEphemeralAddr(t) | 264 | probeIP, probePort := reserveEphemeralAddr(t) | ||
| 265 | _ = probeIP // probeIP not used directly but port is | 265 | _ = probeIP // probeIP not used directly but port is | ||
| 266 | 266 | ||||
| 267 | - | // Container config has deprecated gordon.proxy.port — should still work | 267 | + | // Container config has deprecated gordon.port — should still work |
| 268 | containerConfig := &domain.ContainerConfig{ | 268 | containerConfig := &domain.ContainerConfig{ | ||
| 269 | Ports: []int{22, 3000}, | 269 | Ports: []int{22, 3000}, | ||
| 270 | Labels: map[string]string{ | 270 | Labels: map[string]string{ | ||
| 271 | - | domain.LabelProxyPort: "3000", | 271 | + | domain.LabelPort: "3000", |
| 272 | }, | 272 | }, | ||
| 273 | } | 273 | } | ||
| 274 | 274 | ||||
| @@ -281,7 +281,7 @@ func TestService_WaitForReady_ProbeUsesDeprecatedProxyPortLabel(t *testing.T) { | |||||
| 281 | assert.Contains(t, err.Error(), "HTTP alive probe timeout") | 281 | assert.Contains(t, err.Error(), "HTTP alive probe timeout") | ||
| 282 | } | 282 | } | ||
| 283 | 283 | ||||
| 284 | - | func TestService_WaitForReady_GordonPortTakesPriorityOverProxyPort(t *testing.T) { | 284 | + | func TestService_WaitForReady_ProxyPortTakesPriorityOverPort(t *testing.T) { |
| 285 | runtime := mocks.NewMockContainerRuntime(t) | 285 | runtime := mocks.NewMockContainerRuntime(t) | ||
| 286 | svc := NewService(runtime, nil, nil, nil, Config{ | 286 | svc := NewService(runtime, nil, nil, nil, Config{ | ||
| 287 | ReadinessMode: "auto", | 287 | ReadinessMode: "auto", | ||
| @@ -294,18 +294,18 @@ func TestService_WaitForReady_GordonPortTakesPriorityOverProxyPort(t *testing.T) | |||||
| 294 | probeIP, probePort := reserveEphemeralAddr(t) | 294 | probeIP, probePort := reserveEphemeralAddr(t) | ||
| 295 | _ = probeIP | 295 | _ = probeIP | ||
| 296 | 296 | ||||
| 297 | - | // Both labels set — gordon.port (8080) should win over gordon.proxy.port (3000) | 297 | + | // Both labels set — gordon.proxy.port (8080) should win over gordon.port (3000) |
| 298 | containerConfig := &domain.ContainerConfig{ | 298 | containerConfig := &domain.ContainerConfig{ | ||
| 299 | Ports: []int{22, 3000, 8080}, | 299 | Ports: []int{22, 3000, 8080}, | ||
| 300 | Labels: map[string]string{ | 300 | Labels: map[string]string{ | ||
| 301 | - | domain.LabelPort: "8080", | 301 | + | domain.LabelProxyPort: "8080", |
| 302 | - | domain.LabelProxyPort: "3000", | 302 | + | domain.LabelPort: "3000", |
| 303 | }, | 303 | }, | ||
| 304 | } | 304 | } | ||
| 305 | 305 | ||||
| 306 | runtime.EXPECT().IsContainerRunning(mock.Anything, containerID).Return(true, nil).Once() | 306 | runtime.EXPECT().IsContainerRunning(mock.Anything, containerID).Return(true, nil).Once() | ||
| 307 | runtime.EXPECT().GetContainerHealthStatus(mock.Anything, containerID).Return("", false, nil).Once() | 307 | runtime.EXPECT().GetContainerHealthStatus(mock.Anything, containerID).Return("", false, nil).Once() | ||
| 308 | - | // Should use gordon.port=8080, NOT gordon.proxy.port=3000 | 308 | + | // Should use gordon.proxy.port=8080, NOT gordon.port=3000 |
| 309 | runtime.EXPECT().GetContainerPort(mock.Anything, containerID, 8080).Return(probePort, nil).Once() | 309 | runtime.EXPECT().GetContainerPort(mock.Anything, containerID, 8080).Return(probePort, nil).Once() | ||
| 310 | 310 | ||||
| 311 | err := svc.waitForReady(ctx, containerID, containerConfig) | 311 | err := svc.waitForReady(ctx, containerID, containerConfig) | ||
M internal/usecase/container/service_test.go +6 -6
| @@ -3408,11 +3408,11 @@ func TestService_Deploy_PropagatesImageLabelsToContainerConfig(t *testing.T) { | |||
| 3408 | 3408 | // Exposed ports — image exposes both SSH and HTTP | |
| 3409 | 3409 | runtime.EXPECT().GetImageExposedPorts(mock.Anything, "gitea/gitea:latest").Return([]int{22, 3000}, nil) | |
| 3410 | 3410 | ||
| 3411 | - | // Image labels include gordon.port and gordon.health | |
| 3411 | + | // Image labels include gordon.proxy.port and gordon.health | |
| 3412 | 3412 | runtime.EXPECT().GetImageLabels(mock.Anything, "gitea/gitea:latest").Return(map[string]string{ | |
| 3413 | - | domain.LabelPort: "3000", | |
| 3414 | - | domain.LabelHealth: "/healthz", | |
| 3415 | - | "some.other.label": "ignored", | |
| 3413 | + | domain.LabelProxyPort: "3000", | |
| 3414 | + | domain.LabelHealth: "/healthz", | |
| 3415 | + | "some.other.label": "ignored", | |
| 3416 | 3416 | }, nil) | |
| 3417 | 3417 | ||
| 3418 | 3418 | // Load environment | |
| @@ -3427,8 +3427,8 @@ func TestService_Deploy_PropagatesImageLabelsToContainerConfig(t *testing.T) { | |||
| 3427 | 3427 | Status: "created", | |
| 3428 | 3428 | } | |
| 3429 | 3429 | runtime.EXPECT().CreateContainer(mock.Anything, mock.MatchedBy(func(cfg *domain.ContainerConfig) bool { | |
| 3430 | - | // Verify gordon.port was propagated from image labels | |
| 3431 | - | if cfg.Labels[domain.LabelPort] != "3000" { | |
| 3430 | + | // Verify gordon.proxy.port was propagated from image labels | |
| 3431 | + | if cfg.Labels[domain.LabelProxyPort] != "3000" { | |
| 3432 | 3432 | return false | |
| 3433 | 3433 | } | |
| 3434 | 3434 | // Verify gordon.health was propagated from image labels | |
| @@ -3408,11 +3408,11 @@ func TestService_Deploy_PropagatesImageLabelsToContainerConfig(t *testing.T) { | |||||
| 3408 | // Exposed ports — image exposes both SSH and HTTP | 3408 | // Exposed ports — image exposes both SSH and HTTP | ||
| 3409 | runtime.EXPECT().GetImageExposedPorts(mock.Anything, "gitea/gitea:latest").Return([]int{22, 3000}, nil) | 3409 | runtime.EXPECT().GetImageExposedPorts(mock.Anything, "gitea/gitea:latest").Return([]int{22, 3000}, nil) | ||
| 3410 | 3410 | ||||
| 3411 | - | // Image labels include gordon.port and gordon.health | 3411 | + | // Image labels include gordon.proxy.port and gordon.health |
| 3412 | runtime.EXPECT().GetImageLabels(mock.Anything, "gitea/gitea:latest").Return(map[string]string{ | 3412 | runtime.EXPECT().GetImageLabels(mock.Anything, "gitea/gitea:latest").Return(map[string]string{ | ||
| 3413 | - | domain.LabelPort: "3000", | 3413 | + | domain.LabelProxyPort: "3000", |
| 3414 | - | domain.LabelHealth: "/healthz", | 3414 | + | domain.LabelHealth: "/healthz", |
| 3415 | - | "some.other.label": "ignored", | 3415 | + | "some.other.label": "ignored", |
| 3416 | }, nil) | 3416 | }, nil) | ||
| 3417 | 3417 | ||||
| 3418 | // Load environment | 3418 | // Load environment | ||
| @@ -3427,8 +3427,8 @@ func TestService_Deploy_PropagatesImageLabelsToContainerConfig(t *testing.T) { | |||||
| 3427 | Status: "created", | 3427 | Status: "created", | ||
| 3428 | } | 3428 | } | ||
| 3429 | runtime.EXPECT().CreateContainer(mock.Anything, mock.MatchedBy(func(cfg *domain.ContainerConfig) bool { | 3429 | runtime.EXPECT().CreateContainer(mock.Anything, mock.MatchedBy(func(cfg *domain.ContainerConfig) bool { | ||
| 3430 | - | // Verify gordon.port was propagated from image labels | 3430 | + | // Verify gordon.proxy.port was propagated from image labels |
| 3431 | - | if cfg.Labels[domain.LabelPort] != "3000" { | 3431 | + | if cfg.Labels[domain.LabelProxyPort] != "3000" { |
| 3432 | return false | 3432 | return false | ||
| 3433 | } | 3433 | } | ||
| 3434 | // Verify gordon.health was propagated from image labels | 3434 | // Verify gordon.health was propagated from image labels | ||
M internal/usecase/proxy/service.go +3 -3
| @@ -693,18 +693,18 @@ func (s *Service) isRunningInContainer() bool { | |||
| 693 | 693 | } | |
| 694 | 694 | ||
| 695 | 695 | // getProxyPort determines the port to proxy to for an image. | |
| 696 | - | // It checks for gordon.port first, then the deprecated gordon.proxy.port alias, then falls back to the first exposed port. | |
| 696 | + | // It checks for gordon.proxy.port first, then the deprecated gordon.port alias, then falls back to the first exposed port. | |
| 697 | 697 | func (s *Service) getProxyPort(ctx context.Context, imageRef string) (int, error) { | |
| 698 | 698 | log := zerowrap.FromCtx(ctx) | |
| 699 | 699 | ||
| 700 | 700 | log.Debug().Str("image_ref", imageRef).Msg("determining proxy port for image") | |
| 701 | 701 | ||
| 702 | - | // Check for explicit port label (gordon.port preferred, gordon.proxy.port as deprecated alias) | |
| 702 | + | // Check for explicit port label (gordon.proxy.port preferred, gordon.port as deprecated alias) | |
| 703 | 703 | labels, err := s.runtime.GetImageLabels(ctx, imageRef) | |
| 704 | 704 | if err != nil { | |
| 705 | 705 | log.Debug().Err(err).Msg("failed to get image labels, falling back to exposed ports") | |
| 706 | 706 | } else { | |
| 707 | - | for _, key := range []string{domain.LabelPort, domain.LabelProxyPort} { | |
| 707 | + | for _, key := range []string{domain.LabelProxyPort, domain.LabelPort} { | |
| 708 | 708 | if portStr, ok := labels[key]; ok && portStr != "" { | |
| 709 | 709 | port, err := strconv.Atoi(portStr) | |
| 710 | 710 | if err == nil && port > 0 && port <= 65535 { | |
| @@ -693,18 +693,18 @@ func (s *Service) isRunningInContainer() bool { | |||||
| 693 | } | 693 | } | ||
| 694 | 694 | ||||
| 695 | // getProxyPort determines the port to proxy to for an image. | 695 | // getProxyPort determines the port to proxy to for an image. | ||
| 696 | - | // It checks for gordon.port first, then the deprecated gordon.proxy.port alias, then falls back to the first exposed port. | 696 | + | // It checks for gordon.proxy.port first, then the deprecated gordon.port alias, then falls back to the first exposed port. |
| 697 | func (s *Service) getProxyPort(ctx context.Context, imageRef string) (int, error) { | 697 | func (s *Service) getProxyPort(ctx context.Context, imageRef string) (int, error) { | ||
| 698 | log := zerowrap.FromCtx(ctx) | 698 | log := zerowrap.FromCtx(ctx) | ||
| 699 | 699 | ||||
| 700 | log.Debug().Str("image_ref", imageRef).Msg("determining proxy port for image") | 700 | log.Debug().Str("image_ref", imageRef).Msg("determining proxy port for image") | ||
| 701 | 701 | ||||
| 702 | - | // Check for explicit port label (gordon.port preferred, gordon.proxy.port as deprecated alias) | 702 | + | // Check for explicit port label (gordon.proxy.port preferred, gordon.port as deprecated alias) |
| 703 | labels, err := s.runtime.GetImageLabels(ctx, imageRef) | 703 | labels, err := s.runtime.GetImageLabels(ctx, imageRef) | ||
| 704 | if err != nil { | 704 | if err != nil { | ||
| 705 | log.Debug().Err(err).Msg("failed to get image labels, falling back to exposed ports") | 705 | log.Debug().Err(err).Msg("failed to get image labels, falling back to exposed ports") | ||
| 706 | } else { | 706 | } else { | ||
| 707 | - | for _, key := range []string{domain.LabelPort, domain.LabelProxyPort} { | 707 | + | for _, key := range []string{domain.LabelProxyPort, domain.LabelPort} { |
| 708 | if portStr, ok := labels[key]; ok && portStr != "" { | 708 | if portStr, ok := labels[key]; ok && portStr != "" { | ||
| 709 | port, err := strconv.Atoi(portStr) | 709 | port, err := strconv.Atoi(portStr) | ||
| 710 | if err == nil && port > 0 && port <= 65535 { | 710 | if err == nil && port > 0 && port <= 65535 { | ||
M internal/usecase/proxy/service_test.go +11 -11
| @@ -572,7 +572,7 @@ func TestDrainRegistryInFlightTimeout(t *testing.T) { | |||
| 572 | 572 | } | |
| 573 | 573 | } | |
| 574 | 574 | ||
| 575 | - | func TestService_GetTarget_HostMode_UsesGordonPortLabel(t *testing.T) { | |
| 575 | + | func TestService_GetTarget_HostMode_UsesProxyPortLabel(t *testing.T) { | |
| 576 | 576 | runtime := outmocks.NewMockContainerRuntime(t) | |
| 577 | 577 | containerSvc := inmocks.NewMockContainerService(t) | |
| 578 | 578 | configSvc := inmocks.NewMockConfigService(t) | |
| @@ -595,9 +595,9 @@ func TestService_GetTarget_HostMode_UsesGordonPortLabel(t *testing.T) { | |||
| 595 | 595 | {Domain: "git.example.com", Image: "gitea/gitea:latest"}, | |
| 596 | 596 | }) | |
| 597 | 597 | ||
| 598 | - | // Image has gordon.port=3000 label — should use 3000, not first exposed port | |
| 598 | + | // Image has gordon.proxy.port=3000 label | |
| 599 | 599 | runtime.EXPECT().GetImageLabels(mock.Anything, "gitea/gitea:latest").Return(map[string]string{ | |
| 600 | - | domain.LabelPort: "3000", | |
| 600 | + | domain.LabelProxyPort: "3000", | |
| 601 | 601 | }, nil) | |
| 602 | 602 | ||
| 603 | 603 | // Host port mapping for internal port 3000 | |
| @@ -611,7 +611,7 @@ func TestService_GetTarget_HostMode_UsesGordonPortLabel(t *testing.T) { | |||
| 611 | 611 | assert.Equal(t, "c-gitea", result.ContainerID) | |
| 612 | 612 | } | |
| 613 | 613 | ||
| 614 | - | func TestService_GetTarget_HostMode_UsesDeprecatedProxyPortLabel(t *testing.T) { | |
| 614 | + | func TestService_GetTarget_HostMode_UsesDeprecatedPortLabel(t *testing.T) { | |
| 615 | 615 | runtime := outmocks.NewMockContainerRuntime(t) | |
| 616 | 616 | containerSvc := inmocks.NewMockContainerService(t) | |
| 617 | 617 | configSvc := inmocks.NewMockConfigService(t) | |
| @@ -631,9 +631,9 @@ func TestService_GetTarget_HostMode_UsesDeprecatedProxyPortLabel(t *testing.T) { | |||
| 631 | 631 | {Domain: "app.example.com", Image: "myapp:latest"}, | |
| 632 | 632 | }) | |
| 633 | 633 | ||
| 634 | - | // Image has deprecated gordon.proxy.port label — should still work | |
| 634 | + | // Image has deprecated gordon.port label — should still work | |
| 635 | 635 | runtime.EXPECT().GetImageLabels(mock.Anything, "myapp:latest").Return(map[string]string{ | |
| 636 | - | domain.LabelProxyPort: "8080", | |
| 636 | + | domain.LabelPort: "8080", | |
| 637 | 637 | }, nil) | |
| 638 | 638 | ||
| 639 | 639 | runtime.EXPECT().GetContainerPort(mock.Anything, "c-app", 8080).Return(33000, nil) | |
| @@ -644,7 +644,7 @@ func TestService_GetTarget_HostMode_UsesDeprecatedProxyPortLabel(t *testing.T) { | |||
| 644 | 644 | assert.Equal(t, 33000, result.Port) | |
| 645 | 645 | } | |
| 646 | 646 | ||
| 647 | - | func TestService_GetTarget_HostMode_GordonPortWinsOverProxyPort(t *testing.T) { | |
| 647 | + | func TestService_GetTarget_HostMode_ProxyPortWinsOverPort(t *testing.T) { | |
| 648 | 648 | runtime := outmocks.NewMockContainerRuntime(t) | |
| 649 | 649 | containerSvc := inmocks.NewMockContainerService(t) | |
| 650 | 650 | configSvc := inmocks.NewMockConfigService(t) | |
| @@ -664,13 +664,13 @@ func TestService_GetTarget_HostMode_GordonPortWinsOverProxyPort(t *testing.T) { | |||
| 664 | 664 | {Domain: "dual.example.com", Image: "dualapp:latest"}, | |
| 665 | 665 | }) | |
| 666 | 666 | ||
| 667 | - | // Both labels set — gordon.port=9000 should win over gordon.proxy.port=3000 | |
| 667 | + | // Both labels set — gordon.proxy.port=9000 should win over gordon.port=3000 | |
| 668 | 668 | runtime.EXPECT().GetImageLabels(mock.Anything, "dualapp:latest").Return(map[string]string{ | |
| 669 | - | domain.LabelPort: "9000", | |
| 670 | - | domain.LabelProxyPort: "3000", | |
| 669 | + | domain.LabelProxyPort: "9000", | |
| 670 | + | domain.LabelPort: "3000", | |
| 671 | 671 | }, nil) | |
| 672 | 672 | ||
| 673 | - | // Should use 9000 (gordon.port), NOT 3000 (gordon.proxy.port) | |
| 673 | + | // Should use 9000 (gordon.proxy.port), NOT 3000 (gordon.port) | |
| 674 | 674 | runtime.EXPECT().GetContainerPort(mock.Anything, "c-dual", 9000).Return(34000, nil) | |
| 675 | 675 | ||
| 676 | 676 | result, err := svc.GetTarget(ctx, "dual.example.com") | |
| @@ -572,7 +572,7 @@ func TestDrainRegistryInFlightTimeout(t *testing.T) { | |||||
| 572 | } | 572 | } | ||
| 573 | } | 573 | } | ||
| 574 | 574 | ||||
| 575 | - | func TestService_GetTarget_HostMode_UsesGordonPortLabel(t *testing.T) { | 575 | + | func TestService_GetTarget_HostMode_UsesProxyPortLabel(t *testing.T) { |
| 576 | runtime := outmocks.NewMockContainerRuntime(t) | 576 | runtime := outmocks.NewMockContainerRuntime(t) | ||
| 577 | containerSvc := inmocks.NewMockContainerService(t) | 577 | containerSvc := inmocks.NewMockContainerService(t) | ||
| 578 | configSvc := inmocks.NewMockConfigService(t) | 578 | configSvc := inmocks.NewMockConfigService(t) | ||
| @@ -595,9 +595,9 @@ func TestService_GetTarget_HostMode_UsesGordonPortLabel(t *testing.T) { | |||||
| 595 | {Domain: "git.example.com", Image: "gitea/gitea:latest"}, | 595 | {Domain: "git.example.com", Image: "gitea/gitea:latest"}, | ||
| 596 | }) | 596 | }) | ||
| 597 | 597 | ||||
| 598 | - | // Image has gordon.port=3000 label — should use 3000, not first exposed port | 598 | + | // Image has gordon.proxy.port=3000 label |
| 599 | runtime.EXPECT().GetImageLabels(mock.Anything, "gitea/gitea:latest").Return(map[string]string{ | 599 | runtime.EXPECT().GetImageLabels(mock.Anything, "gitea/gitea:latest").Return(map[string]string{ | ||
| 600 | - | domain.LabelPort: "3000", | 600 | + | domain.LabelProxyPort: "3000", |
| 601 | }, nil) | 601 | }, nil) | ||
| 602 | 602 | ||||
| 603 | // Host port mapping for internal port 3000 | 603 | // Host port mapping for internal port 3000 | ||
| @@ -611,7 +611,7 @@ func TestService_GetTarget_HostMode_UsesGordonPortLabel(t *testing.T) { | |||||
| 611 | assert.Equal(t, "c-gitea", result.ContainerID) | 611 | assert.Equal(t, "c-gitea", result.ContainerID) | ||
| 612 | } | 612 | } | ||
| 613 | 613 | ||||
| 614 | - | func TestService_GetTarget_HostMode_UsesDeprecatedProxyPortLabel(t *testing.T) { | 614 | + | func TestService_GetTarget_HostMode_UsesDeprecatedPortLabel(t *testing.T) { |
| 615 | runtime := outmocks.NewMockContainerRuntime(t) | 615 | runtime := outmocks.NewMockContainerRuntime(t) | ||
| 616 | containerSvc := inmocks.NewMockContainerService(t) | 616 | containerSvc := inmocks.NewMockContainerService(t) | ||
| 617 | configSvc := inmocks.NewMockConfigService(t) | 617 | configSvc := inmocks.NewMockConfigService(t) | ||
| @@ -631,9 +631,9 @@ func TestService_GetTarget_HostMode_UsesDeprecatedProxyPortLabel(t *testing.T) { | |||||
| 631 | {Domain: "app.example.com", Image: "myapp:latest"}, | 631 | {Domain: "app.example.com", Image: "myapp:latest"}, | ||
| 632 | }) | 632 | }) | ||
| 633 | 633 | ||||
| 634 | - | // Image has deprecated gordon.proxy.port label — should still work | 634 | + | // Image has deprecated gordon.port label — should still work |
| 635 | runtime.EXPECT().GetImageLabels(mock.Anything, "myapp:latest").Return(map[string]string{ | 635 | runtime.EXPECT().GetImageLabels(mock.Anything, "myapp:latest").Return(map[string]string{ | ||
| 636 | - | domain.LabelProxyPort: "8080", | 636 | + | domain.LabelPort: "8080", |
| 637 | }, nil) | 637 | }, nil) | ||
| 638 | 638 | ||||
| 639 | runtime.EXPECT().GetContainerPort(mock.Anything, "c-app", 8080).Return(33000, nil) | 639 | runtime.EXPECT().GetContainerPort(mock.Anything, "c-app", 8080).Return(33000, nil) | ||
| @@ -644,7 +644,7 @@ func TestService_GetTarget_HostMode_UsesDeprecatedProxyPortLabel(t *testing.T) { | |||||
| 644 | assert.Equal(t, 33000, result.Port) | 644 | assert.Equal(t, 33000, result.Port) | ||
| 645 | } | 645 | } | ||
| 646 | 646 | ||||
| 647 | - | func TestService_GetTarget_HostMode_GordonPortWinsOverProxyPort(t *testing.T) { | 647 | + | func TestService_GetTarget_HostMode_ProxyPortWinsOverPort(t *testing.T) { |
| 648 | runtime := outmocks.NewMockContainerRuntime(t) | 648 | runtime := outmocks.NewMockContainerRuntime(t) | ||
| 649 | containerSvc := inmocks.NewMockContainerService(t) | 649 | containerSvc := inmocks.NewMockContainerService(t) | ||
| 650 | configSvc := inmocks.NewMockConfigService(t) | 650 | configSvc := inmocks.NewMockConfigService(t) | ||
| @@ -664,13 +664,13 @@ func TestService_GetTarget_HostMode_GordonPortWinsOverProxyPort(t *testing.T) { | |||||
| 664 | {Domain: "dual.example.com", Image: "dualapp:latest"}, | 664 | {Domain: "dual.example.com", Image: "dualapp:latest"}, | ||
| 665 | }) | 665 | }) | ||
| 666 | 666 | ||||
| 667 | - | // Both labels set — gordon.port=9000 should win over gordon.proxy.port=3000 | 667 | + | // Both labels set — gordon.proxy.port=9000 should win over gordon.port=3000 |
| 668 | runtime.EXPECT().GetImageLabels(mock.Anything, "dualapp:latest").Return(map[string]string{ | 668 | runtime.EXPECT().GetImageLabels(mock.Anything, "dualapp:latest").Return(map[string]string{ | ||
| 669 | - | domain.LabelPort: "9000", | 669 | + | domain.LabelProxyPort: "9000", |
| 670 | - | domain.LabelProxyPort: "3000", | 670 | + | domain.LabelPort: "3000", |
| 671 | }, nil) | 671 | }, nil) | ||
| 672 | 672 | ||||
| 673 | - | // Should use 9000 (gordon.port), NOT 3000 (gordon.proxy.port) | 673 | + | // Should use 9000 (gordon.proxy.port), NOT 3000 (gordon.port) |
| 674 | runtime.EXPECT().GetContainerPort(mock.Anything, "c-dual", 9000).Return(34000, nil) | 674 | runtime.EXPECT().GetContainerPort(mock.Anything, "c-dual", 9000).Return(34000, nil) | ||
| 675 | 675 | ||||
| 676 | result, err := svc.GetTarget(ctx, "dual.example.com") | 676 | result, err := svc.GetTarget(ctx, "dual.example.com") | ||