You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -404,7 +404,7 @@ While Flagger can perform weighted routing and A/B testing individually, with Ga
404
404
release with session affinity.
405
405
For more information you can read the [deployment strategies docs](../usage/deployment-strategies.md#canary-release-with-session-affinity).
406
406
407
-
> **Note:** The implementation must have support for the [`ResponseHeaderModifier`](https://github.com/kubernetes-sigs/gateway-api/blob/3d22aa5a08413222cb79e6b2e245870360434614/apis/v1beta1/httproute_types.go#L651) API.
407
+
> **Note:** The implementation must have support for the [`ResponseHeaderModifier`](https://github.com/kubernetes-sigs/gateway-api/blob/3d22aa5a08413222cb79e6b2e245870360434614/apis/v1beta1/httproute_types.go#L651) API.
408
408
409
409
Create a canary custom resource \(replace www.example.com with your own domain\):
410
410
@@ -728,3 +728,72 @@ With the above configuration, Flagger will run a canary release with the followi
728
728
* send notification with the canary analysis result
729
729
730
730
The above procedures can be extended with [custom metrics](../usage/metrics.md) checks, [webhooks](../usage/webhooks.md), [manual promotion](../usage/webhooks.md#manual-gating) approval and [Slack or MS Teams](../usage/alerting.md) notifications.
731
+
732
+
## Custom backends and backend-specific filters (Gateway API)
733
+
734
+
Flagger can configure custom `backendRef` and backend-specific `filters` on the generated `HTTPRoute` when using the Gateway API provider. This allows you to:
735
+
736
+
* override the default `Service` backend with an arbitrary backend object reference
737
+
* attach filters that are executed only when a specific backend is selected by routing (e.g., per-backend header modifiers)
738
+
739
+
This is controlled via `spec.service.primaryBackend` and `spec.service.canaryBackend` fields of the `Canary` resource. When set, Flagger will use these values to populate `rules[].backendRefs[]` for the primary and canary targets respectively.
740
+
741
+
Example:
742
+
743
+
```yaml
744
+
apiVersion: flagger.app/v1beta1
745
+
kind: Canary
746
+
metadata:
747
+
name: podinfo
748
+
namespace: test
749
+
spec:
750
+
targetRef:
751
+
apiVersion: apps/v1
752
+
kind: Deployment
753
+
name: podinfo
754
+
service:
755
+
port: 9898
756
+
hosts:
757
+
- www.example.com
758
+
gatewayRefs:
759
+
- name: gateway
760
+
namespace: istio-ingress
761
+
# Optional: override backends and add backend-specific filters
762
+
primaryBackend:
763
+
backendRef:
764
+
group: ""
765
+
kind: Service
766
+
name: podinfo-primary
767
+
port: 9898
768
+
filters:
769
+
- type: ResponseHeaderModifier
770
+
responseHeaderModifier:
771
+
add:
772
+
- name: X-Primary-Backend
773
+
value: "true"
774
+
canaryBackend:
775
+
backendRef:
776
+
group: ""
777
+
kind: Service
778
+
name: podinfo-canary
779
+
port: 9898
780
+
filters:
781
+
- type: ResponseHeaderModifier
782
+
responseHeaderModifier:
783
+
add:
784
+
- name: X-Canary-Backend
785
+
value: "true"
786
+
analysis:
787
+
interval: 1m
788
+
threshold: 5
789
+
maxWeight: 50
790
+
stepWeight: 10
791
+
```
792
+
793
+
Notes:
794
+
795
+
* Backend-specific filters attached via `primaryBackend.filters` and `canaryBackend.filters` are only evaluated when requests are forwarded to that particular backend.
796
+
* If the backend references a cross-namespace resource, Flagger will automatically create and maintain `ReferenceGrant` objects to allow the `HTTPRoute` to reference it across namespaces.
797
+
* You can continue to use route-level filters through the existing `service.headers`, `service.rewrite`, and `service.mirror` fields; those apply regardless of which backend is selected.
798
+
799
+
This feature is supported only with the Gateway API provider. Other providers ignore `primaryBackend` and `canaryBackend`.
0 commit comments