fix/feat: nginx canary weight support header
I have a nginx canary deployment scenario where I hope to support canary weight and header at the same time . However, after testing, the weight of the canary ingress will not change when there is a header configuration. This PR is to fix this case.
P.S. In the article, it said nginx.ingress.kubernetes.io/canary-by-header and nginx.ingress.kubernetes.io/canary-weight can work together
apiVersion: flagger.app/v1beta1
kind: Canary
metadata:
name: podinfo
namespace: flagger-bin
spec:
provider: nginx
# deployment reference
targetRef:
apiVersion: apps/v1
kind: Deployment
name: podinfo
# ingress reference
ingressRef:
apiVersion: networking.k8s.io/v1
kind: Ingress
name: podinfo
# the maximum time in seconds for the canary deployment
# to make progress before it is rollback (default 600s)
progressDeadlineSeconds: 6000
service:
# ClusterIP port number
port: 80
# container port number or name
targetPort: 9898
analysis:
match:
# curl -H 'X-Canary: insider' http://app.example.com
- headers:
x-canary:
exact: "insider"
# schedule interval (default 60s)
interval: 10s
# max number of failed metric checks before rollback
threshold: 10
# max traffic percentage routed to canary
# percentage (0-100)
maxWeight: 50
# canary increment step
# percentage (0-100)
stepWeight: 5
# NGINX Prometheus checks
Codecov Report
Patch coverage: 75.00% and project coverage change: +0.71% :tada:
Comparison is base (
7fc007a) 54.56% compared to head (c0354b1) 55.28%. Report is 48 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #1514 +/- ##
==========================================
+ Coverage 54.56% 55.28% +0.71%
==========================================
Files 84 85 +1
Lines 10143 10234 +91
==========================================
+ Hits 5535 5658 +123
+ Misses 3953 3917 -36
- Partials 655 659 +4
| Files Changed | Coverage Δ | |
|---|---|---|
| pkg/router/ingress.go | 67.26% <75.00%> (+0.19%) |
:arrow_up: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Any questions? We can discuss it.