Skip to content
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
36 changes: 36 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Documentation

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

jobs:
gh-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make -C docs/book build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./docs/book/book

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: gh-pages
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

34 changes: 34 additions & 0 deletions docs/book/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2023 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Directories.
TOOLS_DIR := $(realpath ../../hack/tools)
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
BIN_DIR := bin
MDBOOK_INSTALL := $(realpath ../../scripts/ci-install-mdbook.sh)

export PATH := $(abspath $(TOOLS_BIN_DIR)/bin):$(PATH)

# Only set MDBOOK if it's not set as an environment variable
MDBOOK ?= $(TOOLS_BIN_DIR)/bin/mdbook
$(MDBOOK):
$(MDBOOK_INSTALL) 0.4.35 $(TOOLS_BIN_DIR)

.PHONY: serve
serve: $(MDBOOK)
$(MDBOOK) serve

.PHONY: build
build: $(MDBOOK)
$(MDBOOK) build
26 changes: 26 additions & 0 deletions docs/book/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[book]
language = "en"
multilingual = false
src = "src"
title = "Cluster API Operator"
description = "Cluster API Operator"

[preprocessor.toc]
command = "mdbook-toc"
marker = "[[_TOC_]]"

[preprocessor.fs-summary]
# (default: true)
clean-paths = false

# other preprocessors will naturally need to
# run after the summary has been generated
[preprocessor.links]
after = ["fs-summary"]

[output.html]
mathjax-support = true
git-repository-url = "https://github.com/kubernetes-sigs/cluster-api-operator"
git-repository-icon = "fa-github"
site-url = "/cluster-api-operator/"

8 changes: 8 additions & 0 deletions docs/book/src/01_intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cluster API Operator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file name could be just introduction.md without numbering, but should be fine as a initial base for the book

/lgtm

Copy link
Member Author

@Danil-Grigorev Danil-Grigorev Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This structure is using https://lib.rs/crates/mdbook-fs-summary - it might be easier to handle summary generation then doing this manually, and less chances that it will leave broken links. That's why it has 01_ in the front


## ✨ What is Cluster API Operator?

The **Cluster API Operator** is a Kubernetes Operator designed to empower cluster administrators to handle the lifecycle of Cluster API providers within a management cluster using a declarative approach. It aims to improve user experience in deploying and managing Cluster API, making it easier to handle day-to-day tasks and automate workflows with GitOps.

This operator leverages a declarative API and extends the capabilities of the `clusterctl` CLI, allowing greater flexibility and configuration options for cluster administrators.

Empty file added docs/book/src/SUMMARY.md
Empty file.
34 changes: 34 additions & 0 deletions scripts/ci-install-mdbook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Copyright 2023 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

VERSION=${1}
OUTPUT_PATH=${2}

# Ensure the output folder exists
mkdir -p "${OUTPUT_PATH}"

# Install cargo
curl https://sh.rustup.rs -sSf | sh -s -- -y
. "$HOME/.cargo/env"

# Install mdbook and dependencies
cargo install mdbook --version "$VERSION" --root "$OUTPUT_PATH"
cargo install mdbook-fs-summary --root "$OUTPUT_PATH"
cargo install mdbook-toc --root "$OUTPUT_PATH"