Skip to content

Commit 93e54a4

Browse files
authored
Add documentation for Scoped HRQs in user guide (#25)
- Introduced a section on using Scoped HRQs, detailing their purpose and functionality. - Included an example YAML configuration for creating a scoped HRQ. - Clarified the use of the `scopeSelector` field in relation to Kubernetes ResourceQuota. This enhances resource management strategies within namespace hierarchies.
1 parent decec8b commit 93e54a4

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

docs/user-guide/how-to.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,34 @@ teams, and those teams can distribute their resources between their subteams.
202202

203203
Note: Decimal point values cannot be specified in HRQ (you can't do `cpu: 1.5` but you can do `cpu: "1.5"` or `cpu: 1500m`). See [#292](https://github.com/kubernetes-sigs/hierarchical-namespaces/issues/292)
204204

205+
#### Using Scoped HRQs
206+
207+
In addition to regular HRQs that apply to all resources, you can create **scoped HRQs** that only apply to resources matching specific criteria. This enables more sophisticated resource management strategies within a single namespace hierarchy.
208+
209+
- Multiple scoped HRQs can exist in the same namespace hierarchy
210+
- Each scoped HRQ operates independently and only affects matching resources
211+
212+
**Creating a scoped HRQ:**
213+
214+
```yaml
215+
apiVersion: hnc.x-k8s.io/v1alpha2
216+
kind: HierarchicalResourceQuota
217+
metadata:
218+
name: production-workloads
219+
namespace: team-namespace
220+
spec:
221+
hard:
222+
cpu: "20"
223+
memory: "40Gi"
224+
scopeSelector:
225+
matchExpressions:
226+
- operator: In
227+
scopeName: PriorityClass
228+
values: ["production"]
229+
```
230+
231+
The `scopeSelector` field works exactly like the standard Kubernetes ResourceQuota `scopeSelector`. For details on available scopes and configuration options, see the [Kubernetes ResourceQuota documentation](https://kubernetes.io/docs/concepts/policy/resource-quotas/#quota-scopes).
232+
205233
<a name="use-select"/>
206234

207235
### Select namespaces based on their hierarchies
@@ -980,4 +1008,4 @@ Interesting parameters include:
9801008
exclude an object from propagation.
9811009
* Rancher objects that have the label `cattle.io/creator=norman` are not propagated
9821010
by the default manifests (refer to [Concepts: built in exceptions](concepts.md#built-in-exceptions)
983-
for more information).
1011+
for more information).

0 commit comments

Comments
 (0)