Skip to content

Commit ed95c2c

Browse files
authored
feat: Add API doc generation tools and update Makefile (#1459)
- Introduced a new Makefile target `generate-api-docs` to automate API documentation generation using the `crd-ref-docs` tool. - Added a new script `build.sh` for generating API documentation, including configuration for the documentation process. - Created new documentation files for API reference, detailing the Redis API groups and resource types. - Removed the obsolete Redis API documentation index file to streamline the documentation structure. Signed-off-by: yangw <[email protected]>
1 parent fefd300 commit ed95c2c

File tree

6 files changed

+431
-401
lines changed

6 files changed

+431
-401
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
4141
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
4242
KUTTL = $(LOCALBIN)/kuttl-$(KUTTL_VERSION)
4343
KIND = $(LOCALBIN)/kind-$(KIND_VERSION)
44+
CRD_REF_DOCS = $(LOCALBIN)/crd-ref-docs-$(CRD_REF_DOCS_VERSION)
4445

4546
# Tool Versions
4647
KUSTOMIZE_VERSION ?= v5.6.0
@@ -49,6 +50,7 @@ ENVTEST_VERSION ?= release-0.17
4950
GOLANGCI_LINT_VERSION ?= v2.2.2
5051
KUTTL_VERSION ?= 0.15.0
5152
KIND_VERSION ?= v0.24.0
53+
CRD_REF_DOCS_VERSION ?= v0.0.12
5254

5355
# Options for 'bundle-build'
5456
ifneq ($(origin CHANNELS), undefined)
@@ -134,6 +136,11 @@ vet:
134136
generate: controller-gen
135137
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
136138

139+
# Generate API documentation
140+
.PHONY: generate-api-docs
141+
generate-api-docs:
142+
@hack/api-docs/build.sh
143+
137144
# Create a new builder instance for Docker Buildx with the specified platforms and set it as the current builder
138145
.PHONY: docker-create
139146
docker-create:
@@ -169,7 +176,7 @@ bundle-build:
169176

170177
# Rebuild all generated code
171178
.PHONY: codegen
172-
codegen: generate manifests sync-crds generate-dataAssert generate-metricsdocs
179+
codegen: generate manifests sync-crds generate-dataAssert generate-metricsdocs generate-api-docs
173180

174181
# Verify that codegen is up to date.
175182
.PHONY: verify-codegen
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: "API Reference"
3+
linkTitle: "API Reference"
4+
weight: 20
5+
date: 2025-01-27
6+
description: >
7+
API reference
8+
---
9+
10+
This section contains the API reference documentation generated using the `elastic/crd-ref-docs` tool, which provides improved documentation quality and maintenance.
11+
12+
## API Groups Covered
13+
14+
- `redis.redis.opstreelabs.in/v1beta2`
15+
- `rediscluster.redis.opstreelabs.in/v1beta2`
16+
- `redisreplication.redis.opstreelabs.in/v1beta2`
17+
- `redissentinel.redis.opstreelabs.in/v1beta2`
18+
- `common.redis.opstreelabs.in/v1beta2`
19+
20+
## How to Generate
21+
22+
To regenerate this documentation, run:
23+
24+
```bash
25+
make generate-api-docs
26+
```
27+
28+
Or directly:
29+
30+
```bash
31+
hack/api-docs/build.sh
32+
```

0 commit comments

Comments
 (0)