-
Notifications
You must be signed in to change notification settings - Fork 337
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
feat(rules): support Labels with SectionName in ResolveTargetRef function #12743
base: master
Are you sure you want to change the base?
feat(rules): support Labels with SectionName in ResolveTargetRef function #12743
Conversation
…unction Signed-off-by: Ilya Lobkov <[email protected]>
Reviewer Checklist🔍 Each of these sections need to be checked by the reviewer of the PR 🔍:
|
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.
Just Qs
@@ -136,7 +163,7 @@ func parseService(host string) (string, string, uint32, error) { | |||
case 3: | |||
// service less service names have no port, so we just put the reserved | |||
// one here to note that this service is actually | |||
port = mesh_proto.TCPPortReserved | |||
port = 0 |
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.
this seems unrelated 🤔
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.
The function parseService
was copied from here outbound_converter.go. When a port is not specified, i.e. backend_kuma-demo_svc
it returned reserved port value 49151
.
I don't really know why we need this reserved value in outbound_converter.go
, but in resolvedtargetref.go
I didn't want to introduce extra handling of special values especially when value 0
works perfectly fine for this case. Otherwise, I'd have to add here something like
- if q.port == 0 && q.sectionName == "" {
+ if (q.port == 0 || q.port == mesh_proto.TCPPortReserved) && q.sectionName == "" {
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.
should we somehow document that it was copied? or maybe we should make it DRY?
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Motivation
It's a valid use case to use both
Labels
andSectionName
into[].targetRef
.Implementation information