Skip to content

Commit 16e63ba

Browse files
authored
Add mdbook skeleton (#426)
1 parent 6c334dc commit 16e63ba

25 files changed

+308
-65
lines changed

common.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
include $(ROOT_DIR_RELATIVE)/versions.mk
23

34
TOOLS_DIR := $(ROOT_DIR_RELATIVE)/hack/tools
45
TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile

docs/book/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
book

docs/book/Makefile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright 2021 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ROOT_DIR_RELATIVE := ../..
16+
include $(ROOT_DIR_RELATIVE)/common.mk
17+
18+
# Directories.
19+
MDBOOK := $(TOOLS_BIN_DIR)/mdbook
20+
MDBOOK_EMBED := $(TOOLS_BIN_DIR)/mdbook-embed
21+
MDBOOK_RELEASELINK := $(TOOLS_BIN_DIR)/mdbook-releaselink
22+
MDBOOK_TABULATE := $(TOOLS_BIN_DIR)/mdbook-tabulate
23+
GENCRDAPIREFERENCEDOCS := $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs
24+
GENCRDAPIREFERENCEDOCS_SRCS := $(call rwildcard,.,gen-crd-api-reference-docs/*.*)
25+
CRD_DOCS := src/crd/cluster-api-aws.md src/crd/experimental.md src/crd/eks-control-plane.md
26+
BOOK_SRCS := $(filter-out $(CRD_DOCS), $(call rwildcard,.,*.*))
27+
28+
API_DIRS := cmd/clusterawsadm/api/bootstrap/v1beta1 api/v1beta1 exp/api/v1beta1 controlplane/eks/api/v1beta1 bootstrap/eks/api/v1beta1 iam/api/v1beta1
29+
API_SRCS := $(foreach dir, $(API_DIRS), $(call rwildcard,../../$(dir),*.go))
30+
GENERATED_SRCS := $(foreach dir, $(API_DIRS),../../$(dir)/zz_generated.deepcopy.go ../../$(dir)/zz_generated.conversion.go ../../$(dir)/zz_generated.defaults.go)
31+
API_FILTERED_SRCS := $(filter-out $(GENERATED_SRCS), $(API_SRCS))
32+
33+
OS := $(shell go env GOOS)
34+
ARCH := $(shell go env GOARCH)
35+
PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)
36+
export PATH
37+
38+
src/crd:
39+
mkdir -p src/crd
40+
41+
src/crd/index.md: $(API_FILTERED_SRCS) src/crd
42+
$(MAKE) gen_crd_docs API_DIR="../.." OUT_FILE=$@
43+
44+
.PHONY: gen_crd_docs
45+
gen_crd_docs: $(GENCRDAPIREFERENCEDOCS) src/crd $(GENCRDAPIREFERENCEDOCS_SRCS)
46+
$(GENCRDAPIREFERENCEDOCS) -template-dir gen-crd-api-reference-docs/template -config "gen-crd-api-reference-docs/config.json" \
47+
-api-dir $(API_DIR) \
48+
-out-file $(OUT_FILE)
49+
50+
src/clusterawsadm:
51+
mkdir -p src/clusterawsadm
52+
53+
terraform/out:
54+
mkdir -p terraform/out
55+
56+
terraform/out/amilist: terraform/out
57+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $@ ./cmd/amilist && chmod 755 $@
58+
59+
.PHONY: generate
60+
generate: ## Generate any dependent files outside of a build
61+
$(MAKE) -C ../ diagrams
62+
63+
#src/SUMMARY_CLUSTERAWSADM.md: src/clusterawsadm $(CLUSTERAWSADMCMDREF_SRCS)
64+
# go run ./cmd/clusterawsadmdocs > src/SUMMARY_CLUSTERAWSADM.md
65+
#
66+
## SUMMARY.md doesn't support processor statements, so construct it using cat
67+
#src/SUMMARY.md: src/SUMMARY_PREFIX.md src/SUMMARY_SUFFIX.md
68+
# cat src/SUMMARY_PREFIX.md > src/SUMMARY.md
69+
# cat src/SUMMARY_CLUSTERAWSADM.md >> src/SUMMARY.md
70+
# cat src/SUMMARY_SUFFIX.md >> src/SUMMARY.md
71+
72+
verify: generate ## Verify that dependent artifacts are up to date
73+
@if !(git diff --quiet HEAD); then \
74+
git diff; \
75+
echo "generated files are out of date, run make generate"; exit 1; \
76+
fi
77+
78+
BOOK_DEPS := $(BOOK_SRCS) $(MDBOOK) $(MDBOOK_EMBED) $(MDBOOK_RELEASELINK) $(MDBOOK_TABULATE) #src/SUMMARY.md src/crd/index.md
79+
80+
.PHONY: build
81+
build: $(BOOK_DEPS) ## Build the book
82+
$(MDBOOK) build
83+
84+
.PHONY: serve
85+
serve: $(BOOK_DEPS) ## Run a local webserver with the compiled book
86+
$(MDBOOK) serve
87+
88+
.PHONY: clean
89+
clean:
90+
rm -rf book

docs/book/book.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[book]
2+
authors = ["The Cluster API Provider IBMCloud Maintainers"]
3+
language = "en"
4+
multilingual = false
5+
src = "src"
6+
title = "Kubernetes Cluster API Provider IBMCloud"
7+
8+
[output.html]
9+
curly-quotes = true
10+
git-repository-url = "https://sigs.k8s.io/cluster-api-provider-ibmcloud"
11+
12+
[preprocessor.tabulate]
13+
command = "mdbook-tabulate"
14+
15+
[preprocessor.embed]
16+
command = "mdbook-embed"
17+
18+
[preprocessor.releaselink]
19+
command = "mdbook-releaselink"

docs/book/src/SUMMARY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Summary
2+
3+
- [Introduction](./introduction.md)
4+
- [Getting Started](./getting-started.md)
5+
- [Topics](./topics/index.md)
6+
- [VPC Cluster](./topics/vpc/index.md)
7+
- [Prerequisites](./topics/vpc/prerequisites.md)
8+
- [Creating a cluster](./topics/vpc/creating-a-cluster.md)
9+
- [Power VS Cluster](./topics/powervs/index.md)
10+
- [Prerequisites](./topics/powervs/prerequisites.md)
11+
- [Creating a cluster](./topics/powervs/creating-a-cluster.md)
12+
- [Developer Guide](./developer/index.md)
13+
- [Rapid iterative development with Tilt](./developer/tilt.md)
14+
- [Release Process](./developer/release.md)
15+
- [Troubleshooting](./user/troubleshooting.md)
16+
- [Reference](./reference/reference.md)

docs/book/src/developer/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Developer Guide

docs/book/src/developer/release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Release Process

docs/book/src/developer/tilt.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Rapid iterative development with Tilt

docs/book/src/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Getting Started

docs/book/src/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Introduction

0 commit comments

Comments
 (0)