Skip to content

Commit 824d91d

Browse files
authored
Merge pull request #3437 from krikera/use-mermaid-diagrams
docs: Convert ASCII diagrams to mermaid
2 parents 310bc83 + 573882d commit 824d91d

File tree

2 files changed

+67
-61
lines changed

2 files changed

+67
-61
lines changed

docs/content/concepts/apis/admission-webhooks.md

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,39 @@
22

33
kcp extends the vanilla [admission plugins](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) for webhooks, and makes them cluster-aware.
44

5-
```
6-
┌────────────────────────┐
7-
│ Consumer Workspace ws2 │
8-
├────────────────────────┤
9-
│ │
10-
┌────┼─ Widgets APIBinding │
11-
│ │ │
12-
│ │ Widget a │
13-
┌───────────────────────────────────────────────┐ │ │ Widget b │
14-
│ API Provider Workspace ws1 │ │ │ Widget c │
15-
├───────────────────────────────────────────────┤ │ │ │
16-
│ │ │ └────────────────────────┘
17-
│ Widgets APIExport ◄──────────────┼────┤
18-
│ │ │ │
19-
│ ▼ │ │
20-
│ Widgets APIResourceSchema │ │ ┌────────────────────────┐
21-
│ (widgets.v1.example.org) │ │ │ Consumer Workspace ws3 │
22-
│ ▲ │ │ ├────────────────────────┤
23-
│ │ │ │ │ │
24-
│ ┌───────────────────┴─────────────────────┐ │ └────┼─ Widgets APIBinding │
25-
│ │ Mutating/ValidatingWebhookConfiguration │ │ │ │
26-
│ │ for widgets.v1.example.org │ │ │ Widget a │
27-
│ │ │ │ │ Widget b │
28-
│ │ Handle a from ws2 (APIResourceSchema) │ │ │ Widget c │
29-
│ │ Handle b from ws3 (APIResourceSchema) │ │ │ │
30-
│ │ Handle a from ws1 (CRD) │ │ └────────────────────────┘
31-
│ │ ... │ │
32-
│ └───────────────────┬─────────────────────┘ │
33-
│ │ │
34-
│ ▼ │
35-
│ Widgets CustomResourceDefinition │
36-
│ (widgets.v1.example.org) │
37-
│ │
38-
│ Widget a │
39-
│ │
40-
└───────────────────────────────────────────────┘
5+
```mermaid
6+
flowchart TD
7+
subgraph ws1["API Provider Workspace ws1"]
8+
export["Widgets APIExport"]
9+
schema["Widgets APIResourceSchema<br/>(widgets.v1.example.org)"]
10+
webhook["Mutating/ValidatingWebhookConfiguration<br/>for widgets.v1.example.org<br/><br/>Handle a from ws2 (APIResourceSchema)<br/>Handle b from ws3 (APIResourceSchema)<br/>Handle a from ws1 (CRD)"]
11+
crd["Widgets CustomResourceDefinition<br/>(widgets.v1.example.org)"]
12+
13+
export --> schema
14+
schema --> webhook
15+
webhook --> crd
16+
end
17+
18+
subgraph ws2["Consumer Workspace ws2"]
19+
binding1["Widgets APIBinding"]
20+
widgetA1["Widget a"]
21+
widgetB1["Widget b"]
22+
widgetC1["Widget c"]
23+
end
24+
25+
subgraph ws3["Consumer Workspace ws3"]
26+
binding2["Widgets APIBinding"]
27+
widgetA2["Widget a"]
28+
widgetB2["Widget b"]
29+
widgetC2["Widget c"]
30+
end
31+
32+
export --> binding1
33+
export --> binding2
34+
35+
classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px;
36+
classDef resource fill:#e1f3d8,stroke:#82c91e,stroke-width:2px;
37+
class export,schema,webhook,crd,binding1,binding2 resource;
4138
```
4239

4340
When an object is to be mutated or validated, the webhook admission plugin ([`apis.kcp.io/MutatingWebhook`](https://github.com/kcp-dev/kcp/tree/main/pkg/admission/mutatingwebhook) and [`apis.kcp.io/ValidatingWebhook`](https://github.com/kcp-dev/kcp/tree/main/pkg/admission/validatingwebhook) respectively) looks for the owner of the resource schema. Once found, it then dispatches the handling for that object in the owner's workspace. There are two such cases in the diagram above:

docs/content/concepts/apis/exporting-apis.md

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,40 @@ define the schema for `widgets`, and the new `APIExport` type to export `widgets
1010
then proceed to CRUD `widgets` in their workspaces, just like any other API type (e.g. `namespaces`, `configmaps`,
1111
etc.).
1212

13-
```
14-
┌───────────────────────┐
15-
│ Consumer Workspace │
16-
├───────────────────────┤
17-
│ │
18-
┌────┼─ Widgets APIBinding |
19-
│ │ │
20-
│ │ Widget A │
21-
┌───────────────────────────┐ │ │ Widget B │
22-
│ API Provider Workspace │ │ │ Widget C │
23-
├───────────────────────────┤ │ └───────────────────────┘
24-
│ │ │
25-
│ Widgets APIExport ◄───┼───┤
26-
│ │ │ │
27-
│ ▼ │ │
28-
│ Widgets APIResourceSchema │ │ ┌───────────────────────┐
29-
└───────────────────────────┘ │ │ Consumer Workspace │
30-
│ ├───────────────────────┤
31-
│ │ │
32-
└────┼─ Widgets APIBinding │
33-
│ │
34-
│ Widget A │
35-
│ Widget B │
36-
│ Widget C │
37-
└───────────────────────┘
13+
```mermaid
14+
flowchart TD
15+
subgraph provider["API Provider Workspace"]
16+
export["Widgets APIExport"]
17+
schema["Widgets APIResourceSchema"]
18+
export --> schema
19+
end
20+
21+
subgraph consumer1["Consumer Workspace"]
22+
binding1["Widgets APIBinding"]
23+
widgetsA1["Widget A"]
24+
widgetsB1["Widget B"]
25+
widgetsC1["Widget C"]
26+
binding1 --> widgetsA1
27+
binding1 --> widgetsB1
28+
binding1 --> widgetsC1
29+
end
30+
31+
subgraph consumer2["Consumer Workspace"]
32+
binding2["Widgets APIBinding"]
33+
widgetsA2["Widget A"]
34+
widgetsB2["Widget B"]
35+
widgetsC2["Widget C"]
36+
binding2 --> widgetsA2
37+
binding2 --> widgetsB2
38+
binding2 --> widgetsC2
39+
end
40+
41+
export --> binding1
42+
export --> binding2
43+
44+
classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px;
45+
classDef resource fill:#e1f3d8,stroke:#82c91e,stroke-width:2px;
46+
class export,schema,binding1,binding2 resource;
3847
```
3948

4049
**Diagram: 1 APIExport consumed by 2 different workspaces** ([source][diagram1])

0 commit comments

Comments
 (0)