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

Sort Options ANP/ACNP combine Policy TIER + Policy Priority inside TIER #1388

Closed
derstich opened this issue Oct 15, 2020 · 8 comments
Closed
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@derstich
Copy link

Describe the problem/challenge you have
With “kubectl get acnp” you can sort the policies either by name, tier or priority, but it is not possible to combine TIER Pirority + Policy Priority.
Also sorting by Tier will be done by the tier-name and not tier-priority.

Example:
kubectl get acnp --sort-by=.spec.priority
NAME TIER PRIORITY
PA1 application 10
PA2 application 20
PA3 application 30
PE1 emergency 50
PA3 application 100
PS1 SecurityOps 100
PS2 SecurityOps 101
PA4 application 110
PA5 application 130

As you can see the order is correct regarding priority, but I would like to see the order 1st emergency, 2nd SecurityOps, 3rd application and then priority in each tier.

Describe the solution you'd like
May it’s possible to combine the two values from TIER and Priority in one number.
Example how it can look like:
Tier emergency has prio 5
Policy in emergency has prio 100
Result in Priority can be 5:100

kubectl get acnp --sort-by=.spec.priority
NAME TIER PRIORITY
PE1 emergency 5:50
PS1 SecurityOps 50:100
PS2 SecurityOps 50:101
PA1 application 250:10
PA2 application 250:20

@derstich derstich added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 15, 2020
@abhiraut
Copy link
Contributor

thanks for the report.
kubectl output to sort tiers by priority is straight forward and I will add example to document.

kubectl output to sort policies based on tier and policy priority is not so trivial. Having said that, it is indeed a valuable ask and I will try to get back to you with a solution.

@abhiraut
Copy link
Contributor

one potential solution to this could be to add a new field effectivePriority in Antrea-native policies status sub resource, which the controller patches with the "TierPriority.PolicyPriority" .. and then document that in order to retrieve sorted policies, sort-by on this new field

@Dyanngg
Copy link
Contributor

Dyanngg commented Oct 21, 2020

@abhiraut PolicyPriority is a float. If we want to set something like "TierPriority.PolicyPriority" the effectivePriority needs to be of string type. Not sure if sort-by can work as expected on strings

@abhiraut
Copy link
Contributor

@abhiraut PolicyPriority is a float. If we want to set something like "TierPriority.PolicyPriority" the effectivePriority needs to be of string type. Not sure if sort-by can work as expected on strings

does seem to work on strings on a dry run i did once

@Dyanngg
Copy link
Contributor

Dyanngg commented Oct 21, 2020

@abhiraut PolicyPriority is a float. If we want to set something like "TierPriority.PolicyPriority" the effectivePriority needs to be of string type. Not sure if sort-by can work as expected on strings

does seem to work on strings on a dry run i did once

"3.2.6" > "13.2.5" == true for go string comparison

@abhiraut
Copy link
Contributor

@abhiraut PolicyPriority is a float. If we want to set something like "TierPriority.PolicyPriority" the effectivePriority needs to be of string type. Not sure if sort-by can work as expected on strings

does seem to work on strings on a dry run i did once

"3.2.6" > "13.2.5" == true for go string comparison

maybe some sort of a float normalization using the two priorities. so that the field remains a float and sort on that

@antoninbas
Copy link
Contributor

@Dyanngg I believe we can close this issue?

@Dyanngg
Copy link
Contributor

Dyanngg commented Jan 27, 2021

Yes somehow I did not point the original PR to close this. Thanks for the reminder.

@Dyanngg Dyanngg closed this as completed Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants