Skip to content

Commit e78dea3

Browse files
authored
Fix docs to make copying commands easier (#859)
Problem: Commands and their output were saved in the same block, making it difficult for users to simply copy the commands. Solution: Separate commands and their output into separate blocks in the documentation.
1 parent 3fba53d commit e78dea3

File tree

17 files changed

+191
-123
lines changed

17 files changed

+191
-123
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ The SBOMs for the binaries are available in the releases page. The SBOMs are gen
6767
The SBOM for the Docker image is available in the [GitHub Container](https://github.com/nginxinc/nginx-kubernetes-gateway/pkgs/container/nginx-kubernetes-gateway) repository. The SBOM is generated using [syft](https://github.com/anchore/syft) and stored as an attestation in the image manifest.
6868

6969
For example to retrieve the SBOM for `linux/amd64` and analyze it using [grype](https://github.com/anchore/grype) you can run the following command:
70-
```
71-
$ docker buildx imagetools inspect ghcr.io/nginxinc/nginx-kubernetes-gateway:edge --format '{{ json (index .SBOM "linux/amd64").SPDX }}' | grype
70+
```shell
71+
docker buildx imagetools inspect ghcr.io/nginxinc/nginx-kubernetes-gateway:edge --format '{{ json (index .SBOM "linux/amd64").SPDX }}' | grype
7272
```
7373

7474
## Contacts

conformance/README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111

1212
List available commands:
1313

14-
```bash
15-
$ make
14+
```shell
15+
make
16+
```
1617

18+
```
1719
build-nkg-image Build NKG container and load it and NGINX container on configured kind cluster
1820
build-test-runner-image Build conformance test runner image
1921
cleanup-conformance-tests Clean up conformance tests fixtures
@@ -50,18 +52,18 @@ update-nkg-manifest Update the NKG deployment manifest image name and
5052

5153
### Step 1 - Create a kind Cluster
5254

53-
```bash
54-
$ make create-kind-cluster
55+
```makefile
56+
make create-kind-cluster
5557
```
5658
### Step 2 - Install Nginx Kubernetes Gateway to configured kind cluster
5759

5860
#### *Option 1* Build and install Nginx Kubernetes Gateway from local to configured kind cluster
59-
```bash
60-
$ make install-nkg-local-build
61+
```makefile
62+
make install-nkg-local-build
6163
```
6264
#### *Option 2* Install Nginx Kubernetes Gateway from local already built image to configured kind cluster
63-
```bash
64-
$ make install-nkg-local-no-build
65+
```makefile
66+
make install-nkg-local-no-build
6567
```
6668
**Note:** You can optionally skip the actual *build* step. However, if choosing
6769
this option, the following step *must* be completed manually *before* the build step:
@@ -80,34 +82,36 @@ this option, the following step *must* be completed manually *before* the build
8082
#### *Option 3* Install Nginx Kubernetes Gateway from edge to configured kind cluster
8183
You can also skip the build NKG image step and prepare the environment to instead use the `edge` image
8284

83-
```bash
84-
$ make install-nkg-edge
85+
```makefile
86+
make install-nkg-edge
8587
```
8688

8789
### Step 3 - Build conformance test runner image
88-
```bash
89-
$ make build-test-runner-image
90+
```makefile
91+
make build-test-runner-image
9092
```
9193

9294
### Step 4 - Run Gateway conformance tests
93-
```bash
94-
$ make run-conformance-tests
95+
```makefile
96+
make run-conformance-tests
9597
```
9698

9799
### Step 5 - Cleanup the conformance test fixtures and uninstall Nginx Kubernetes Gateway
98-
```bash
99-
$ make cleanup-conformance-tests
100-
$ make uninstall-nkg
100+
```makefile
101+
make cleanup-conformance-tests
102+
```
103+
```makefile
104+
make uninstall-nkg
101105
```
102106

103107
### Step 6 - Revert changes to the NKG deployment manifest
104108
**Optional** Not required if using `edge` image
105109
**Warning**: `make undo-image-update` will hard reset changes to the deploy/manifests/deployment.yaml file!
106-
```bash
107-
$ make undo-image-update
110+
```makefile
111+
make undo-image-update
108112
```
109113

110114
### Step 7 - Delete kind cluster
111-
```bash
112-
$ make delete-kind-cluster
115+
```makefile
116+
make delete-kind-cluster
113117
```

conformance/provisioner/provisioner.md renamed to conformance/provisioner/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ How to deploy:
2828
1. Follow the [installation](/docs/installation.md) instructions up until the Deploy the NGINX Kubernetes Gateway Step
2929
to deploy prerequisites for both the static mode Deployments and the provisioner.
3030
1. Deploy provisioner:
31-
```
31+
```shell
3232
kubectl apply -f conformance/provisioner/provisioner.yaml
3333
```
3434
1. Confirm the provisioner is running in nginx-gateway namespace:
35-
```
35+
```shell
3636
kubectl get pods -n nginx-gateway
37+
```
38+
```console
3739
NAME READY STATUS RESTARTS AGE
3840
nginx-gateway-provisioner-6c9d9fdcb8-b2pf8 1/1 Running 0 11m
3941
```

design/control-data-plane-separation/design.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ configurations, we can work with them to add bigger config files to the test sui
748748

749749
Config Push Benchmarks:
750750

751-
```bash
751+
```shell
752752
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
753753
BenchmarkNginxConfig/../testdata/configs/bigger/1k.conf-2 1000000000 0.005241 ns/op 0 B/op 0 allocs/op
754754
BenchmarkNginxConfig/../testdata/configs/bigger/2k.conf-2 1000000000 0.01087 ns/op 0 B/op 0 allocs/op
@@ -762,7 +762,7 @@ BenchmarkGetConfigFiles/GetConfigFiles#03-2 1000000000
762762

763763
Config Zip and Unzip Benchmarks:
764764

765-
```bash
765+
```shell
766766
BenchmarkZipConfig/Zip_config../testdata/configs/bigger/1k.conf-2 1000000000 0.0001852 ns/op 0 B/op 0 allocs/op
767767
BenchmarkZipConfig/Zip_config../testdata/configs/bigger/2k.conf-2 1000000000 0.0000663 ns/op 0 B/op 0 allocs/op
768768
BenchmarkZipConfig/Zip_config../testdata/configs/bigger/3k.conf-2 1000000000 0.0000674 ns/op 0 B/op 0 allocs/op

docs/building-the-image.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ Before you can build the NGINX Kubernetes Gateway, make sure you have the follow
1111

1212
1. Clone the repo and change into the `nginx-kubernetes-gateway` directory:
1313

14-
```
14+
```shell
1515
git clone https://github.com/nginxinc/nginx-kubernetes-gateway.git
1616
cd nginx-kubernetes-gateway
1717
```
1818

1919
1. Build the image:
2020

21-
```
21+
```makefile
2222
make PREFIX=myregistry.example.com/nginx-kubernetes-gateway container
2323
```
2424

2525
Set the `PREFIX` variable to the name of the registry you'd like to push the image to. By default, the image will be named `nginx-kubernetes-gateway:edge`.
2626

2727
1. Push the image to your container registry:
2828

29-
```
29+
```shell
3030
docker push myregistry.example.com/nginx-kubernetes-gateway:edge
3131
```
3232

docs/developer/quickstart.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Follow these steps to set up your development environment.
2727
```shell
2828
git clone https://github.com/<YOUR-USERNAME>/nginx-kubernetes-gateway.git
2929
cd nginx-kubernetes-gateway
30+
```
31+
```makefile
3032
make deps
3133
```
3234

@@ -36,7 +38,7 @@ Follow these steps to set up your development environment.
3638

3739
To build the binary, run the make build command from the project's root directory:
3840
39-
```shell
41+
```makefile
4042
make build
4143
```
4244
@@ -46,7 +48,7 @@ This command will build the binary and output it to the `/build/.out` directory.
4648
4749
To build an NGINX Kubernetes Gateway container image from source run the following make command:
4850
49-
```shell
51+
```makefile
5052
make TAG=$(whoami) container
5153
```
5254
@@ -56,7 +58,7 @@ This will build the docker image `nginx-kubernetes-gateway:<your-user>`.
5658
5759
1. Create a `kind` cluster:
5860
59-
```shell
61+
```makefile
6062
make create-kind-cluster
6163
```
6264
@@ -87,7 +89,7 @@ To make sure NKG is running properly, try out the [examples](/examples).
8789
8890
To run all the unit tests, run the make unit-test command from the project's root directory:
8991

90-
```shell
92+
```makefile
9193
make unit-test
9294
```
9395

@@ -101,7 +103,7 @@ To run Gateway API conformance tests, please follow the instructions on [this](/
101103

102104
To lint the code, run the following make command from the project's root directory:
103105
104-
```shell
106+
```makefile
105107
make lint
106108
```
107109

docs/developer/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ promoting efficient refactoring and continuous development.
4444

4545
To run the unit tests, run the make unit-test command from the project's root directory:
4646

47-
```shell
47+
```makefile
4848
make unit-test
4949
```
5050

docs/installation.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,61 @@ This guide walks you through how to install NGINX Kubernetes Gateway on a generi
1212
1313
1. Clone the repo and change into the `nginx-kubernetes-gateway` directory:
1414

15-
```
15+
```shell
1616
git clone https://github.com/nginxinc/nginx-kubernetes-gateway.git
17+
```
18+
```shell
1719
cd nginx-kubernetes-gateway
1820
```
1921

2022
1. Install the Gateway API resources from the standard channel (the CRDs and the validating webhook):
2123

22-
```
24+
```shell
2325
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v0.7.1/standard-install.yaml
2426
```
2527

2628
1. Create the nginx-gateway Namespace:
2729

28-
```
30+
```shell
2931
kubectl apply -f deploy/manifests/namespace.yaml
3032
```
3133

3234
1. Create the njs-modules ConfigMap:
3335

34-
```
36+
```shell
3537
kubectl create configmap njs-modules --from-file=internal/mode/static/nginx/modules/src/httpmatches.js -n nginx-gateway
3638
```
3739

3840
1. Create the ConfigMap with the main NGINX configuration file:
3941

40-
```
42+
```shell
4143
kubectl apply -f deploy/manifests/nginx-conf.yaml
4244
```
4345

4446
1. Configure RBAC:
4547

46-
```
48+
```shell
4749
kubectl apply -f deploy/manifests/rbac.yaml
4850
```
4951

5052
1. Create the GatewayClass resource:
5153

52-
```
54+
```shell
5355
kubectl apply -f deploy/manifests/gatewayclass.yaml
5456
```
5557

5658
1. Deploy the NGINX Kubernetes Gateway:
5759

58-
```
60+
```shell
5961
kubectl apply -f deploy/manifests/deployment.yaml
6062
```
6163

6264
1. Confirm the NGINX Kubernetes Gateway is running in `nginx-gateway` namespace:
6365

64-
```
66+
```shell
6567
kubectl get pods -n nginx-gateway
68+
```
69+
```console
6670
NAME READY STATUS RESTARTS AGE
6771
nginx-gateway-5d4f4c7db7-xk2kq 2/2 Running 0 112s
6872
```
@@ -80,7 +84,7 @@ You can gain access to NGINX Kubernetes Gateway by creating a `NodePort` Service
8084

8185
Create a Service with type `NodePort`:
8286

83-
```
87+
```shell
8488
kubectl apply -f deploy/manifests/service/nodeport.yaml
8589
```
8690

@@ -92,33 +96,33 @@ Create a Service with type `LoadBalancer` using the appropriate manifest for you
9296

9397
- For GCP or Azure:
9498

95-
```
99+
```shell
96100
kubectl apply -f deploy/manifests/service/loadbalancer.yaml
97101
```
98102

99103
Lookup the public IP of the load balancer, which is reported in the `EXTERNAL-IP` column in the output of the following command:
100104

101-
```
105+
```shell
102106
kubectl get svc nginx-gateway -n nginx-gateway
103107
```
104108

105109
Use the public IP of the load balancer to access NGINX Kubernetes Gateway.
106110

107111
- For AWS:
108112

109-
```
113+
```shell
110114
kubectl apply -f deploy/manifests/service/loadbalancer-aws-nlb.yaml
111115
```
112116

113117
In AWS, the NLB DNS name will be reported by Kubernetes in lieu of a public IP in the `EXTERNAL-IP` column. To get the DNS name run:
114118

115-
```
119+
```shell
116120
kubectl get svc nginx-gateway -n nginx-gateway
117121
```
118122

119123
In general, you should rely on the NLB DNS name, however for testing purposes you can resolve the DNS name to get the IP address of the load balancer:
120124

121-
```
125+
```shell
122126
nslookup <dns-name>
123127
```
124128

docs/resource-validation.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ The Kubernetes API server validates Gateway API resources against the OpenAPI sc
5252
For example, if you create an HTTPRoute with an invalid hostname `cafe.!@#$%example.com`, the API server will reject it
5353
with the following error:
5454

55-
```
55+
```shell
5656
kubectl apply -f coffee-route.yaml
57+
```
58+
```
5759
The HTTPRoute "coffee" is invalid: spec.hostnames[0]: Invalid value: "cafe.!@#$%example.com": spec.hostnames[0] in body should match '^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'
5860
```
5961

@@ -67,8 +69,10 @@ It validates Gateway API resources using advanced rules unavailable in the OpenA
6769
you create a Gateway resource with a TCP listener that configures a hostname, the webhook will reject it with the
6870
following error:
6971

70-
```
72+
```shell
7173
kubectl apply -f prod-gateway.yaml
74+
```
75+
```
7276
Error from server: error when creating "prod-gateway.yaml": admission webhook "validate.gateway.networking.k8s.io" denied the request: spec.listeners[1].hostname: Forbidden: should be empty for protocol TCP
7377
```
7478

@@ -84,8 +88,10 @@ performs the validation *after* the Kubernetes API server accepts the resource.
8488
Below is an example of how NKG rejects an invalid resource (a Gateway resource with a TCP listener that configures a
8589
hostname) with a Kubernetes event:
8690

87-
```
91+
```shell
8892
kubectl describe gateway prod-gateway
93+
```
94+
```
8995
. . .
9096
Events:
9197
Type Reason Age From Message
@@ -114,8 +120,10 @@ This step catches the following cases of invalid values:
114120

115121
Below is an example of how NGK rejects an invalid resource. The validation error is reported via the status:
116122

117-
```
123+
```shell
118124
kubectl describe httproutes.gateway.networking.k8s.io coffee
125+
```
126+
```
119127
. . .
120128
Status:
121129
Parents:

0 commit comments

Comments
 (0)