-
Notifications
You must be signed in to change notification settings - Fork 19
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
Bug: Refactor NetworkPolicy reconciler #372
Comments
I am interested in solving this issue and as a beginner can you guide me to solve this bug. |
sure @BhavyaBh289. I have assigned this issue to you. Let us know @BhavyaBh289, if you need any help with this issue or you can connect directly with @Rahul-D78 for any discussion on slack channel. |
How Do I start solving this bug and from Where can i get details for the Above And which will be good place to start this ? |
@BhavyaBh289 we can start discussion about the issue. If you are not in slack channel & ping @Rahul-D78 - https://kubernetes.slack.com/team/U023ELMEKM4 he will help you out. |
Hey @BhavyaBh289 first you need to deploy kubeslice on your local cluster. You can refer the official doc page for the installation https://kubeslice.io/documentation/open-source/1.3.0/category/prerequisites Then you can create a slice and you have to made changes in the https://github.com/kubeslice/worker-operator/blob/master/controllers/slice/namespaces.go file. |
Hey @BhavyaBh289 are you still working on the issue ? |
📜 Description
Currently, the NetworkPolicy reconciler is updating the NetworkPolicy resource in the application namespace even if there is no change. It also updates the
slice.Status.NetworkPoliciesInstalled
field to true during each reconciliation interval. And generating events and logs in the for loop.👟 Reproduction steps
Create a slice resource and onboard few application namespaces. You can see logs like
Installed netpol for namespace successfully
andUpdated network policy
very frequently.👍 Expected behavior
It should update the
NetworkPolicy
andSlice
resource conditionally when update is required. And generate the logs and events after the create / update rather than generating inside a for loop.👎 Actual Behavior
Currently the reconciler is performing the update calls to the k8s api server very frequently. Which might impact the performance if the number of resources grows.
🐚 Relevant log output
No response
Version
No response
🖥️ What operating system are you seeing the problem on?
No response
✅ Proposed Solution
The below line can be simlified by checking if the
NetworkPoliciesInstalled
field is false then only set it to true.Before:
After:
Instead of generating log in a for we can generate it after the netpol resource got created for the first time, Currently It is generating logs and event for each iteration for both create and update.
In the
installSliceNetworkPolicyInAppNs
method we are updating the resource in each reconciliation interval, Instead we can get the actual resource if it not found then we can create it else we can compare it with the constructed resource and update it if it not equal. This linelog.Info("Updated network policy", "namespace", appNs)
can be called when there is an update.👀 Have you spent some time to check if this issue has been raised before?
Code of Conduct
The text was updated successfully, but these errors were encountered: