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

Commit cbd355c

Browse files
committed
simplifying service creation in quickstart.md -> hrq
Signed-off-by: Zahar Pecherichny <[email protected]>
1 parent 4d2dddb commit cbd355c

File tree

2 files changed

+14
-62
lines changed

2 files changed

+14
-62
lines changed

docs/user-guide/quickstart.md

+11-33
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,12 @@ acme-org
475475
```
476476

477477
You can create a `HierarchicalResourceQuota` in namespace `acme-org`, and the sum of
478-
all subnamespaces resource usage cant go over what is configured in the hrq.
478+
all subnamespaces resource usage can't go over what is configured in the HRQ.
479479

480-
Creating the hrq:
480+
We will demonstrate how it works using services, but you could also limit `cpu`,
481+
`memory` or any other `ResourceQuota` field.
482+
483+
Creating the HRQ:
481484
```bash
482485
kubectl apply -f - << EOF
483486
kind: HierarchicalResourceQuota
@@ -493,38 +496,12 @@ EOF
493496

494497
Lets create Service in namespace `team-a`:
495498
```bash
496-
kubectl apply -f - << EOF
497-
kind: Service
498-
apiVersion: v1
499-
metadata:
500-
name: team-a-svc
501-
namespace: team-a
502-
spec:
503-
selector:
504-
place: holder
505-
ports:
506-
- protocol: TCP
507-
port: 80
508-
targetport: 80
509-
EOF
499+
kubectl create service clusterip team-a-svc --clusterip="None" -n team-a
510500
```
511501

512502
And when we try to create Service in namespace `team-b`:
513503
```bash
514-
kubectl apply -f - << EOF
515-
kind: Service
516-
apiVersion: v1
517-
metadata:
518-
name: team-b-svc
519-
namespace: team-b
520-
spec:
521-
selector:
522-
place: holder
523-
ports:
524-
- protocol: TCP
525-
port: 80
526-
targetport: 80
527-
EOF
504+
kubectl create service clusterip team-b-svc --clusterip="None" -n team-b
528505
```
529506
We get an error:
530507
```
@@ -539,17 +516,18 @@ To view the HRQ usage, simply run:
539516
```bash
540517
kubectl hns hrq -n acme-org
541518
```
542-
you can also view in all namespace:
519+
You can also view in all namespace:
543520
```bash
544521
kubectl hns hrq --all-namespaces
545522
```
546523

547-
and you can delete the hrq via simply deleting the CR:
524+
And you can delete the HRQ via simply deleting the CR:
548525
```bash
549526
kubectl delete hrq acme-org-hrq -n acme-org
550527
```
551528

552-
Note: Decimal point values cannot be specified (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)
529+
Note: Decimal point values cannot be specified (you can't do `cpu: 1.5` but
530+
you can do `cpu: "1.5"` or `cpu: 1500m`). See [#292](https://github.com/kubernetes-sigs/hierarchical-namespaces/issues/292)
553531

554532
<a name="subns"/>
555533

test/e2e/quickstart_test.go

+3-29
Original file line numberDiff line numberDiff line change
@@ -217,39 +217,13 @@ spec:
217217
MustApplyYAML(hrq)
218218

219219
// create service in team-a
220-
serviceA:=`
221-
kind: Service
222-
apiVersion: v1
223-
metadata:
224-
name: `+nsTeamA+`-svc
225-
namespace: `+nsTeamA+`
226-
spec:
227-
selector:
228-
place: holder
229-
ports:
230-
- protocol: TCP
231-
port: 80
232-
targetport: 80`
233-
MustApplyYAML(serviceA)
220+
MustRun("kubectl create service clusterip", nsTeamA + "-svc", `--clusterip="None"`, "-n", nsTeamA)
234221

235222
// show that you can't use resources more than the hrq
236-
serviceB:=`
237-
kind: Service
238-
apiVersion: v1
239-
metadata:
240-
name: `+nsTeamB+`-svc
241-
namespace: `+nsTeamB+`
242-
spec:
243-
selector:
244-
place: holder
245-
ports:
246-
- protocol: TCP
247-
port: 80
248-
targetport: 80`
249-
MustNotApplyYAML(serviceB)
223+
MustNotRun("kubectl create service clusterip", nsTeamB + "-svc", `--clusterip="None"`, "-n", nsTeamB)
250224

251225
// show hrq usage
252-
RunShouldContain("requests.cpu: 0/1, requests.memory: 0/2Gi limits.cpu: 0/2, limits.memory: 0/4Gi, services 1/1", defTimeout, "kubectl hns hrq", "-n", nsOrg)
226+
RunShouldContain("services 1/1", defTimeout, "kubectl hns hrq", "-n", nsOrg)
253227

254228
MustRun("kubectl delete hrq", nsOrg + "-hrq", "-n", nsOrg)
255229
})

0 commit comments

Comments
 (0)