Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 5609d97

Browse files
committed
Added example doc for "kubectl get hrq"
Signed-off-by: Zahar Pecherichny <[email protected]>
1 parent b171aba commit 5609d97

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

docs/user-guide/concepts.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,14 @@ the most restrictive quota always wins.
277277
This way each individual can fairly and securely distribute their resources across
278278
their members.
279279

280+
You can create the HRQ `CustomResource` by simply applying a yaml file, and see usage via `kubectl hns hrq` or `kubectl get hrq` see
281+
[quickstart example](quickstart.md#hrq) for reference.
282+
283+
280284
To implement hierarchical quotas, HNC automatically creates `ResourceQuota` objects in each
281285
affected namespace. This is a part of the internal implementation and shouldn't be modified or
282286
inspected. Use the `kubectl hns hrq` command to inspect hierarchical quotas,
283-
or look at the `HierarchicalResourceQuota` object in the ancestor
284-
namespaces.
287+
or look at the `HierarchicalResourceQuota` object in the ancestor namespaces.
285288

286289
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)
287290

docs/user-guide/quickstart.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ namespaces:
343343

344344
```bash
345345
kubectl apply -f - << EOF
346-
kind: NetworkPolicy
347346
apiVersion: networking.k8s.io/v1
347+
kind: NetworkPolicy
348348
metadata:
349349
name: deny-from-other-namespaces
350350
namespace: acme-org
@@ -396,8 +396,8 @@ that is automatically added by the HNC.
396396

397397
```bash
398398
kubectl apply -f - << EOF
399-
kind: NetworkPolicy
400399
apiVersion: networking.k8s.io/v1
400+
kind: NetworkPolicy
401401
metadata:
402402
name: allow-team-a
403403
namespace: team-a
@@ -485,8 +485,8 @@ We will demonstrate how it works using services, but you could also limit `cpu`,
485485
Creating the HRQ:
486486
```bash
487487
kubectl apply -f - << EOF
488-
kind: HierarchicalResourceQuota
489488
apiVersion: hnc.x-k8s.io/v1alpha2
489+
kind: HierarchicalResourceQuota
490490
metadata:
491491
name: acme-org-hrq
492492
namespace: acme-org
@@ -514,16 +514,18 @@ Error from server (Forbidden):
514514
"acme-org-hrq", requested: services=1, used: services=1, limited: services=1
515515
```
516516

517-
To view the HRQ usage, simply run:
517+
You can view the HRQ usage by running `kubectl hns hrq` or `kubectl get hrq`:
518518
```bash
519-
kubectl hns hrq -n acme-org
519+
kubectl get hrq -n acme-org
520520
```
521-
You can also view in all namespace:
521+
Should give:
522522
```bash
523-
kubectl hns hrq --all-namespaces
523+
NAME REQUEST LIMIT
524+
acme-org services: 1/1
524525
```
526+
You can also view HRQs in all namespaces by running `kubectl get hrq -A`.
525527

526-
And you can delete the HRQ via simply deleting the CR:
528+
And finally you can delete the HRQ via simply deleting the CR:
527529
```bash
528530
kubectl delete hrq acme-org-hrq -n acme-org
529531
```

test/e2e/quickstart_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ var _ = Describe("Quickstart", func() {
128128

129129
// create a default network policy in the root namespace that blocks any ingress from other namespaces
130130
policy := `# quickstart_test.go: netpol to block access across namespaces
131-
kind: NetworkPolicy
132131
apiVersion: networking.k8s.io/v1
132+
kind: NetworkPolicy
133133
metadata:
134134
name: deny-from-other-namespaces
135135
namespace: acme-org
@@ -169,8 +169,8 @@ spec:
169169
// communicate with each other, and wait for it to be propagated to the descendant we want to
170170
// test.
171171
policy = `# quickstart_test.go: netpol to allow communication within team-a subtree
172-
kind: NetworkPolicy
173172
apiVersion: networking.k8s.io/v1
173+
kind: NetworkPolicy
174174
metadata:
175175
name: allow-team-a
176176
namespace: team-a
@@ -206,8 +206,8 @@ spec:
206206

207207
// create hrq in parent acme-org
208208
hrq:=`# quickstart_test.go: hrq in acme-org
209-
kind: HierarchicalResourceQuota
210209
apiVersion: hnc.x-k8s.io/v1alpha2
210+
kind: HierarchicalResourceQuota
211211
metadata:
212212
name: acme-org-hrq
213213
namespace: acme-org
@@ -223,7 +223,7 @@ spec:
223223
MustNotRun("kubectl create service clusterip", nsTeamB + "-svc", "--clusterip=None", "-n", nsTeamB)
224224

225225
// show hrq usage
226-
RunShouldContain("services: 1/1", defTimeout, "kubectl hns hrq", "-n", nsOrg)
226+
RunShouldContain("services: 1/1", defTimeout, "kubectl get hrq", "-n", nsOrg)
227227

228228
MustRun("kubectl delete hrq", nsOrg + "-hrq", "-n", nsOrg)
229229
})

0 commit comments

Comments
 (0)