Skip to content

Commit 0649aa1

Browse files
committed
docs: add CRD v2 reference document
1 parent c521086 commit 0649aa1

File tree

4 files changed

+457
-0
lines changed

4 files changed

+457
-0
lines changed

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ build: manifests generate fmt vet ## Build manager binary.
9797
run: manifests generate fmt vet ## Run a controller from your host.
9898
go run ./cmd/main.go
9999

100+
.PHONY: doc
101+
doc: crd-ref-docs manifests doc-crd-v2 ## Generate documentation for the CRDs.
102+
103+
.PHONY: doc-crd-v2
104+
doc-crd-v2: ## Generate documentation for the `apps.emqx.io/v2` CRD.
105+
$(CRD_REF_DOCS) \
106+
--source-path=api/v2 \
107+
--config=crd-ref-docs-config.yaml \
108+
--output-path=docs/en_US/reference/v2-reference.md \
109+
--renderer=markdown
110+
100111
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
101112
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
102113
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
@@ -178,12 +189,14 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
178189
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
179190
ENVTEST ?= $(LOCALBIN)/setup-envtest
180191
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
192+
CRD_REF_DOCS ?= $(LOCALBIN)/crd-ref-docs
181193

182194
## Tool Versions
183195
KUSTOMIZE_VERSION ?= v5.5.0
184196
CONTROLLER_TOOLS_VERSION ?= v0.18.0
185197
ENVTEST_VERSION ?= release-0.19
186198
GOLANGCI_LINT_VERSION ?= v1.64.8
199+
CRD_REF_DOCS_VERSION ?= latest
187200

188201
.PHONY: kustomize
189202
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -205,6 +218,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
205218
$(GOLANGCI_LINT): $(LOCALBIN)
206219
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
207220

221+
.PHONY: crd-ref-docs
222+
crd-ref-docs: $(CRD_REF_DOCS) ## Download crd-ref-docs locally if necessary.
223+
$(CRD_REF_DOCS): $(LOCALBIN)
224+
$(call go-install-tool,$(CRD_REF_DOCS),github.com/elastic/crd-ref-docs,$(CRD_REF_DOCS_VERSION))
225+
208226
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
209227
# $1 - target path with name of binary
210228
# $2 - package url which can be installed

crd-ref-docs-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
processor:
2+
ignoreFields:
3+
- "TypeMeta$"
4+
ignoreTypes:
5+
- "EMQXList$"
6+
7+
render:
8+
kubernetesVersion: 1.32

docs/en_US/reference/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# API Reference
2+
3+
+ [apps.emqx.io/v2](./v2-reference.md)
4+
+ [apps.emqx.io/v2beta1](./v2beta1-reference.md) (partially deprecated)

0 commit comments

Comments
 (0)