You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "AlinsRan (via GitHub)" <gi...@apache.org> on 2026/05/13 20:32:17 UTC

[PR] feat: support upstream health checks in BackendTrafficPolicy [apisix-ingress-controller]

AlinsRan opened a new pull request, #2763:
URL: https://github.com/apache/apisix-ingress-controller/pull/2763

   ## Summary
   
   This PR adds health check support to `BackendTrafficPolicy`, allowing users to configure active and passive health checks for upstream backends directly through the `BackendTrafficPolicy` resource.
   
   ## Changes
   
   ### New API types (`api/v1alpha1/backendtrafficpolicy_types.go`)
   - Added `HealthCheck` struct with `Active` and `Passive` fields to `BackendTrafficPolicySpec`
   - `ActiveHealthCheck`: configures HTTP/TCP probes with configurable interval, timeout, thresholds, and TLS settings
   - `PassiveHealthCheck`: configures passive (observational) health monitoring with configurable thresholds
   - Timeouts field uses `BackendTrafficPolicyTimeouts` struct (renamed json tag from `timeout` to `timeouts` for consistency)
   
   ### Translation (`internal/adc/translator/policies.go`)
   - Translates `BackendTrafficPolicy.Spec.HealthCheck` into APISIX upstream `checks` configuration
   - Active health check intervals are clamped to a minimum of 1 second (APISIX requirement)
   - Supports both HTTP and TCP active health check types
   - Maps all threshold fields: healthy/unhealthy HTTP statuses, TCP success/failure counts
   
   ### CRD regeneration
   - Updated `config/crd/bases/apisix.apache.org_backendtrafficpolicies.yaml` with health check schema
   - Updated deepcopy functions
   
   ### E2E tests (`test/e2e/crds/v1alpha1/backendtrafficpolicy.go`)
   - End-to-end tests covering:
     - Active HTTP health check configuration (interval, timeout, thresholds, HTTP path)
     - Active TCP health check configuration
     - Passive health check configuration
     - Health check deletion (verifies checks are removed from upstream)
   
   ## Example
   
   ```yaml
   apiVersion: apisix.apache.org/v1alpha1
   kind: BackendTrafficPolicy
   metadata:
     name: my-policy
   spec:
     targetRef:
       group: gateway.networking.k8s.io
       kind: HTTPRoute
       name: my-route
     healthCheck:
       active:
         type: HTTP
         interval: 10s
         timeout: 3s
         httpPath: /healthz
         healthy:
           httpStatuses: [200, 201]
           successes: 3
         unhealthy:
           httpStatuses: [500, 502, 503]
           httpFailures: 3
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: support upstream health checks in BackendTrafficPolicy [apisix-ingress-controller]

Posted by "AlinsRan (via GitHub)" <gi...@apache.org>.
AlinsRan merged PR #2763:
URL: https://github.com/apache/apisix-ingress-controller/pull/2763


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org