-
Notifications
You must be signed in to change notification settings - Fork 331
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(resourcerules): add own mesh to the MeshContext, so it could be successfully resolved #11525
base: master
Are you sure you want to change the base?
fix(resourcerules): add own mesh to the MeshContext, so it could be successfully resolved #11525
Conversation
…uccessfully resolved Signed-off-by: Ilya Lobkov <[email protected]>
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 code looks good but if I understand #11512 the really basic case seems to be broken. We've got here because we missed the test. Can we add it?
// Expand with crossMesh info | ||
otherMeshesByName := map[string]*core_mesh.MeshResource{} | ||
for _, m := range resources.OtherMeshes().GetItems() { | ||
for _, m := range resources.Meshes().GetItems() { | ||
if m.GetMeta().GetName() == meshName { |
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.
Comment to explain we're skipping self
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.
Changed this code to use OtherMeshes(localMesh)
, probably the comment now is less needed.
@@ -146,7 +146,7 @@ func (r Resources) VirtualOutbounds() *core_mesh.VirtualOutboundResourceList { | |||
return r.ListOrEmpty(core_mesh.VirtualOutboundType).(*core_mesh.VirtualOutboundResourceList) | |||
} | |||
|
|||
func (r Resources) OtherMeshes() *core_mesh.MeshResourceList { | |||
func (r Resources) Meshes() *core_mesh.MeshResourceList { |
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.
Why not keep the OtherMeshes
method? That could make code less error prone.
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.
That'd require adding another field like LocalMeshName string
to the Resources struct:
type Resources struct {
MeshLocalResources ResourceMap
CrossMeshResources map[xds.MeshName]ResourceMap
}
Given the fact at this moment we don't have constructor for Resources
it increases the scope of this PR.
I can maybe add method:
func (r Resources) OtherMeshes(localMesh string) *core_mesh.MeshResourceList {
...
}
@lahabana @michaelbeaumont wdyt?
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'd strongly argue for keeping the OtherMeshes
method and adding a new Meshes
method as it would make the change simpler but also makes the API less error prone
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Signed-off-by: Ilya Lobkov <[email protected]>
Checklist prior to review
to[].targetRef: Mesh
doesn't work, even though it shows up in Inspect API #11512syscall.Mkfifo
have equivalent implementation on the other OS --ci/
labels to run additional/fewer testsUPGRADE.md
? --