-
Notifications
You must be signed in to change notification settings - Fork 29
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
analyze: start parsing anps and banp from kube server or path #239
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Peac36 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @Peac36. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-network-policy-api ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thank you @Peac36 ! This is a huge help, solving a large missing piece for policy-assistant.
For getting policies from API Server, could we check if ANP/BANP resources are defined before trying to get them? If they do exist, I think it would be more natural to have a panic/fatal if a GET call fails.
Also I'm not sure we need to optimize with concurrent GET calls but wdyt? If we use concurrency, could we simplify that code with sync.WaitGroup or errgroup.Group?
Otherwise, had some thoughts about the k8s interface and miscellaneous nitpicks.
Can you help me with this ? I can not find a way to achieve this. I guess I need to check if ANP and BANP are registered in api-server as CRD but couldn't find a clientset method that can achieve that.
As the user of the command, I should expect to see the information as fast as possible. Till now we executed only one request to the server which was fine, but now we add 2 more or even more. Imagine the kube api-server is slow to respond - it takes about 5 seconds to return a response. So if we run these three requests sequentially - it would take about 15 seconds in which the client will not see anything on the screen. On the other side with concurrency, we might get the result much faster which I'm sure would make the user much happier.
Yeah, sure, I'll need more time to test it. |
/ok-to-test |
I’m not sure off the top of my head, but perhaps there’s an equivalent to kubectl get resources, or get crds? Otherwise, maybe there’s a certain error type returned from kubectl get adminnetworkpolicies when anp doesn’t exist. |
Ok, I found it. I'm ready with the PR, but want to test it more. Do you know where I can find the latest CRD?. The ones in the project seem to be outdated and using one of the example policies yields following error:
|
Nice find! For creating (B)ANPs, can you try this if you haven't already:
The latest CRD is encoded in that install.yaml. I'm also adding some new example (B)ANPs in #245 under examples/. EDIT: assuming you were looking at https://network-policy-api.sigs.k8s.io/getting-started/ ? |
For resource definitions : https://github.com/kubernetes-sigs/network-policy-api/tree/main/config/crd I'm ready with the PR, feel free to look through it. |
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.
Thanks @Peac36 for making those changes and thanks for adding all those nice example policies. I have some minor requests, then I think we can merge
@huntergregory - Thanks for the feedback. The issues have been addressed. |
Issue: #201
@huntergregory - As the requester of the issue can you review the PR?
Notes:
GetNetworkPoliciesInNamespaces
function to accept context as the first argument.GetAdminNetworkPoliciesInNamespace
andGetBaseAdminNetworkPoliciesInNamespace
methodsQuestions:
I wasn't sure if I could add a flag for context timeout so I hardcode it for now. No problem to add if you don't see a problem with that.