The PSP policy order is explained here: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#policy-order
When adding a new PSP in this PR: https://github.com/kinvolk/terraform-render-bootkube/pull/15/files we hit issues were different policies were used because of the alphabetical order of the PSP names.
Therefore, the name was chosen to be first in alphabetical ordern, but is not quite clear for an Engineer and is very error prone.
We can use a format that starts with a number, like 01-xx, 02-yy, and be sure PSP order is explicit to the engineer writing them.
I think we should rename the policies with numbers to them. The more the privilege of the PSP higher the number.
00-most-restricted.yaml
10-allows-all-capabilities.yaml
.
.
.
80-allows-root-user.yaml
90-everything-is-allowed.yaml
Agree, but maybe leave room for lower policies fur future expansion. I'd not start at 00, but at 10 or higher at least
I think if this is prioritized we can get the state of PSP in lokomotive to a better place.
Personally I'm not fond of numbering things like rules, config files etc. I find it inflexible as you're required to predict in advance things you can't know about ("will I ever need to add a policy between 00 and 01?").
I agree that we shouldn't have arbitrary behavior due to accidental policy selection, however my main question is - can we avoid the need to order altogether? In other words, why do we have a situation where the order matters?
@surajssd this is now done, right? In #293.
It is done but not documented.
I think documentation can be tracked in #1 and #330.
Most helpful comment
Agree, but maybe leave room for lower policies fur future expansion. I'd not start at 00, but at 10 or higher at least