diff --git a/server/handlers/policy_relationship_handler.go b/server/handlers/policy_relationship_handler.go index de281bc35de..6e7d42b288c 100644 --- a/server/handlers/policy_relationship_handler.go +++ b/server/handlers/policy_relationship_handler.go @@ -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 diff --git a/server/meshmodel/kubernetes/policies/hierarchical_inventory.rego b/server/meshmodel/kubernetes/policies/hierarchical_inventory.rego index 577b5c22c33..1df6e7723ce 100644 --- a/server/meshmodel/kubernetes/policies/hierarchical_inventory.rego +++ b/server/meshmodel/kubernetes/policies/hierarchical_inventory.rego @@ -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 _ + # eg: _ + # 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]) } } diff --git a/server/meshmodel/kubernetes/relationships/hierarchical_inventory.json b/server/meshmodel/kubernetes/relationships/hierarchical_inventory.json index e40d11e8573..611d6ef2288 100644 --- a/server/meshmodel/kubernetes/relationships/hierarchical_inventory.json +++ b/server/meshmodel/kubernetes/relationships/hierarchical_inventory.json @@ -115,6 +115,7 @@ "containers", "_", "envFrom", + "0", "configMapRef", "name" ] @@ -136,6 +137,7 @@ "containers", "_", "envFrom", + "0", "configMapRef", "name" ] @@ -157,6 +159,7 @@ "containers", "_", "envFrom", + "0", "configMapRef", "name" ] @@ -178,6 +181,7 @@ "containers", "_", "envFrom", + "0", "configMapRef", "name" ] @@ -197,6 +201,7 @@ "containers", "_", "envFrom", + "0", "configMapRef", "name" ] @@ -218,6 +223,7 @@ "containers", "_", "envFrom", + "0", "configMapRef", "name" ] @@ -241,6 +247,7 @@ "containers", "_", "envFrom", + "0", "configMapRef", "name" ]