Skip to content

Commit

Permalink
Add extended API docs generator
Browse files Browse the repository at this point in the history
Add gen-crd-api-reference-docs utility into build-image, generate
Agones CRD reference html document, map this doc to existent docs
structure.
  • Loading branch information
aLekSer committed Mar 14, 2019
1 parent b133e52 commit 4fa7575
Show file tree
Hide file tree
Showing 5 changed files with 2,302 additions and 1 deletion.
5 changes: 5 additions & 0 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ RUN cargo install grpcio-compiler --vers 0.3.0
RUN go get -u github.com/golang/dep/cmd/dep && \
go get -u golang.org/x/tools/cmd/goimports

# install API reference docs generator
RUN export GO111MODULE=on && mkdir -p /go/src/github.com/ahmetb && \
cd /go/src/github.com/ahmetb && git clone https://github.com/ahmetb/gen-crd-api-reference-docs && \
cd ./gen-crd-api-reference-docs && go build

# install golang-ci linter
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.15.0

Expand Down
17 changes: 17 additions & 0 deletions build/includes/website.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@
# Website targets
#

REL_PATH := content/en/docs/Reference/agones_crd_api_reference.html
GEN_API_DOCS ?= docker run -e FILE="$(mount_path)/site/$(REL_PATH)" -e VERSION=${base_version} --rm -i $(common_mounts) $(build_tag) bash -c "/go/src/agones.dev/agones/site/gen-api-docs.sh"

# generate Agones CRD reference docs
gen-api-docs: ensure-build-image
$(GEN_API_DOCS)

# test generated Agones CRD reference docs
test-gen-api-docs: expected_docs := $(site_path)/$(REL_PATH)
test-gen-api-docs: ensure-build-image
cp $(expected_docs) /tmp/generated.html
sort /tmp/generated.html > /tmp/generated.html.sorted
$(GEN_API_DOCS)
sort $(expected_docs) > /tmp/result.sorted
diff -bB /tmp/result.sorted /tmp/generated.html.sorted

# generate the latest website
site-server: ARGS ?=-F
site-server: ENV ?= RELEASE_VERSION="$(base_version)" RELEASE_BRANCH=master
Expand Down Expand Up @@ -59,6 +75,7 @@ site-deploy-preview: site-static-preview

site-test:
# generate actual html and run test against - provides a more accurate tests
$(MAKE) test-gen-api-docs
$(MAKE) site-static-preview
docker run --rm -t -e "TERM=xterm-256color" $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) bash -c \
"mkdir -p /tmp/website && cp -r $(mount_path)/site/public /tmp/website/site && htmltest -c $(mount_path)/site/htmltest.yaml /tmp/website"
6 changes: 5 additions & 1 deletion site/content/en/docs/Guides/access-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ description: >
---

Installing Agones creates several [Custom Resource Definitions (CRD)](https://kubernetes.io/docs/concepts/api-extension/custom-resources),
which can be accessed and manipulated through the Kubernetes API.
which can be accessed and manipulated through the Kubernetes API.

{{% feature publishVersion="0.9.0" %}}
The detailed list of Agones CRDs with their parameters could be found here - [Agones CRD API Reference](../../reference/agones_crd_api_reference).
{{% /feature %}}

Kubernetes has multiple [client libraries](https://kubernetes.io/docs/reference/using-api/client-libraries/), however,
at time of writing, only
Expand Down
Loading

0 comments on commit 4fa7575

Please sign in to comment.