Skip to content

Commit 18012bf

Browse files
authored
docs: Add generated API references to our book (#272)
If crds.dev goes away we have the APIs being generated in our book as well.
1 parent 5b12f2c commit 18012bf

File tree

13 files changed

+44
-4
lines changed

13 files changed

+44
-4
lines changed

api/v1beta1/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
*/
1616

1717
// +k8s:conversion-gen=github.com/oracle/cluster-api-provider-oci/api/v1beta2
18-
18+
// +groupName=infrastructure.cluster.x-k8s.io
1919
package v1beta1

api/v1beta1/groupversion_info.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
// Package v1beta1 contains API Schema definitions for the infrastructure v1beta1 API group
1818
// +kubebuilder:object:generate=true
19-
// +groupName=infrastructure.cluster.x-k8s.io
2019
package v1beta1
2120

2221
import (

api/v1beta2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
limitations under the License.
1515
*/
1616

17+
// +groupName=infrastructure.cluster.x-k8s.io
1718
package v1beta2

api/v1beta2/groupversion_info.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
// Package v1beta2 contains API Schema definitions for the infrastructure v1beta2 API group
1818
// +kubebuilder:object:generate=true
19-
// +groupName=infrastructure.cluster.x-k8s.io
2019
package v1beta2
2120

2221
import (

docs/build.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ os=$(go env GOOS)
2222
arch=$(go env GOARCH)
2323

2424
MDBOOK_VERSION="0.4.21"
25+
genCRDAPIReferenceDocsVersion="11fe95cbdcb91e9c25446fc99e6f2cdd8cbeb91a"
2526

2627
# translate arch to rust's conventions (if we can)
2728
if [[ ${arch} == "amd64" ]]; then
@@ -65,5 +66,22 @@ curl -sL -o /tmp/mdbook.${ext} "https://github.com/rust-lang/mdBook/releases/dow
6566
${cmd} /tmp/mdbook.${ext}
6667
chmod +x /tmp/mdbook
6768

69+
70+
# Generate API docs
71+
genCRDAPIReferenceDocsPath="/tmp/gen-crd-api-reference-docs-${genCRDAPIReferenceDocsVersion}"
72+
genCRDAPIReferenceDocs="${genCRDAPIReferenceDocsPath}/gen-crd-api-reference-docs"
73+
(
74+
cd /tmp
75+
curl --retry 3 -sL -o gen-crd-api-reference-docs.zip "https://github.com/ahmetb/gen-crd-api-reference-docs/archive/${genCRDAPIReferenceDocsVersion}.zip"
76+
unzip -o gen-crd-api-reference-docs.zip
77+
cd "gen-crd-api-reference-docs-${genCRDAPIReferenceDocsVersion}"
78+
go build .
79+
)
80+
81+
${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./api/v1beta1 -out-file ./docs/src/reference/v1beta1-api-raw.html
82+
${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./api/v1beta2 -out-file ./docs/src/reference/v1beta2-api-raw.html
83+
${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./exp/api/v1beta1 -out-file ./docs/src/reference/v1beta1-exp-api-raw.html
84+
${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./exp/api/v1beta2 -out-file ./docs/src/reference/v1beta2-exp-api-raw.html
85+
6886
# Finally build the book.
6987
(cd docs && /tmp/mdbook build)

docs/src/SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@
4141
- [Networking customizations](./managed/networking.md)
4242
- [Reference](./reference/reference.md)
4343
- [API Reference](./reference/api-reference.md)
44+
- [v1beta2 API](./reference/v1beta2-api.md)
45+
- [v1beta2 exp API](./reference/v1beta2-exp-api.md)
46+
- [v1beta1 API](./reference/v1beta1-api.md)
47+
- [v1beta1 exp API](./reference/v1beta1-exp-api.md)
4448
- [Glossary](./reference/glossary.md)
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# API Reference
22

3-
Cluster API Provider for OCI API Reference is published [here](https://doc.crds.dev/github.com/oracle/cluster-api-provider-oci).
3+
Versioned Cluster API Provider for OCI API references is published [here](https://doc.crds.dev/github.com/oracle/cluster-api-provider-oci).
44

5+
You can also find all the APIs in our book. The links are below:
6+
- [v1beta2](./reference/v1beta2-api.md)
7+
- [exp v1beta2](./reference/v1beta2-exp-api.md)
8+
- [v1beta1](./reference/v1beta1-api.md)
9+
- [exp v1beta1](./reference/v1beta1-exp-api.md)

docs/src/reference/v1beta1-api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# v1beta1 API
2+
3+
{{ #include v1beta1-api-raw.html }}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# v1beta1 exp API
2+
3+
{{ #include v1beta1-exp-api-raw.html }}

docs/src/reference/v1beta2-api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# v1beta2 API
2+
3+
{{ #include v1beta2-api-raw.html }}

0 commit comments

Comments
 (0)