-
Notifications
You must be signed in to change notification settings - Fork 590
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: routes with conflicting services #2988
Conversation
c0846ee
to
ba40f87
Compare
0ac8365
to
a82d48d
Compare
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.
Minor comments, overall this looks 👍
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.
We definitely want to at least alert on these in logs, and the original request wanted to actually skip the routes that would result from these altogether, rather than choosing an arbitrary set of services that do have equal annotations.
The latter part is both for visibility (you're more likely to check something that isn't working altogether than something that appears to work fine) and because we have no way of knowing which set of annotations is correct.
I probably didn't get correctly what you meant In the issue. It's clearer to me now, I'm going to set the PR back to draft to reduce noise. |
7af8fcc
to
607cb2e
Compare
607cb2e
to
5f6b5a2
Compare
5f6b5a2
to
36a413f
Compare
36a413f
to
8db8b8c
Compare
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.
Minor spelling nits, otherwise 👍
I'd like to have a review by @rainest as well, as he is the original author of the issue and questioned the first implementation. |
When the kongState is built, if some backendRefs have inconsistent annotations, a message is logged, and the service is skipped, instead of breaking the whole configuration process. Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Split the multi-backend HTTPRoute test into its own test function. Added a test for invalid (inconsistent Service configuration) HTTPRoute rules with multiple backends.
Change to active voice. Remove mention of internal structs. Fix number.
044bfe7
to
c75ade6
Compare
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.
Added an integration test since it's hard to think through the rule deletion and make HTTPRouteEssentials less massive. The whole "ingressRules is a list of services that we've appended routes to as we go through each rule, and deleting the service will in turn delete the routes" aspect of the parser is confusing to think through, even if I understand kinda why we did it.
Actually removed the log because the format string was never correct in the original error and would result in nonsense like
time="2022-10-05T11:28:48-07:00" level=error msg="the Kubernetes Services [&Service{ObjectMeta:{k8s-service-to-skip1 test-namespace 0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[konghq.com/foo:bar] [] [] []},Spec:ServiceSpec{Ports:[]ServicePort{},Selector:map[string]string{},ClusterIP:,Type:,ExternalIPs:[],SessionAffinity:,LoadBalancerIP:,LoadBalancerSourceRanges:[],ExternalName:,ExternalTrafficPolicy:,HealthCheckNodePort:0,PublishNotReadyAddresses:false,SessionAffinityConfig:nil,IPFamilyPolicy:nil,ClusterIPs:[],IPFamilies:[],AllocateLoadBalancerNodePorts:nil,LoadBalancerClass:nil,InternalTrafficPolicy:nil,},Status:ServiceStatus{LoadBalancer:LoadBalancerStatus{Ingress:[]LoadBalancerIngress{},},Conditions:[]Condition{},},} &Service{ObjectMeta:{k8s-service-to-skip2 test-namespace 0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[] [] [] []},Spec:ServiceSpec{Ports:[]ServicePort{},Selector:map[string]string{},ClusterIP:,Type:,ExternalIPs:[],SessionAffinity:,LoadBalancerIP:,LoadBalancerSourceRanges:[],ExternalName:,ExternalTrafficPolicy:,HealthCheckNodePort:0,PublishNotReadyAddresses:false,SessionAffinityConfig:nil,IPFamilyPolicy:nil,ClusterIPs:[],IPFamilies:[],AllocateLoadBalancerNodePorts:nil,LoadBalancerClass:nil,InternalTrafficPolicy:nil,},Status:ServiceStatus{LoadBalancer:LoadBalancerStatus{Ingress:[]LoadBalancerIngress{},},Conditions:[]Condition{},},}] cannot have different sets of konghq.com annotations. These Services are used in the same Gateway Route BackendRef together to create the Kong Service service-to-skipand must use the same Kong annotations"
We already were logging in the helper, which I didn't notice in the diff. That log does still have issues, but we can't fix them without changing further up the code, and that would potentially interfere with #3008.
Last change was some phrasing and incorrect PR numbers in the changelog.
Approving but leaving unmerged in case you wanted to look over my additional commits.
What this PR does / why we need it:
Gateway routes with conflicting services in their backend don't break config build.
Which issue this PR fixes:
Fixes #2565
Special notes for your reviewer:
PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR