Skip to content

Commit 5d92925

Browse files
authored
Merge pull request #7033 from oscr/fix-docs-makefile
✨ Update docs/Makefile
2 parents 2fc48a8 + cc642cd commit 5d92925

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+63
-63
lines changed

docs/Dockerfile

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# Recommended usage:
18-
#
19-
# - Run an ephemeral container
20-
# - Mount the current working directory into the container.
21-
# - Run the entrypoint as the user invoking docker run. Otherwise the output
22-
# files will be owned by root, the default user.
23-
#
24-
# - Example:
25-
# docker run \
26-
# --rm \
27-
# --volume ${PWD}:/figures \
28-
# --user $(id --user):$(id --group) \
29-
# ${IMAGE_TAG} \
30-
# -v /figures/*.plantuml
31-
17+
# To generate diagrams run 'make diagrams' in the docs/ folder.
3218
FROM maven:3-jdk-8
3319

3420
RUN apt-get update && apt-get install -y --no-install-recommends graphviz=2.42.2-5 fonts-symbola=2.60-1.1 fonts-wqy-zenhei=0.9.45-8 && rm -rf /var/lib/apt/lists/*

docs/Makefile

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
15+
SHELL:=/usr/bin/env bash
1616

17-
SOURCES := $(shell find ${ROOT_DIR} -name \*.plantuml)
18-
DIAGRAMS := $(SOURCES:%.plantuml=%.png)
17+
.DEFAULT_GOAL:=help
18+
19+
DIAGRAM_SRCS := $(call rwildcard,.,*.md,*.plantuml)
1920

2021
# Hosts running SELinux need :z added to volume mounts
2122
SELINUX_ENABLED := $(shell cat /sys/fs/selinux/enforce 2> /dev/null || echo 0)
@@ -24,13 +25,26 @@ ifeq ($(SELINUX_ENABLED),1)
2425
DOCKER_VOL_OPTS?=:z
2526
endif
2627

28+
##@ PlantUML diagrams
29+
2730
.PHONY: diagrams
28-
diagrams: $(DIAGRAMS)
29-
30-
%.png: %.plantuml
31-
docker run \
32-
--rm \
33-
--volume ${ROOT_DIR}:/workdir$(DOCKER_VOL_OPTS) \
34-
--user $(shell id -u):$(shell id -g) \
35-
k8s.gcr.io/cluster-api/plantuml:1.2019.6 \
36-
-v /workdir/$(shell echo '$^' | sed -e 's,.*docs/,,g' )
31+
diagrams: plantuml-builder diagrams-book diagrams-proposals ## Make all diagrams
32+
33+
.PHONY: diagrams-book
34+
diagrams-book: plantuml-builder ## Make all book diagrams
35+
-docker run -u $(UID):$(GID) -v $(abspath .):/docs$(DOCKER_VOL_OPTS) plantuml-builder /docs/book/**/*.md
36+
-docker run -u $(UID):$(GID) -v $(abspath .):/docs$(DOCKER_VOL_OPTS) plantuml-builder /docs/book/**/*.plantuml
37+
38+
.PHONY: diagrams-proposals
39+
diagrams-proposals: plantuml-builder ## Make all proposals diagrams
40+
-docker run -u $(UID):$(GID) -v $(abspath .):/docs$(DOCKER_VOL_OPTS) plantuml-builder /docs/proposals/**/*.md
41+
-docker run -u $(UID):$(GID) -v $(abspath .):/docs$(DOCKER_VOL_OPTS) plantuml-builder /docs/proposals/**/*.plantuml
42+
43+
.PHONY: plantuml-builder
44+
plantuml-builder: Dockerfile ## Make diagram build container
45+
docker build -f Dockerfile -t "plantuml-builder" .
46+
47+
##@ general
48+
49+
help: ## Display this help
50+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
-4.09 KB
-4.84 KB

docs/proposals/images/cluster-class/create.plantuml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ end box
1616

1717
User -> "API Server" : Create Cluster object with\n""Cluster.Spec.Managed.Class""
1818
"API Server" --> "Cluster Controller": New Cluster
19-
opt Required only if Cluster.Spec.Managed.Class is set
19+
opt #white Required only if Cluster.Spec.Managed.Class is set
2020
"Cluster Controller" --> "API Server": Creates the infrastructure cluster
2121
"Cluster Controller" -> "Cluster Controller": Checks for\nCluster.Spec.ControlPlaneRef
2222
opt Required only if Cluster.Spec.ControlPlaneRef is not set
-1.82 KB

docs/proposals/images/cluster-class/update.plantuml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ end box
1616

1717
User -> "API Server" : Update Cluster object with\n""Cluster.Spec.Class""
1818
"API Server" --> "Cluster Controller": Existing Cluster
19-
opt Required only if Cluster.Spec.Class is set
19+
opt #white Required only if Cluster.Spec.Class is set
2020
"Cluster Controller" -> "Cluster Controller": Fetches the InfrastructureCluster object\nset in Cluster.spec.infrastructureRef
2121
opt Update the InfrastructureCluster
2222
"Cluster Controller" -> "Cluster Controller": Updates InfrastructureCluster fields
-31.9 KB

docs/proposals/images/cluster-spec-crds/figure1.plantuml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ end box
2121
User -> "API Server" : Create Cluster Infrastructure
2222
"API Server" -->> "Infrastructure Controller": New Provider Infrastructure
2323

24-
opt IF Infrastructure has no owner ref
24+
opt #white IF Infrastructure has no owner ref
2525
"Infrastructure Controller"->"Infrastructure Controller": Do Nothing
2626
end
2727

2828
User -> "API Server": Create Cluster
2929
"API Server" -->> "Cluster Controller": New Cluster
3030
"Cluster Controller" -> "API Server": Get Infrastructure
31-
opt Required Only if Infrastructure not seen before
31+
opt #white Required Only if Infrastructure not seen before
3232
"Cluster Controller" -> "Cluster Controller": Add Watcher for Cluster.InfrastructureRef.Kind objects
3333
end
3434

35-
opt Required Only if Infrastructure has no owner
35+
opt #white Required Only if Infrastructure has no owner
3636
"Cluster Controller" -> "Cluster Controller": Set Infrastructure's owner to Cluster
3737
"Cluster Controller" -> "API Server": Update Infrastructure
3838
end
3939

4040
"API Server" -->> "Infrastructure Controller": Infrastructure update
41-
opt Required only if Infrastructure has owner ref
41+
opt #white Required only if Infrastructure has owner ref
4242
"Infrastructure Controller" -> "API Server": Get Cluster
4343
"Infrastructure Controller" -> "Infrastructure Controller": Provision infrastructure
4444
"Infrastructure Controller" -> "Infrastructure Controller": Set Infrastructure.Status.APIEndpoint
@@ -47,7 +47,7 @@ opt Required only if Infrastructure has owner ref
4747
end
4848

4949
"API Server" -->> "Cluster Controller": Infrastructure Update
50-
opt Only required if Infrastructure.Status.Ready is true
50+
opt #white Only required if Infrastructure.Status.Ready is true
5151
"Cluster Controller" -> "API Server": Get Cluster
5252
"Cluster Controller" -> "Cluster Controller": Set Cluster.Status.APIEndpoint = Infrastructure.Status.APIEndpoint
5353
"Cluster Controller" -> "Cluster Controller": Set Cluster.Status.InfrastructureReady true
-2.85 KB

0 commit comments

Comments
 (0)