fix: network-partion targets not found and chaos injection failure #758
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.
What this PR does / why we need it:
This PR fixes the pod network partition experiment by removing redundant target pod selection logic and simplifying the network policy creation. The experiment was using both
TARGETS
andPOD_SELECTOR
/NAMESPACE_SELECTOR
for target selection, but only the latter were actually used in network policy creation. Network Partition experiment differs from other chaos experiments as over here, the chaos isn't injected into any workloads. A NetworkPolicy is created to implement this chaos. Hence, usage of functions to fetch list of target pods or environment variables specifying pod names is redundant particularly when we providePOD_SELECTOR
/NAMESPACE_SELECTOR
which is used to filter targets for ingress/egress rules and APP_LABEL for workload selector on which NP will be applied.Which issue this PR fixes : fixes #751
Checklist:
breaking-changes
tagrequires-upgrade
tagChanges Made
Target Selection:
TARGETS
env varPOD_SELECTOR
andNAMESPACE_SELECTOR
Code Cleanup and Improvements:
Documentation:
Environment Variables Used
POD_SELECTOR
: Pod selector for network policy ingress/egress rulesNAMESPACE_SELECTOR
: Namespace selector for network policy ingress/egress rulesAPP_LABEL
: Target pod labels for network partitionPOLICY_TYPES
: Type of network policy (ingress/egress/all)PORTS
: Ports to be used for network partitionTesting Done