Skip to content

Commit 5f9e32a

Browse files
Update capibmadm cli tool installation guide
1 parent b8b1a62 commit 5f9e32a

File tree

7 files changed

+122
-2
lines changed

7 files changed

+122
-2
lines changed

.github/ISSUE_TEMPLATE/release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ After every CAPIBM major version release:
1515
- [ ] [Update release support data in docs](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/docs/book/src/developer/release-support-guidelines.md)
1616
- [ ] [Update docs with reference to latest release](https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/README.md#compatibility-with-cluster-api-and-kubernetes-versions)
1717
- [ ] Update and add documentation link for new release branch in Netlify
18+
- [ ] Update capibmadm tool to the latest version after each new release
1819
- [ ] Add new presubmit job for latest release branch in [kubernetes/test-infra](https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/cluster-api-provider-ibmcloud)
1920
- [ ] Update kubekins-e2e image to relevent Kubernetes version
2021
- [ ] Add E2E CI jobs for latest release branch in [ppc64le-cloud/test-infra](https://github.com/ppc64le-cloud/test-infra/blob/master/config/jobs/periodic/cluster-api-provider-ibmcloud/test-e2e-capi-ibmcloud-periodics.yaml)

docs/book/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ MDBOOK := $(TOOLS_BIN_DIR)/mdbook
2020
MDBOOK_EMBED := $(TOOLS_BIN_DIR)/mdbook-embed
2121
MDBOOK_RELEASELINK := $(TOOLS_BIN_DIR)/mdbook-releaselink
2222
MDBOOK_TABULATE := $(TOOLS_BIN_DIR)/mdbook-tabulate
23+
MDBOOK_TABS := $(TOOLS_BIN_DIR)/mdbook-tabs
2324
GENCRDAPIREFERENCEDOCS := $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs
2425
GENCRDAPIREFERENCEDOCS_SRCS := $(call rwildcard,.,gen-crd-api-reference-docs/*.*)
2526
CRD_DOCS := src/crd/cluster-api-aws.md src/crd/experimental.md src/crd/eks-control-plane.md
@@ -75,7 +76,7 @@ verify: generate ## Verify that dependent artifacts are up to date
7576
echo "generated files are out of date, run make generate"; exit 1; \
7677
fi
7778

78-
BOOK_DEPS := $(BOOK_SRCS) $(MDBOOK) $(MDBOOK_EMBED) $(MDBOOK_RELEASELINK) $(MDBOOK_TABULATE) #src/SUMMARY.md src/crd/index.md
79+
BOOK_DEPS := $(BOOK_SRCS) $(MDBOOK) $(MDBOOK_EMBED) $(MDBOOK_RELEASELINK) $(MDBOOK_TABULATE) $(MDBOOK_TABS)#src/SUMMARY.md src/crd/index.md
7980

8081
.PHONY: build
8182
build: $(BOOK_DEPS) ## Build the book

docs/book/book.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ title = "Kubernetes Cluster API Provider IBM Cloud"
88
[output.html]
99
curly-quotes = true
1010
git-repository-url = "https://sigs.k8s.io/cluster-api-provider-ibmcloud"
11-
additional-css = ["theme/css/custom.css"]
11+
additional-css = [
12+
"theme/css/custom.css",
13+
"theme/tabs.css"
14+
]
15+
additional-js = ["theme/tabs.js"]
1216

1317
[output.html.redirect]
1418
"/agenda.html" = "https://docs.google.com/document/d/1oWnqXy1VFv0E3kovQoZfS6IlVP0L4eaQsN-2HYC_6_A"
@@ -21,3 +25,6 @@ command = "mdbook-embed"
2125

2226
[preprocessor.releaselink]
2327
command = "mdbook-releaselink"
28+
29+
[preprocessor.tabs]
30+
command = "mdbook-tabs"

docs/book/src/topics/capibmadm/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Kubernetes Cluster API Provider IBM Cloud Management Utility
44

55
## Install capibmadm
66

7+
{{#tabs}}
8+
{{#tab name="Linux/MacOS"}}
9+
710
#### Install capibmadm binary with curl on Linux / MacOS
811
Run the following command to download the capibmadm binary:
912

@@ -23,6 +26,9 @@ Test to ensure the version you installed is up-to-date:
2326
capibmadm version -o short
2427
```
2528

29+
{{#endtab }}
30+
{{#tab name="Windows"}}
31+
2632
#### Install capibmadm binary with curl on Windows using PowerShell
2733
Go to the working directory where you want capibmadm downloaded.
2834

@@ -43,5 +49,8 @@ Test to ensure the version you installed is up-to-date:
4349
capibmadm.exe version -o short
4450
```
4551

52+
{{#endtab }}
53+
{{#endtabs }}
54+
4655
## [1. PowerVS commands](./powervs/index.md)
4756
## [2. VPC commands](./vpc/index.md)

docs/book/theme/tabs.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.mdbook-tabs {
2+
display: flex;
3+
}
4+
5+
.mdbook-tab {
6+
background-color: var(--table-alternate-bg);
7+
padding: 0.5rem 1rem;
8+
cursor: pointer;
9+
border: none;
10+
font-size: 1.6rem;
11+
line-height: 1.45em;
12+
}
13+
14+
.mdbook-tab.active {
15+
background-color: var(--table-header-bg);
16+
font-weight: bold;
17+
border: 1px solid #ccc;
18+
}
19+
20+
.mdbook-tab-content {
21+
padding: 20px;
22+
border: 1px solid #ccc;
23+
}
24+
25+
.mdbook-tab-content table {
26+
margin: unset;
27+
}

docs/book/theme/tabs.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* Change active tab of tabs.
3+
*
4+
* @param {Element} container
5+
* @param {string} name
6+
*/
7+
const changeTab = (container, name) => {
8+
for (const child of container.children) {
9+
if (!(child instanceof HTMLElement)) {
10+
continue;
11+
}
12+
13+
if (child.classList.contains('mdbook-tabs')) {
14+
for (const tab of child.children) {
15+
if (!(tab instanceof HTMLElement)) {
16+
continue;
17+
}
18+
19+
if (tab.dataset.tabname === name) {
20+
tab.classList.add('active');
21+
} else {
22+
tab.classList.remove('active');
23+
}
24+
}
25+
} else if (child.classList.contains('mdbook-tab-content')) {
26+
if (child.dataset.tabname === name) {
27+
child.classList.remove('hidden');
28+
} else {
29+
child.classList.add('hidden');
30+
}
31+
}
32+
}
33+
};
34+
35+
document.addEventListener('DOMContentLoaded', () => {
36+
const tabs = document.querySelectorAll('.mdbook-tab');
37+
for (const tab of tabs) {
38+
tab.addEventListener('click', () => {
39+
if (!(tab instanceof HTMLElement)) {
40+
return;
41+
}
42+
43+
if (!tab.parentElement || !tab.parentElement.parentElement) {
44+
return;
45+
}
46+
47+
const container = tab.parentElement.parentElement;
48+
const name = tab.dataset.tabname;
49+
const global = container.dataset.tabglobal;
50+
51+
changeTab(container, name);
52+
53+
if (global) {
54+
localStorage.setItem(`mdbook-tabs-${global}`, name);
55+
56+
const globalContainers = document.querySelectorAll(
57+
`.mdbook-tabs-container[data-tabglobal="${global}"]`
58+
);
59+
for (const globalContainer of globalContainers) {
60+
changeTab(globalContainer, name);
61+
}
62+
}
63+
});
64+
}
65+
66+
const containers = document.querySelectorAll('.mdbook-tabs-container[data-tabglobal]');
67+
for (const container of containers) {
68+
const global = container.dataset.tabglobal;
69+
70+
const name = localStorage.getItem(`mdbook-tabs-${global}`);
71+
if (name && document.querySelector(`.mdbook-tab[data-tabname="${name}"]`)) {
72+
changeTab(container, name);
73+
}
74+
}
75+
});

hack/tools/bin/mdbook-tabs

11 MB
Binary file not shown.

0 commit comments

Comments
 (0)