Skip to content

Conversation

@mavriq
Copy link

@mavriq mavriq commented Nov 8, 2025

New annotations canary-by-cookie-pattern and canary-by-cookie-value have been added in analogy with similar annotations canary-by-header-pattern and canary-by-header-value

What this PR does / why we need it:

This PR extends the canary deployment functionality for cookie-based routing by adding support for custom values and regex patterns, similar to the existing header-based canary annotations.
Currently, canary-by-cookie only supports the hardcoded values always and never.
This enhancement allows users to define custom cookie values and patterns for more flexible canary routing scenarios.

New Annotations:

  • nginx.ingress.kubernetes.io/canary-by-cookie-value: For exact cookie value matching
  • nginx.ingress.kubernetes.io/canary-by-cookie-pattern: For regex pattern matching

Usage Examples:

# Exact value matching
nginx.ingress.kubernetes.io/canary-by-cookie: "stand"
nginx.ingress.kubernetes.io/canary-by-cookie-value: "staging"

# Regex pattern matching
nginx.ingress.kubernetes.io/canary-by-cookie: "user-group"
nginx.ingress.kubernetes.io/canary-by-cookie-pattern: "^(beta|test).*$"

# Backward compatibility (still works)
nginx.ingress.kubernetes.io/canary-by-cookie: "test"
# "always" routes to canary, "never" routes to primary

This implementation maintains full backward compatibility while providing the same flexible routing capabilities for cookies that were already available for headers.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • CVE Report (Scanner found CVE and adding report)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

How Has This Been Tested?

  • Added comprehensive unit tests in canary/canary_test.go covering:
    • Custom cookie value matching
    • Regex pattern matching
    • Backward compatibility with existing "always"/"never" behavior
    • Priority handling (value > pattern > default)
  • Tested in development environment with various cookie value scenarios
  • Verified consistency with existing canary-by-header functionality

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.

…been added in anoligy with similar annotations canary-by-header...
@netlify
Copy link

netlify bot commented Nov 8, 2025

Deploy Preview for kubernetes-ingress-nginx ready!

Name Link
🔨 Latest commit c873606
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-ingress-nginx/deploys/690fd9667fe4fe00084698d4
😎 Deploy Preview https://deploy-preview-14138--kubernetes-ingress-nginx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/docs labels Nov 8, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mavriq
Once this PR has been reviewed and has the lgtm label, please assign cpanato for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. area/lua Issues or PRs related to lua code needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 8, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @mavriq. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-priority size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 8, 2025
@Gacko Gacko removed their request for review November 9, 2025 03:27
@Gacko
Copy link
Member

Gacko commented Nov 10, 2025

As described here we no longer accept new features: #13002.

@Gacko Gacko closed this Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs area/lua Issues or PRs related to lua code cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants