Skip to content

Commit a42c43e

Browse files
authored
docs: gen crd markdown file (#122)
Signed-off-by: ashing <[email protected]>
1 parent 0f34b93 commit a42c43e

File tree

7 files changed

+622
-1
lines changed

7 files changed

+622
-1
lines changed

Makefile

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ GATEAY_API_VERSION ?= v1.2.0
1515
DASHBOARD_VERSION ?= dev
1616
TEST_TIMEOUT ?= 45m
1717

18+
# CRD Reference Documentation
19+
CRD_REF_DOCS_VERSION ?= v0.1.0
20+
CRD_REF_DOCS ?= $(LOCALBIN)/crd-ref-docs
21+
CRD_DOCS_CONFIG ?= docs/crd/config.yaml
22+
CRD_DOCS_OUTPUT ?= docs/crd/api.md
23+
1824
export KUBECONFIG = /tmp/$(KIND_NAME).kubeconfig
1925

2026
# go
@@ -29,7 +35,6 @@ GOBIN=$(shell go env GOPATH)/bin
2935
else
3036
GOBIN=$(shell go env GOBIN)
3137
endif
32-
3338
GOOS ?= linux
3439
GOARCH ?= amd64
3540

@@ -346,3 +351,29 @@ helm-build-crds:
346351
sort-import:
347352
@./scripts/goimports-reviser.sh >/dev/null 2>&1
348353
.PHONY: sort-import
354+
355+
.PHONY: generate-crd-docs
356+
generate-crd-docs: manifests ## Generate CRD reference documentation in a single file
357+
@mkdir -p $(dir $(CRD_DOCS_OUTPUT))
358+
@echo "Generating CRD reference documentation"
359+
@$(CRD_REF_DOCS) \
360+
--source-path=./api \
361+
--config=$(CRD_DOCS_CONFIG) \
362+
--renderer=markdown \
363+
--templates-dir=./docs/template \
364+
--output-path=$(CRD_DOCS_OUTPUT) \
365+
--max-depth=100
366+
@echo "CRD reference documentation generated at $(CRD_DOCS_OUTPUT)"
367+
368+
.PHONY: generate-crd-docs-grouped
369+
generate-crd-docs-grouped: manifests ## Generate CRD reference documentation grouped by API group
370+
@mkdir -p docs/crd/groups
371+
@echo "Generating CRD reference documentation (grouped by API)"
372+
@$(CRD_REF_DOCS) \
373+
--source-path=./api \
374+
--config=$(CRD_DOCS_CONFIG) \
375+
--renderer=markdown \
376+
--templates-dir=./docs/template \
377+
--output-path=docs/crd/groups \
378+
--output-mode=group
379+
@echo "CRD reference documentation generated in docs/crd/groups directory"

0 commit comments

Comments
 (0)