-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Pod Priority Class enforcement using Tenant annotations
- Loading branch information
1 parent
ab9357c
commit 0b8b1df
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Enforcing Pod Priority Classes | ||
|
||
> Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. | ||
> If a Pod cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling of the pending Pod possible. | ||
> | ||
> [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/) | ||
In a multi-tenant cluster where not all users are trusted, a tenant owner could create Pods at the highest possible priorities, causing other Pods to be evicted/not get scheduled. | ||
|
||
At the current state, Capsule doesn't have, yet, a CRD key to handle the enforced [Priority Class](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass). | ||
|
||
Enforcement is feasible using the Tenant's annotations field, as following: | ||
|
||
```yaml | ||
apiVersion: capsule.clastix.io/v1alpha1 | ||
kind: Tenant | ||
metadata: | ||
name: oil | ||
annotations: | ||
priorityclass.capsule.clastix.io/allowed: default | ||
priorityclass.capsule.clastix.io/allowed-regex: "^tier-.*$" | ||
spec: | ||
owner: | ||
kind: User | ||
name: alice | ||
``` | ||
With the said Tenant specification Alice can create Pod resource if `spec.priorityClassName` equals to: | ||
|
||
- `default`, as mentioned in the annotation `priorityclass.capsule.clastix.io/allowed` | ||
- `tier-gold`, `tier-silver`, or `tier-bronze`, since these compile the regex declared in the annotation `priorityclass.capsule.clastix.io/allowed-regex` | ||
|
||
If a Pod is going to use a non-allowed _Priority Class_, it will be rejected by the Validation Webhook enforcing it. |