-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
add header-value annotation #3619
add header-value annotation #3619
Conversation
@ElvinEfendi , please have a look. I would like to better understand the suggestion you wrote in the message thread. Do you propose to have a single annotation that defines either header, cookie or weight or you like to have more complex condition like two headers or a header and cookie? |
Could you please update the e2e tests to reflect the use-cases of these changes? https://github.com/kubernetes/ingress-nginx/blob/master/test/e2e/annotations/canary.go |
@ElvinEfendi , @clandry94 what possible scenarios of canary traffic policies you think may be required?
expr = loadstring(traffic_shaping_policy.predicate)
if expr() then
return true
else
return false
end or evaluate the policy basing on data structure like it is now? |
@clandry94, can you advise on possible reasoning for e2e tests failures? I see there failures for other modules beside canary. i am not experienced with the tests output. i cannot see the response headers or body, hence cannot identify the source of the problem. |
@minherz You can add |
it seems that all "my" e2e tests pass. i have a problem to run it locally on my Windows 10 environment because Docker for Windows conflicts with minikube due different hypervisor platforms and ingress-nginx build scripts fail to run without minikube (even build). I will try to organize a Linux VM to run everything on it in a hope it works out of the box. However, e2e failures seem unrelated to my change. |
@ElvinEfendi, @clandry94 I would like to propose the following annotation to replace the existing: Define the annotation
I don't know if there is a simple parsing package in go. If there is none, a simple one can be implemented here. The idea is to parse the predicate and run in a loop in Lua script on each condition. |
f4e308f
to
0455a6a
Compare
@minherz regarding to supporting more complex expressions let's not address it just yet. I'm looking into introducing Lua code sandboxing into ingress-nginx for other purposes that can also be used here. Also let's let the users use the existing canary feature and provide more feedback - I'd rather avoid implementing something that won't be used widely. |
💯 that. |
Then I misinterpret the suggestion you wrote in the mail thread:
|
@ElvinEfendi can I mark the conversations as resolved? |
@ElvinEfendi and @aledbf , i have create a PR that implements the suggestion to replace current multiple canary annotations with one that follows the same routing logic. P.S. the new PR doesn't have e2e tests yet. Before submitting it, I will edit existing tests to reflect the new format and structure. |
ping @aledbf, @ElvinEfendi, |
ping @aledbf, @ElvinEfendi,@clandry94 |
Please no. Annotations are just strings, no to store json or yaml definitions. |
Nothing in particular, is just a safety measure to avoid just one approve/lgtm command that will trigger the merge of the PR.
@minherz apologies for the delay in the review of this PR. For this feature, I prefer to defer the first lgtm to @ElvinEfendi/@clandry94 |
ok, guys (@ElvinEfendi/@clandry94) I am waiting for your feedback about next steps with this PR and with the suggestion. |
Done |
@minherz something must have went wrong with rebasing - there are a lot of unrelated changes. |
I synced master in my fork and then merged it into my work branch which I used for this PR. At the end I rebased it back by 8 commits but git produced 53. Reviewing the commits they all seem to happened between the change i made by Jan 5th and today. |
@minherz after you pull remote master you should rebase your branch with that, not merge |
d17fa48
to
a8713e9
Compare
add new annotation (header-value) parse it and propogate to lua script alter balancer rule to include it into the canary routing logic add e2e test to validate fallback for canary-by-header-value add description of canary-by-header-value to documentation
a8713e9
to
de2a1ec
Compare
@ElvinEfendi it should be better now 😃 |
@minherz it's indeed better! Test failure seems to be legit. |
@minherz please apply following patch:
that will fix the bug that causes test to fail |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ElvinEfendi, minherz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
@aledbf how do you cancel |
@aledbf @clandry94 would it be possible to use annotation to define a configMap that will describe the canary policy? the policy can be updated either each time the annotation is processed or each time the configMap resource is updated. |
can we use multiple values in canary-by-header-value? |
I think we can safely say that currently you can use only one value.
|
This PR extends the existing
canary-by-header
annotation.What this PR does / why we need it:
This PR introduce more flexibility into the existing definition of the canary routing rules. The current implementation requires sending a header with a fixed value in order to trigger a canary routing which requires dedicated changes in the code of the application. This is less convenient when the application already has a header which can be used given its value represents a partition of users applicable to the canary testing (e.g. tenant id in the multi-tenant application).
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
This subject was already discussed in this message thread. Given we agree on implementation, I am going to add tests to the new annotation.