Skip to content

docs: add api reference doc#996

Closed
zirain wants to merge 1 commit intoenvoyproxy:mainfrom
zirain:apidocs
Closed

docs: add api reference doc#996
zirain wants to merge 1 commit intoenvoyproxy:mainfrom
zirain:apidocs

Conversation

@zirain
Copy link
Copy Markdown
Member

@zirain zirain commented Feb 8, 2023

Signed-off-by: hejianpeng hejianpeng2@huawei.com

Fixes #965

cc @arkodg @danehans

Signed-off-by: hejianpeng <hejianpeng2@huawei.com>
@zirain zirain mentioned this pull request Feb 8, 2023
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #996 (da082b3) into main (7639637) will decrease coverage by 0.17%.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #996      +/-   ##
==========================================
- Coverage   62.19%   62.02%   -0.17%     
==========================================
  Files          55       55              
  Lines        8779     8804      +25     
==========================================
+ Hits         5460     5461       +1     
- Misses       2951     2969      +18     
- Partials      368      374       +6     
Impacted Files Coverage Δ
internal/xds/translator/runner/runner.go 75.67% <0.00%> (-10.54%) ⬇️
internal/xds/translator/ratelimit.go 93.33% <0.00%> (-2.78%) ⬇️
internal/gatewayapi/filters.go 79.57% <0.00%> (-0.79%) ⬇️
internal/infrastructure/kubernetes/service.go 40.81% <0.00%> (-0.57%) ⬇️
internal/provider/kubernetes/controller.go 50.00% <0.00%> (-0.34%) ⬇️
internal/gatewayapi/runner/runner.go 28.26% <0.00%> (-0.32%) ⬇️
internal/xds/translator/authentication.go 63.27% <0.00%> (-0.10%) ⬇️
internal/gatewayapi/translator.go 97.10% <0.00%> (ø)
internal/xds/translator/translator.go 76.12% <0.00%> (ø)
internal/infrastructure/kubernetes/infra.go 27.63% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Copy Markdown
Contributor

@danehans danehans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zirain I tested this PR and get the following error when calling the make target:

$ make docs.apireference
===========> Running docs.apireference ...
tools/hack/gen-api-doc.sh
I0208 09:50:54.886138   28238 main.go:129] parsing go packages in directory github.com/envoyproxy/gateway/api/v1alpha1/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13fbc94]

goroutine 1 [running]:
k8s.io/gengo/parser.(*Builder).AddDirRecursive(0xc0001655e0, {0x7ff7bfeff08a, 0x2b})
	/Users/daneyonhansen/go/pkg/mod/k8s.io/gengo@v0.0.0-20201203183100-97869a43a9d9/parser/parse.go:234 +0x114
main.parseAPIPackages({0x7ff7bfeff08a?, 0x2b?})
	/Users/daneyonhansen/go/pkg/mod/github.com/ahmetb/gen-crd-api-reference-docs@v0.3.0/main.go:203 +0x49
main.main()
	/Users/daneyonhansen/go/pkg/mod/github.com/ahmetb/gen-crd-api-reference-docs@v0.3.0/main.go:130 +0x208
make[1]: *** [docs.apireference] Error 2
make: *** [_run] Error 2

When I update -api-dir in the script to "./api/v1alpha1/" and "./api/config/v1alpha1", I get the following error:

$ make docs.apireference
===========> Running docs.apireference ...
tools/hack/gen-api-doc.sh
I0208 09:51:51.164235   28809 main.go:129] parsing go packages in directory ./api/v1alpha1/
I0208 09:51:51.175542   28809 main.go:231] using package=github.com/envoyproxy/gateway/api/v1alpha1
F0208 09:51:51.197337   28809 main.go:503] type invalid type has kind=Unsupported which is unhandled
make[1]: *** [docs.apireference] Error 255
make: *** [_run] Error 2

},
{
"typeMatchPrefix": "^k8s\\.io/(api|apimachinery/pkg/apis)/",
"docsURLTemplate": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#{{lower .TypeIdentifier}}-{{arrIndex .PackageSegments -1}}-{{arrIndex .PackageSegments -2}}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not v1.26?

$(call log, "Updated: docs/$(TAG)/user/$$DOC") ; \
done

.PHONY: docs.apireference
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename to doc-api and add this to the docs target? For example:

docs: docs.clean $(tools/sphinx-build) docs-api ## Generate Envoy Gateway Docs Sources

.PHONY: docs.apireference
docs.apireference: $(tools/gen-crd-api-reference-docs)
@$(LOG_TARGET)
tools/hack/gen-api-doc.sh No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line.

</table>
{{ end }}

{{ end }} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line.

{{ with .gitCommit }} on git commit <code>{{ . }}</code>{{end}}.
</em></p>

{{ end }} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line.


package ignore

import "github.com/ahmetb/gen-crd-api-reference-docs" No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line.

@danehans
Copy link
Copy Markdown
Contributor

danehans commented Feb 8, 2023

To fix lint errors:

diff --git a/tools/hack/gen-api-doc.sh b/tools/hack/gen-api-doc.sh
index 79c8f1f2..21dbaa34 100755
--- a/tools/hack/gen-api-doc.sh
+++ b/tools/hack/gen-api-doc.sh
@@ -6,16 +6,17 @@ set -o pipefail

 GOPATH=${GOPATH:-$(go env GOPATH)}

-readonly HERE=$(cd $(dirname $0) && pwd)
-readonly REPO=$(cd ${HERE}/../.. && pwd)
+readonly DIR=${DIR:-$(dirname "$0")}
+readonly HERE=${HERE:-$(cd "$DIR" && pwd)}
+readonly REPO=${REPO:-$(cd "${HERE}/../.." && pwd)}

 # Exec the doc generator.
 gendoc() {
-    local readonly CFG_DIR="${REPO}/tools/api-docs"
+    local CFG_DIR="${REPO}/tools/api-docs"

     tools/bin/gen-crd-api-reference-docs \
-        -template-dir ${CFG_DIR} \
-        -config ${CFG_DIR}/config.json \
+        -template-dir "${CFG_DIR}" \
+        -config "${CFG_DIR}/config.json" \
         "$@"
 }

@zirain
Copy link
Copy Markdown
Member Author

zirain commented Feb 9, 2023

#980 is better, close this.

@zirain zirain closed this Feb 9, 2023
@zirain zirain deleted the apidocs branch February 23, 2023 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTML generated docs for Gateway API Extensions

3 participants