Supporting gateways from different namespaces #643
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant changes to the
rules/exposure-to-internet-via-istio-ingress/raw.rego
file and related test files to improve the handling of VirtualService and Gateway connections and their exposure to the internet. The most important changes include adding new functions to parse gateway namespaces, modifying the logic for checking namespace consistency, and updating test cases to reflect these changes.Improvements to VirtualService and Gateway handling:
rules/exposure-to-internet-via-istio-ingress/raw.rego
: Addedget_vs_gw_ns
function to parse the namespace and name of gateways from VirtualService specifications, and updated the logic to check if the gateway and VirtualService are in the same namespace. [1] [2]rules/exposure-to-internet-via-istio-ingress/raw.rego
: Modified thedeny[msga]
rule to use the newget_vs_gw_ns
function and adjusted the logic to correctly identify failed paths for VirtualService routes. [1] [2]Updates to test cases:
rules/exposure-to-internet-via-istio-ingress/test/failed_with_beta/expected.json
: Updated expected output to reflect the changes in thedeny[msga]
rule, including the new failed paths format.rules/exposure-to-internet-via-istio-ingress/test/failed_with_beta/gateway.yaml
: Added a new test case for a Gateway resource to validate the updated logic.Various test input files (
deployment.yaml
,gateway.yaml
,istio-gw.yaml
,service.yaml
,vs.yaml
): Added new resources and updated existing ones to ensure comprehensive coverage of the new logic. [1] [2] [3] [4] [5] [6] [7]