Skip to content
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

Policy name randomizer for network-policy #678

Merged
merged 2 commits into from
Mar 14, 2023
Merged

Policy name randomizer for network-policy #678

merged 2 commits into from
Mar 14, 2023

Conversation

seswarrajan
Copy link
Contributor

@seswarrajan seswarrajan commented Mar 6, 2023

Problem Statement

Discovery-engine discovers both system and network. For system policies, the policy name is created based on hash of certain policy fields which are unique. Hence on multiple reboots/restarts of DE, the policy name remains the same.

In case of network policy, the name is based on randomizer. Which is causing the duplicate policies being written to policy_yaml in SaaS's DB.

Solution

Adding hash based naming mechanism similar to system policy resolves this issue.

PR

This PR contains the randomization based on unique fields of a policy.

Signed-off-by: Eswar Rajan Subramanian eswar@accuknox.com

Create policy name using hash method same as system-policy

Signed-off-by: Eswar Rajan Subramanian <eswar@accuknox.com>
Copy link
Contributor

@wazir-ahmed wazir-ahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the patch looks good to me.

Copy link
Contributor

@nyrahul nyrahul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

Co-authored-by: Wazir Ahmed <wazir@accuknox.com>
@seswarrajan seswarrajan merged commit 1babda3 into accuknox:dev Mar 14, 2023
Ankurk99 pushed a commit to Ankurk99/auto-policy-discovery that referenced this pull request Mar 20, 2023
* Policy name randomizer using hash method for network-policy

Signed-off-by: Eswar Rajan Subramanian <eswar@accuknox.com>
Co-authored-by: Wazir Ahmed <wazir@accuknox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants