Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add generated API references to our book #272

Merged
merged 2 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/v1beta1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
*/

// +k8s:conversion-gen=github.com/oracle/cluster-api-provider-oci/api/v1beta2

// +groupName=infrastructure.cluster.x-k8s.io
package v1beta1
1 change: 0 additions & 1 deletion api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.

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

import (
Expand Down
1 change: 1 addition & 0 deletions api/v1beta2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
limitations under the License.
*/

// +groupName=infrastructure.cluster.x-k8s.io
package v1beta2
1 change: 0 additions & 1 deletion api/v1beta2/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.

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

import (
Expand Down
18 changes: 18 additions & 0 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ os=$(go env GOOS)
arch=$(go env GOARCH)

MDBOOK_VERSION="0.4.21"
genCRDAPIReferenceDocsVersion="11fe95cbdcb91e9c25446fc99e6f2cdd8cbeb91a"

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


# Generate API docs
genCRDAPIReferenceDocsPath="/tmp/gen-crd-api-reference-docs-${genCRDAPIReferenceDocsVersion}"
genCRDAPIReferenceDocs="${genCRDAPIReferenceDocsPath}/gen-crd-api-reference-docs"
(
cd /tmp
curl --retry 3 -sL -o gen-crd-api-reference-docs.zip "https://github.com/ahmetb/gen-crd-api-reference-docs/archive/${genCRDAPIReferenceDocsVersion}.zip"
unzip -o gen-crd-api-reference-docs.zip
cd "gen-crd-api-reference-docs-${genCRDAPIReferenceDocsVersion}"
go build .
)

${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./api/v1beta1 -out-file ./docs/src/reference/v1beta1-api-raw.html
${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./api/v1beta2 -out-file ./docs/src/reference/v1beta2-api-raw.html
${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
${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

# Finally build the book.
(cd docs && /tmp/mdbook build)
4 changes: 4 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@
- [Networking customizations](./managed/networking.md)
- [Reference](./reference/reference.md)
- [API Reference](./reference/api-reference.md)
- [v1beta2 API](./reference/v1beta2-api.md)
- [v1beta2 exp API](./reference/v1beta2-exp-api.md)
- [v1beta1 API](./reference/v1beta1-api.md)
- [v1beta1 exp API](./reference/v1beta1-exp-api.md)
- [Glossary](./reference/glossary.md)
7 changes: 6 additions & 1 deletion docs/src/reference/api-reference.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# API Reference

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

You can also find all the APIs in our book. The links are below:
- [v1beta2](./reference/v1beta2-api.md)
- [exp v1beta2](./reference/v1beta2-exp-api.md)
- [v1beta1](./reference/v1beta1-api.md)
- [exp v1beta1](./reference/v1beta1-exp-api.md)
3 changes: 3 additions & 0 deletions docs/src/reference/v1beta1-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v1beta1 API

{{ #include v1beta1-api-raw.html }}
3 changes: 3 additions & 0 deletions docs/src/reference/v1beta1-exp-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v1beta1 exp API

{{ #include v1beta1-exp-api-raw.html }}
3 changes: 3 additions & 0 deletions docs/src/reference/v1beta2-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v1beta2 API

{{ #include v1beta2-api-raw.html }}
3 changes: 3 additions & 0 deletions docs/src/reference/v1beta2-exp-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v1beta2 exp API

{{ #include v1beta2-exp-api-raw.html }}
joekr marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions exp/api/v1beta1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ limitations under the License.
*/

// +k8s:conversion-gen=github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2
// +groupName=infrastructure.cluster.x-k8s.io

package v1beta1
1 change: 1 addition & 0 deletions exp/api/v1beta2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

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