Skip to content

Commit

Permalink
Merge pull request meshery#10218 from MUzairS15/MUzairS15/opa/invento…
Browse files Browse the repository at this point in the history
…ry/chaining

[Relationship] Support chaining of inventory items.
  • Loading branch information
MUzairS15 authored Feb 5, 2024
2 parents 5d45a87 + 86bd9b4 commit 28a35c4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions server/handlers/policy_relationship_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ func (h *Handler) EvaluateRelationshipPolicy(
}
evalresults[query] = result
}
// Before starting the eval the design is de-prettified, so that we can use the relationships def correctly.
// The results contain the updated config.
// Prettify the results before sending it to client.
evalResults = core.Format.Prettify(evalresults, false)

// write the response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ heirarchical_inventory_relationship[updated_comps] {

allowed_component.traits.meshmap["meshmodel-metadata"].parentId == i
updated_comp := apply_patch(allowed_component, service, from_selectors, to_selectors)
id := updated_comp.traits.meshmap.id
# The id is the combination of the <id of the node from which the config was patched>_<id of the node from which the config was patched>
# eg: <configmap node id>_<deployment_node_id>
# The client interceptor should rely on the id present in the traits only and hsould not bother to parse the above id, the above id is included to provided more context.
id := sprintf("%s_%s", [j, i])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"containers",
"_",
"envFrom",
"0",
"configMapRef",
"name"
]
Expand All @@ -136,6 +137,7 @@
"containers",
"_",
"envFrom",
"0",
"configMapRef",
"name"
]
Expand All @@ -157,6 +159,7 @@
"containers",
"_",
"envFrom",
"0",
"configMapRef",
"name"
]
Expand All @@ -178,6 +181,7 @@
"containers",
"_",
"envFrom",
"0",
"configMapRef",
"name"
]
Expand All @@ -197,6 +201,7 @@
"containers",
"_",
"envFrom",
"0",
"configMapRef",
"name"
]
Expand All @@ -218,6 +223,7 @@
"containers",
"_",
"envFrom",
"0",
"configMapRef",
"name"
]
Expand All @@ -241,6 +247,7 @@
"containers",
"_",
"envFrom",
"0",
"configMapRef",
"name"
]
Expand Down

0 comments on commit 28a35c4

Please sign in to comment.