Skip to content

Commit 803d5c7

Browse files
authored
Merge branch 'main' into chore/more-linters
2 parents bb4b406 + f681d8a commit 803d5c7

File tree

17 files changed

+1556
-1
lines changed

17 files changed

+1556
-1
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ jobs:
8181
- name: Check if helm docs are up to date
8282
run: make helm-docs && git diff --exit-code
8383

84+
- name: Check if API docs are up to date
85+
run: make generate-api-docs && git diff --exit-code
86+
8487
unit-tests:
8588
name: Unit Tests
8689
runs-on: ubuntu-22.04

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repos:
3838
- javascript
3939

4040
- repo: https://github.com/golangci/golangci-lint
41-
rev: v1.59.0
41+
rev: v1.59.1
4242
hooks:
4343
- id: golangci-lint-full
4444
name: golangci-lint-root

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ generate-manifests: ## Generate manifests using Helm.
135135
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) --set service.type=NodePort --set service.externalTrafficPolicy="" -n nginx-gateway -s templates/service.yaml > $(strip $(MANIFEST_DIR))/service/nodeport.yaml
136136
helm template nginx-gateway $(CHART_DIR) $(HELM_TEMPLATE_COMMON_ARGS) $(HELM_TEMPLATE_EXTRA_ARGS_FOR_ALL_MANIFESTS_FILE) -n nginx-gateway --api-versions security.openshift.io/v1/SecurityContextConstraints -s templates/scc.yaml > $(strip $(MANIFEST_DIR))/scc.yaml
137137

138+
generate-api-docs: ## Generate API docs
139+
go run github.com/ahmetb/gen-crd-api-reference-docs -config site/config/api/config.json -template-dir site/config/api -out-file site/content/reference/api.md -api-dir "github.com/nginxinc/nginx-gateway-fabric/apis"
140+
138141
.PHONY: clean
139142
clean: ## Clean the build
140143
-rm -r $(OUT_DIR)

apis/v1alpha1/clientsettingspolicy_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
66
)
77

8+
// +genclient
89
// +kubebuilder:object:root=true
910
// +kubebuilder:storageversion
1011
// +kubebuilder:subresource:status

apis/v1alpha1/nginxgateway_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1alpha1
22

33
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
44

5+
// +genclient
56
// +kubebuilder:object:root=true
67
// +kubebuilder:storageversion
78
// +kubebuilder:subresource:status

apis/v1alpha1/nginxproxy_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1alpha1
22

33
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
44

5+
// +genclient
56
// +kubebuilder:object:root=true
67
// +kubebuilder:storageversion
78
// +kubebuilder:resource:categories=nginx-gateway-fabric,scope=Cluster

apis/v1alpha1/observabilitypolicy_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
66
)
77

8+
// +genclient
89
// +kubebuilder:object:root=true
910
// +kubebuilder:storageversion
1011
// +kubebuilder:subresource:status

go.mod

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/nginxinc/nginx-gateway-fabric
33
go 1.22.0
44

55
require (
6+
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0
67
github.com/go-kit/log v0.2.1
78
github.com/go-logr/logr v1.4.2
89
github.com/google/go-cmp v0.6.0
@@ -67,6 +68,7 @@ require (
6768
github.com/pkg/errors v0.9.1 // indirect
6869
github.com/prometheus/client_model v0.6.1 // indirect
6970
github.com/prometheus/procfs v0.12.0 // indirect
71+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
7072
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
7173
go.opentelemetry.io/otel/metric v1.27.0 // indirect
7274
go.opentelemetry.io/otel/sdk v1.27.0 // indirect
@@ -91,6 +93,8 @@ require (
9193
gopkg.in/inf.v0 v0.9.1 // indirect
9294
gopkg.in/yaml.v2 v2.4.0 // indirect
9395
gopkg.in/yaml.v3 v3.0.1 // indirect
96+
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
97+
k8s.io/klog v0.2.0 // indirect
9498
k8s.io/klog/v2 v2.120.1 // indirect
9599
k8s.io/kube-openapi v0.0.0-20240423202451-8948a665c108 // indirect
96100
k8s.io/utils v0.0.0-20240423183400-0849a56e8f22 // indirect

go.sum

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0 h1:+XfOU14S4bGuwyvCijJwhhBIjYN+YXS18jrCY2EzJaY=
2+
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0/go.mod h1:TdjdkYhlOifCQWPs1UdTma97kQQMozf5h26hTuG70u8=
13
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
24
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
35
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
@@ -22,6 +24,7 @@ github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
2224
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
2325
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
2426
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
27+
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
2528
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
2629
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
2730
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -47,10 +50,12 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
4750
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
4851
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
4952
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
53+
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
5054
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
5155
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
5256
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
5357
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
58+
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
5459
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
5560
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
5661
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg=
@@ -69,8 +74,11 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
6974
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
7075
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
7176
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
77+
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
7278
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
7379
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
80+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
81+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
7482
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
7583
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
7684
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
@@ -103,6 +111,7 @@ github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA
103111
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
104112
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
105113
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
114+
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
106115
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
107116
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
108117
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -117,9 +126,12 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k
117126
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
118127
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
119128
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
129+
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
130+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
120131
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
121132
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
122133
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
134+
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
123135
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
124136
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
125137
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
@@ -194,6 +206,7 @@ golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
194206
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
195207
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
196208
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
209+
golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
197210
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
198211
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
199212
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
@@ -213,6 +226,7 @@ google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLp
213226
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
214227
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
215228
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
229+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
216230
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
217231
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
218232
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
@@ -233,6 +247,12 @@ k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U=
233247
k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
234248
k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q=
235249
k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc=
250+
k8s.io/gengo v0.0.0-20201203183100-97869a43a9d9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
251+
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 h1:pWEwq4Asjm4vjW7vcsmijwBhOr1/shsbSYiWXmNGlks=
252+
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
253+
k8s.io/klog v0.2.0 h1:0ElL0OHzF3N+OhoJTL0uca20SxtYt4X4+bzHeqrB83c=
254+
k8s.io/klog v0.2.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
255+
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
236256
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
237257
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
238258
k8s.io/kube-openapi v0.0.0-20240423202451-8948a665c108 h1:Q8Z7VlGhcJgBHJHYugJ/K/7iB8a2eSxCyxdVjJp+lLY=
@@ -249,5 +269,6 @@ sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMm
249269
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
250270
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
251271
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
272+
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
252273
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
253274
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

site/config/api/config.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"hideMemberFields": [
3+
"TypeMeta"
4+
],
5+
"hideTypePatterns": [
6+
"ParseError$",
7+
"List$"
8+
],
9+
"externalPackages": [
10+
{
11+
"typeMatchPrefix": "^k8s\\.io/apimachinery/pkg/apis/meta/v1\\.Duration$",
12+
"docsURLTemplate": "https://pkg.go.dev/k8s.io/apimachinery/pkg/apis/meta/v1#Duration"
13+
},
14+
{
15+
"typeMatchPrefix": "^k8s\\.io/(api|apimachinery/pkg/apis)/",
16+
"docsURLTemplate": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#{{lower .TypeIdentifier}}-{{arrIndex .PackageSegments -1}}-{{arrIndex .PackageSegments -2}}"
17+
},
18+
{
19+
"typeMatchPrefix": "^sigs.k8s.io/gateway-api/apis/",
20+
"docsURLTemplate": "https://pkg.go.dev/sigs.k8s.io/gateway-api/apis/{{arrIndex .PackageSegments -1}}#{{.TypeIdentifier}}"
21+
}
22+
],
23+
"typeDisplayNamePrefixOverrides": {
24+
"k8s.io/api/": "Kubernetes ",
25+
"k8s.io/apimachinery/pkg/apis/": "Kubernetes "
26+
},
27+
"markdownDisabled": false
28+
}

site/config/api/members.tpl

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{{ define "members" }}
2+
3+
{{ range .Members }}
4+
{{ if not (hiddenMember .)}}
5+
<tr>
6+
<td>
7+
<code>{{ fieldName . }}</code><br/>
8+
<em>
9+
{{ if linkForType .Type }}
10+
<a href="{{ linkForType .Type}}">
11+
{{ typeDisplayName .Type }}
12+
</a>
13+
{{ else }}
14+
{{ typeDisplayName .Type }}
15+
{{ end }}
16+
</em>
17+
</td>
18+
<td>
19+
{{ if fieldEmbedded . }}
20+
<p>
21+
(Members of <code>{{ fieldName . }}</code> are embedded into this type.)
22+
</p>
23+
{{ end}}
24+
25+
{{ if isOptionalMember .}}
26+
<em>(Optional)</em>
27+
{{ end }}
28+
29+
{{ safe (renderComments .CommentLines) }}
30+
31+
{{ if and (eq (.Type.Name.Name) "ObjectMeta") }}
32+
Refer to the Kubernetes API documentation for the fields of the
33+
<code>metadata</code> field.
34+
{{ end }}
35+
36+
{{ if or (eq (fieldName .) "spec") }}
37+
<br/>
38+
<br/>
39+
<table class="table table-bordered table-striped">
40+
{{ template "members" .Type }}
41+
</table>
42+
{{ end }}
43+
</td>
44+
</tr>
45+
{{ end }}
46+
{{ end }}
47+
48+
{{ end }}

site/config/api/pkg.tpl

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{{ define "packages" }}
2+
---
3+
title: "API Reference"
4+
description: "NGINX Gateway API Reference"
5+
weight: 100
6+
toc: false
7+
---
8+
9+
{{ with .packages}}
10+
<p>Packages:</p>
11+
<ul>
12+
{{ range . }}
13+
<li>
14+
<a href="#{{- packageAnchorID . -}}">{{ packageDisplayName . }}</a>
15+
</li>
16+
{{ end }}
17+
</ul>
18+
{{ end}}
19+
20+
{{ range .packages }}
21+
<h2 id="{{- packageAnchorID . -}}">
22+
{{- packageDisplayName . -}}
23+
</h2>
24+
25+
{{ with (index .GoPackages 0 )}}
26+
{{ with .DocComments }}
27+
<p>
28+
{{ safe (renderComments .) }}
29+
</p>
30+
{{ end }}
31+
{{ end }}
32+
33+
Resource Types:
34+
<ul>
35+
{{- range (visibleTypes (sortedTypes .Types)) -}}
36+
{{ if isExportedType . -}}
37+
<li>
38+
<a href="{{ linkForType . }}">{{ typeDisplayName . }}</a>
39+
</li>
40+
{{- end }}
41+
{{- end -}}
42+
</ul>
43+
44+
{{ range (visibleTypes (sortedTypes .Types))}}
45+
{{ template "type" . }}
46+
{{ end }}
47+
<hr/>
48+
{{ end }}
49+
50+
<p><em>
51+
Generated with <code>gen-crd-api-reference-docs</code>
52+
</em></p>
53+
54+
{{ end }}

site/config/api/type.tpl

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{{ define "type" }}
2+
3+
<h3 id="{{ anchorIDForType . }}">
4+
{{- .Name.Name }}
5+
{{ if eq .Kind "Alias" }}(<code>{{.Underlying}}</code> alias)</p>{{ end -}}
6+
<a class="headerlink" href="#{{ anchorIDForType . }}" title="Permanent link">¶</a>
7+
</h3>
8+
{{ with (typeReferences .) }}
9+
<p>
10+
(<em>Appears on: </em>
11+
{{- $prev := "" -}}
12+
{{- range . -}}
13+
{{- if $prev -}},{{ end -}}
14+
{{ $prev = . }}
15+
<a href="{{ linkForType . }}">{{ typeDisplayName . }}</a>
16+
{{- end -}}
17+
)
18+
</p>
19+
{{ end }}
20+
21+
22+
<p>
23+
{{ safe (renderComments .CommentLines) }}
24+
</p>
25+
26+
{{ with (constantsOfType .) }}
27+
<table class="table table-bordered table-striped">
28+
<thead>
29+
<tr>
30+
<th>Value</th>
31+
<th>Description</th>
32+
</tr>
33+
</thead>
34+
<tbody>
35+
{{- range . -}}
36+
<tr>
37+
{{- /*
38+
renderComments implicitly creates a <p> element, so we
39+
add one to the display name as well to make the contents
40+
of the two cells align evenly.
41+
*/ -}}
42+
<td><p>{{ typeDisplayName . }}</p></td>
43+
<td>{{ safe (renderComments .CommentLines) }}</td>
44+
</tr>
45+
{{- end -}}
46+
</tbody>
47+
</table>
48+
{{ end }}
49+
50+
{{ if .Members }}
51+
<table class="table table-bordered table-striped">
52+
<thead>
53+
<tr>
54+
<th>Field</th>
55+
<th>Description</th>
56+
</tr>
57+
</thead>
58+
<tbody>
59+
{{ if isExportedType . }}
60+
<tr>
61+
<td>
62+
<code>apiVersion</code><br/>
63+
string</td>
64+
<td>
65+
<code>
66+
{{apiGroup .}}
67+
</code>
68+
</td>
69+
</tr>
70+
<tr>
71+
<td>
72+
<code>kind</code><br/>
73+
string
74+
</td>
75+
<td><code>{{.Name.Name}}</code></td>
76+
</tr>
77+
{{ end }}
78+
{{ template "members" .}}
79+
</tbody>
80+
</table>
81+
{{ end }}
82+
83+
{{ end }}

0 commit comments

Comments
 (0)