fluxcd/flagger

Feature Request: Support Custom BackendRef for Primary and Canary Services

Opened this issue · 0 comments

Problem Statement

Currently, Flagger automatically generates backend references for primary and canary services based on the service names. However, in complex deployment scenarios, teams often need to:

  • Insert intermediate proxies for security requirements
  • Add service-specific monitoring
  • Implement circuit breakers
  • Route through different mesh configurations
  • Apply different filtering rules for primary and canary traffic

This limitation makes it difficult to implement advanced deployment patterns where primary and canary services need different routing configurations or must be routed through different intermediary services.

Proposed Solution

Extend the CanaryService spec to allow custom backend references for both primary and canary services. This would allow users to:

  • Specify custom backend services/configurations for both primary and canary traffic
  • Define service-specific filters
  • Configure different routing paths for primary and canary deployments
  • Maintain existing automatic backend reference generation as default behavior

Technical Details

Add a new backendRef and filters to spec.service.canary and spec.service.primary:

service:
  primary:
    backendRef: #new
      name: primary-proxy
      namespace: monitoring
    filters: #new
      - type: RequestHeaderModifier
        requestHeaderModifier:
          set:
            - name: x-route
              value: primary
  canary:
    backendRef: #new
      name: canary-proxy
      namespace: monitoring
    filters: #new
      - type: RequestHeaderModifier
        requestHeaderModifier:
          set:
            - name: x-route
              value: canary

Benefits

  • Enhanced flexibility for complex deployment scenarios
  • Better support for security and monitoring requirements
  • Improved control over traffic routing
  • Easier integration with existing infrastructure