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.
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
eval command support #423
base: support_admin_netpolicy
Are you sure you want to change the base?
eval command support #423
Changes from 5 commits
5e90022
1e8ccce
4d9cc94
3eac6cf
6faec8d
ccb1ea7
3d1b4f6
3d6431a
b171aa6
31ef6cf
20aae29
fedb422
279b759
0f9cdc9
480676e
d5406d1
957e4f0
0f4520a
fa67555
ffdcefc
088cb77
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
if
eval
only supports pods, why adding these resources?If the dir path only contains workload manifests and not pods, how would one infer the pod name for this command?
maybe this should be a separate issue, to extend eval support for workloads, but in this PR can just focus on pods?
the tests automation can add the pods resources and adjust the input, as if those manifests would exist for testing.
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.
not sure understood last sentence;
my tests dir paths contain manifests with StatefulSet workloads (I used replica name as the input of the test (pod name);
The tests failed without adding these cases (my manifests were not inserted to the policy-engine because of the lack of these cases; );
should I revert these changes and create new tests with pods only in the manifests?
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.
for these tests to work, you can add test automation (for eval tests) that add pods resources as if they existed in the manifests.. the changes here better be removed, until eval actually supports such resources, because in the current eval usage workload resources are not supported, and a user cannot infer the pod name to be used in this command when providing only workload resources.
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.
modified and added tests:
command_test.go
: sincecommand-line
needs the "dir" as an argument to execute the cmd;for those tests (which don't contain pods in the manifests), I've generated a "temp dir" which is a copy of the original dir + generated yamls for pods (for the given src + dst arguments) so the command runs on the "temporary dir" successfully.
generating pod yaml for a workload considers also its labels (which may be used in the netpols rules and are essential for computing the result);
eval_test.go
uses the internaleval
funcs, so it works successfully with the original dirs.in this file we had tests from parsed resources (that tests the "eval" functionality) ;
and I have added eval tests from dir paths.
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.
ok, please open a separate issue to consider supporting
eval
with input workloads, not just pods, and also add a comment for this test functionality added here, that it can be removed when thiseval
extension is added.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.
done, new issue #440 ; + comments were added in the relevant files