Add support for setting traffic distribution

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan
2025-10-15 16:31:22 +03:00
parent 60cb38a773
commit c30e6552d7
8 changed files with 76 additions and 6 deletions

View File

@@ -148,6 +148,7 @@ spec:
targetPort: 9898
portDiscovery: true
headless: false
trafficDistribution: PreferClose
```
The container port from the target workload should match the `service.port` or `service.targetPort`.
@@ -155,7 +156,7 @@ The `service.name` is optional, defaults to `spec.targetRef.name`.
The `service.targetPort` can be a container port number or name.
The `service.portName` is optional (defaults to `http`), if your workload uses gRPC then set the port name to `grpc`.
The `service.appProtocol` is optional, more details can be found [here](https://kubernetes.io/docs/concepts/services-networking/service/#application-protocol).
The `service.trafficDistribution` is optional, more details can be found [here](https://kubernetes.io/docs/concepts/services-networking/service/#traffic-distribution).
If port discovery is enabled, Flagger scans the target workload and extracts the containers ports
excluding the port specified in the canary service and service mesh sidecar ports.