Skip to content

Commit 862ee63

Browse files
Add API reference documentation generation
Signed-off-by: alexandre.vilain <[email protected]>
1 parent ca07cfc commit 862ee63

26 files changed

+8566
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ sshuttle.pid
173173

174174
# Book
175175
docs/book/book/
176+
!docs/book/gen-crd-api-reference-docs/config.json
176177

177178
# venv
178179
.venv

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
5252
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
5353
RELEASE_NOTES := $(TOOLS_BIN_DIR)/release-notes
5454
SETUP_ENVTEST := $(TOOLS_BIN_DIR)/setup-envtest
55+
GEN_CRD_API_REFERENCE_DOCS := $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs
56+
57+
# Setup-envtest
58+
SETUP_ENVTEST_VER := v0.0.0-20221201045826-d9912251cd81
59+
SETUP_ENVTEST_BIN := setup-envtest
60+
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
61+
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
5562

5663
# Kubebuilder
5764
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.25.0
@@ -255,6 +262,7 @@ modules: ## Runs go mod to ensure proper vendoring.
255262
generate: ## Generate code
256263
$(MAKE) generate-go
257264
$(MAKE) generate-manifests
265+
$(MAKE) generate-api-docs
258266

259267
.PHONY: generate-go
260268
generate-go: $(MOCKGEN)
@@ -283,6 +291,19 @@ generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
283291
output:rbac:dir=$(RBAC_ROOT) \
284292
rbac:roleName=manager-role
285293

294+
.PHONY: generate-api-docs
295+
generate-api-docs: $(GEN_CRD_API_REFERENCE_DOCS) ## Generate api documentation
296+
$(GEN_CRD_API_REFERENCE_DOCS) \
297+
-api-dir=./api/v1alpha7 \
298+
-config=./docs/book/gen-crd-api-reference-docs/config.json \
299+
-template-dir=./docs/book/gen-crd-api-reference-docs/template \
300+
-out-file=./docs/book/src/api/v1alpha7/api.md
301+
$(GEN_CRD_API_REFERENCE_DOCS) \
302+
-api-dir=./api/v1alpha6 \
303+
-config=./docs/book/gen-crd-api-reference-docs/config.json \
304+
-template-dir=./docs/book/gen-crd-api-reference-docs/template \
305+
-out-file=./docs/book/src/api/v1alpha6/api.md
306+
286307
## --------------------------------------
287308
##@ Docker
288309
## --------------------------------------

api/v1alpha6/doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package v1alpha6 contains API Schema definitions for the infrastructure v1alpha6 API group
18+
// +kubebuilder:object:generate=true
19+
// +groupName=infrastructure.cluster.x-k8s.io
1720
// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7
1821
package v1alpha6

api/v1alpha6/groupversion_info.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// package v1alpha6 contains API Schema definitions for the infrastructure v1alpha6 API group
18-
// +kubebuilder:object:generate=true
19-
// +groupName=infrastructure.cluster.x-k8s.io
2017
package v1alpha6
2118

2219
import (

api/v1alpha6/openstackcluster_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ type OpenStackClusterStatus struct {
212212
FailureMessage *string `json:"failureMessage,omitempty"`
213213
}
214214

215+
// +genclient
216+
// +genclient:Namespaced
215217
// +kubebuilder:object:root=true
216218
// +kubebuilder:resource:path=openstackclusters,scope=Namespaced,categories=cluster-api,shortName=osc
217219
// +kubebuilder:subresource:status

api/v1alpha6/openstackclustertemplate_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ type OpenStackClusterTemplate struct {
4141
Spec OpenStackClusterTemplateSpec `json:"spec,omitempty"`
4242
}
4343

44+
// +genclient
45+
// +genclient:Namespaced
4446
//+kubebuilder:object:root=true
4547

4648
// OpenStackClusterTemplateList contains a list of OpenStackClusterTemplate.

api/v1alpha6/openstackmachine_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ type OpenStackMachineStatus struct {
136136
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
137137
}
138138

139+
// +genclient
140+
// +genclient:Namespaced
139141
// +kubebuilder:object:root=true
140142
// +kubebuilder:resource:path=openstackmachines,scope=Namespaced,categories=cluster-api,shortName=osm
141143
// +kubebuilder:subresource:status

api/v1alpha6/openstackmachinetemplate_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type OpenStackMachineTemplateSpec struct {
2525
Template OpenStackMachineTemplateResource `json:"template"`
2626
}
2727

28+
// +genclient
29+
// +genclient:Namespaced
2830
// +kubebuilder:object:root=true
2931
// +kubebuilder:resource:path=openstackmachinetemplates,scope=Namespaced,categories=cluster-api,shortName=osmt
3032

api/v1alpha7/doc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package v1alpha7 contains API Schema definitions for the infrastructure v1alpha7 API group
18+
// +kubebuilder:object:generate=true
19+
// +groupName=infrastructure.cluster.x-k8s.io
1720
package v1alpha7

api/v1alpha7/groupversion_info.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// package v1alpha7 contains API Schema definitions for the infrastructure v1alpha7 API group
18-
// +kubebuilder:object:generate=true
19-
// +groupName=infrastructure.cluster.x-k8s.io
2017
package v1alpha7
2118

2219
import (

0 commit comments

Comments
 (0)