-
Notifications
You must be signed in to change notification settings - Fork 336
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(kuma-cp): implement possibility to select proxies in policies by new kind Dataplane #12573
base: master
Are you sure you want to change the base?
Conversation
… new kind Dataplane Signed-off-by: Marcin Skalski <[email protected]>
Reviewer Checklist🔍 Each of these sections need to be checked by the reviewer of the PR 🔍:
|
@@ -13,6 +13,8 @@ import ( | |||
"github.com/kumahq/kuma/test/framework" | |||
) | |||
|
|||
const secondaryPort = 8080 |
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've purposefully hardcoded this stuff as I wanted something simple, as it is used in single test, we can improve on this in the future if we need some more customizability
Signed-off-by: Marcin Skalski <[email protected]>
} | ||
|
||
func isSelectedByName(dpp *core_mesh.DataplaneResource, ref common_api.TargetRef) bool { | ||
return core_model.GetDisplayName(dpp.GetMeta()) == ref.Name |
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.
name
and namespace
in targetRefs refer to the real name/namespace of the resource, you shouldn't check the displayName, you have to construct ResourceIdentifiers from DPP and from targetRef and see if they're equal (with ==
). See how we handle to[].targetRef
func resolveTargetRef[T interface { |
@@ -162,6 +162,12 @@ func dppSelectedByPolicy( | |||
return inbounds, gwListeners, gateway, nil | |||
} | |||
return []core_rules.InboundListener{}, nil, false, nil | |||
case common_api.Dataplane: |
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 extracted the function that resolves targetRefs to rules_common
package, I think it should be possible to use it for DPPs as it exactly the same approach (the change is not in master
yet):
func ResolveTargetRef(targetRef common_api.TargetRef, tMeta core_model.ResourceMeta, reader ResourceReader) []*ResourceSection { |
Motivation
We want to be able to target proxies by new kind Dataplane. We want to select Dataplanes by name/namespace, by labels and select single inbound by its name
Supporting documentation
This is based on Inbound policies MADR
Fix #12359