Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/feat: nginx canary weight support header #1514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mumubin
Copy link

@mumubin mumubin commented Sep 15, 2023

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-commenter
Copy link

codecov-commenter commented Sep 15, 2023

Codecov Report

Patch coverage: 75.00% and project coverage change: +0.71% 🎉

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%) ⬆️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mumubin mumubin force-pushed the nginx-weight-canary-support-header branch from 3e6e0b4 to c0354b1 Compare September 15, 2023 08:33
@mumubin mumubin changed the title Nginx canary weight support header fix/feat: nginx canary weight support header Sep 19, 2023
@mumubin
Copy link
Author

mumubin commented Sep 26, 2023

Any questions? We can discuss it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants