-
Notifications
You must be signed in to change notification settings - Fork 333
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): allow sectionName
and labels
in targetRef
#11819
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Nikolai M <[email protected]>
70c3970
to
4cd048d
Compare
sectionName
and labels
in targetRef
Hey, thanks for the contribution.
I believe it already works that way. @lobkovilya to confirm |
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.
Unfortunately, even though it looks like it's supported, method resolveTargetRef doesn't take SectionName into account.
I added the following input file to pkg/plugins/policies/core/rules/testdata/resourcerules
:
# MeshTimeout with targetRef to the real MeshService resource
type: MeshTimeout
name: matched-for-rules-mt-1
mesh: mesh-1
spec:
targetRef:
kind: Mesh
to:
- targetRef:
kind: MeshService
labels:
env: dev
sectionName: httpport
default:
idleTimeout: 10s
connectionTimeout: 11s
http:
requestTimeout: 12s
---
type: MeshService
name: backend-1
mesh: mesh-1
labels:
env: dev
spec:
selector:
dataplaneTags:
app: backend
ports:
- port: 80
name: httpport
targetPort: 80
appProtocol: http
---
type: MeshService
name: backend-2
mesh: mesh-1
labels:
env: dev
spec:
selector:
dataplaneTags:
app: backend
ports:
- port: 80
targetPort: 80
appProtocol: http
---
type: MeshService
name: backend-3
mesh: mesh-1
labels:
env: prod
spec:
selector:
dataplaneTags:
app: backend
ports:
- port: 80
targetPort: 80
appProtocol: http
and the golden file is not correct.
@jakubdyszkiewicz @lobkovilya Thank you for a review!
@lobkovilya I believe it should be handled by sectionName method. As I understand it, it should return |
TBH I think the problem is in |
Motivation
According to #11572 there's no real reason to have such validation.
However, I didn't get if this part from the issue
If one of the matching meshService doesn't have such a sectionName it should simply not match just like it's already the case for labels.
already works in this way or it needs to be implemented.Implementation information
The change is pretty simple.
Supporting documentation
None