flagger
flagger copied to clipboard
canary activation removes unspecified ports from the pre-existing service
Describe the bug
with two ports defined in the targeted Service, after canary activation, only the port specified in the Canary object remains defined in the Service.
apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
name: es-api
namespace: dev-es-api
spec:
analysis:
interval: 120s
maxWeight: 50
metrics:
- interval: 1m
name: request-success-rate
thresholdRange:
min: 99
- interval: 30s
name: request-duration
thresholdRange:
max: 500
stepWeight: 5
threshold: 5
webhooks:
- metadata:
cmd: 'curl -f -X POST -H ''Content-Type: application/json'' https://<snip/> --data @/scaffolding/es-api.json'
type: bash
name: acceptance-test
timeout: 30s
type: pre-rollout
url: http://loadtester.test/
- metadata:
cmd: 'hey -z 2m -q 5 -c 1 -T application/json -m POST -D /scaffolding/es-api.json <snip/>'
type: bash
name: load-test
timeout: 150s
type: rollout
url: http://loadtester.test/
autoscalerRef:
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
name: es-api
progressDeadlineSeconds: 150
service:
port: 5000
targetRef:
apiVersion: apps/v1
kind: Deployment
name: es-api
To Reproduce
start with this Service:
apiVersion: v1
kind: Service
metadata:
name: es-api
namespace: dev-es-api
spec:
ports:
- name: http
port: 5000
protocol: TCP
targetPort: http
- name: metrics
port: 5558
protocol: TCP
targetPort: metrics
type: ClusterIP
after activating Canary, meaning primary is active and tests have passed, the service changes to this:
apiVersion: v1
kind: Service
metadata:
name: es-api
namespace: dev-es-api
spec:
ports:
- name: http
port: 5000
protocol: TCP
targetPort: http
type: ClusterIP
only the 5000 port as declared in the Canary object remains
Expected behavior
the additional port remains in the declared Service
Additional context
- Flagger version: 1.27.0
- Kubernetes version: 1.21
- Service Mesh provider: linkerd
- Ingress provider: ingress-nginx
I'm having the same issue.
The doc recommended to use portDiscovery: true
if the service has multiple ports, but portDiscovery: true
does not works for linkerd, at least for me. https://docs.flagger.app/faq#multiple-ports.
Additional context Flagger version: 1.32.0 Kubernetes version: v1.26.6-gke.1700