-
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
Fix incorrect service name being set in the nginx template #11294
base: main
Are you sure you want to change the base?
Conversation
Fix: kubernetes#10210 This handles the case where multiple rules have identical paths, but differing types.
Welcome @adrianmoisey! |
Hi @adrianmoisey. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
✅ Deploy Preview for kubernetes-ingress-nginx canceled.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: adrianmoisey 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 |
ingressPathType, ok := t.(*v1.PathType) | ||
if !ok { | ||
klog.Errorf("expected a '*v1.PathType' type but %T was returned", t) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if this is the best way to handle the type assertion.
It seems like we may get the correct type, or nothing at all (empty string I think).
Happy to change this if anyone has a suggestion.
/triage accepted |
/cherry-pick release-1.10 |
@Gacko: once the present PR merges, I will cherry-pick it on top of release-1.10 in a new PR and assign it to you. In response to this:
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/test-infra repository. |
@adrianmoisey @Gacko Can you post the link proof from upstream K8S KEP, that clarifies, that identical host joined with identical path, is allowed to be a individual new rule, just because the |
Bullet point 4 from: https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/758-ingress-api-group#path-matching-semantics
Note: This PR isn't adding new paths/rules to nginx. It already does that. |
@adrianmoisey thanks for the link. I am not a developer. I have just seen pattern of duplicates not being appropriate, for not-short-time now, simply because, regardless of admission-webook accepting duplicate combo of These are my thoughts. Will wait to get educated on the intricacies. It means now we clearly support duplicates in the project. |
Also, from the point of view of benefit to mass of users, admission-webhook should not allow duplicates. I do understand that temporary duplicates help in migration as well as permanent duplicates as variants of pathType though. So its a question of having a messy feature that is a antipattern to ingress traffic or having such a feature and maintaining it but only a couple of users getting benefit from the feature. |
/ok-to-test |
/assign |
ingressPathType, ok := t.(*networkingv1.PathType) | ||
if !ok { | ||
klog.Errorf("expected a '*v1.PathType' type but %T was returned", t) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if this is the best way to handle the type assertion.
It seems like we may get the correct type, or nothing at all (empty string I think).
Happy to change this if anyone has a suggestion.
I guess another option is to default to ImplementationSpecific
, should this assertion fail (https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/758-ingress-api-group#defaults)
I'm not sure I understand why this is considered an anti-pattern. However, my PR is simply a bug fix, it's not really related to if a feature should or shouldn't exist. |
Hi @adrianmoisey , However its the broader context that has become visible via this PR and hence my comments. |
/uncc |
/unassign |
Hi @Gacko Thanks! |
This handles the case where multiple rules have identical paths, but differing types.
This should populate the $service_name variable with the correct service name.
What this PR does / why we need it:
Fixes: #10210
At the moment if multiple rules contain the same path, sometimes the incorrect service name may be set in the $service_name variable
Types of changes
Which issue/s this PR fixes
fixes #10210
How Has This Been Tested?
Test case added in PR.
Manual testing locally and checking the outputted
nginx.conf
fileChecklist: