Skip to content

Commit 149a6d4

Browse files
authored
feat: Convert Mermaid diagrams to inline style (#987)
1 parent a4e81c7 commit 149a6d4

File tree

7 files changed

+130
-130
lines changed

7 files changed

+130
-130
lines changed

content/ngf/traffic-management/advanced-routing.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,43 @@ In this guide we will configure advanced routing rules for multiple applications
1515

1616
The following image shows the traffic flow that we will be creating with these rules.
1717

18-
{{< img src="/ngf/img/advanced-routing.png" alt="" >}}
18+
```mermaid
19+
graph LR
20+
users[Users]
21+
ngfSvc["Public Endpoint<br>for<br>cafe.example.com"]
22+
subgraph cluster [Kubernetes Cluster]
23+
subgraph appNs [Namespace<br>default]
24+
subgraph nsPadding [" "]
25+
nginxPod[Pod<br>NGINX]
26+
coffeeV1Pod[Pod<br>coffee v1]
27+
coffeeV2Pod[Pod<br>coffee v2]
28+
teaPod[Pod<br>tea]
29+
teaPostPod[Pod<br>tea-post]
30+
end
31+
end
32+
end
33+
34+
ngfSvc --> nginxPod
35+
nginxPod --/coffee--> coffeeV1Pod
36+
nginxPod --/coffee<br>header: version=v2<br>OR<br>/coffee?TEST=v2--> coffeeV2Pod
37+
nginxPod --GET /tea--> teaPod
38+
nginxPod --POST /tea--> teaPostPod
39+
users --> ngfSvc
40+
41+
class clusterPadding,nsPadding,clusterPadding2 noBorder
42+
class gwNS,appNs namespace
43+
class ngfSvc,nginxPod nginxNode
44+
class coffeeV1Pod,coffeeV2Pod coffeeNode
45+
class teaPod,teaPostPod teaNode
46+
47+
classDef noBorder stroke:none,fill:none
48+
classDef default fill:#FFFFFF,stroke:#000000
49+
classDef namespace fill:#FFFFFF,stroke:#036ffc,stroke-dasharray: 5 5,text-align:center
50+
classDef nginxNode fill:#b4e0ad,stroke:#2AA317
51+
classDef coffeeNode fill:#edbd8c,stroke:#D9822B
52+
classDef teaNode fill:#ff8f6a,stroke:#e5805f
53+
54+
```
1955

2056
The goal is to create a set of rules that will result in client requests being sent to specific backends based on the request attributes. In this diagram, we have two versions of the `coffee` service. Traffic for v1 needs to be directed to the old application, while traffic for v2 needs to be directed towards the new application. We also have two `tea` services, one that handles GET operations and one that handles POST operations. Both the `tea` and `coffee` applications share the same Gateway.
2157

content/ngf/traffic-management/basic-routing.md

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,21 @@ You can route traffic to your Kubernetes applications using the Gateway API and
2121

2222
The application we are going to use in this guide is a simple **coffee** application comprised of one service and two pods:
2323

24-
{{<img src="ngf/img/route-all-traffic-app.png" alt="This image shows a single 'coffee' Service connecting to two 'coffee' Pods.">}}
24+
```mermaid
25+
graph TB
26+
subgraph cluster [Kubernetes Cluster]
27+
style cluster fill:#FFFFFF,stroke:#000000
28+
svc[Service<br>coffee]
29+
pod1[Pod<br>coffee]
30+
pod2[Pod<br>coffee]
31+
end
32+
33+
svc --> pod1 & pod2
34+
35+
class pod1,pod2,svc appNode
36+
classDef appNode fill:#edbd8c,stroke:#D9822B
37+
38+
```
2539

2640
Using this architecture, the **coffee** application is not accessible outside the cluster. We want to expose this application on the hostname "cafe.example.com" so that clients outside the cluster can access it.
2741

@@ -96,15 +110,91 @@ service/coffee ClusterIP 198.51.100.1 <none> 80/TCP 77s
96110

97111
To route traffic to the **coffee** application, we will create a Gateway and HTTPRoute. The following diagram shows the configuration we are creating in the next step:
98112

99-
{{<img src="ngf/img/route-all-traffic-config.png" alt="">}}
113+
```mermaid
114+
graph LR
115+
subgraph config [Namespace default]
116+
subgraph padding [" "]
117+
direction LR
118+
style config fill:#FFFFFF,stroke:#000000
119+
subgraph gw[Gateway cafe]
120+
subgraph gwPadding [" "]
121+
gwContents[HTTP/80]
122+
end
123+
end
124+
subgraph hr[HTTPRoute coffee]
125+
subgraph hrPadding [" "]
126+
hrContents[cafe.example.com]
127+
subgraph describeMatchAll [Match all<br>traffic]
128+
subgraph describeMatchPadding [" "]
129+
matchAll[Host: *<br>Path: *]
130+
end
131+
end
132+
subgraph describeService [Group matching<br>pods within a Service]
133+
subgraph describePadding [" "]
134+
coffeeSvc[Service<br>coffee]
135+
end
136+
end
137+
end
138+
end
139+
end
140+
end
141+
142+
gwContents --> hrContents --> matchAll --> coffeeSvc
143+
class padding,gwPadding,hrPadding,describeMatchAll,describeService,describePadding,describeMatchPadding noBorder
144+
class gw gateway
145+
class hr httpRoute
146+
class matchAll,hrContents,coffeeSvc appDevNode
147+
class gwContents clusterOppNode
148+
149+
classDef noBorder stroke:none,fill:none,text-align:center
150+
classDef default fill:#FFFFFF,stroke:#000000
151+
classDef gateway fill:#FFFFFF,stroke:#blue,stroke-dasharray: 3 3,text-align:center
152+
classDef httpRoute fill:#FFFFFF,stroke:#D9822B,stroke-dasharray: 3 3,text-align:center
153+
classDef appDevNode fill:#edbd8c,stroke:#D9822B
154+
classDef clusterOppNode fill:lightblue,stroke:darkblue
155+
```
100156

101157
We need a Gateway to create an entry point for HTTP traffic coming into the cluster. The **cafe** Gateway we are going to create will open an entry point to the cluster on port 80 for HTTP traffic.
102158

103159
To route HTTP traffic from the Gateway to the **coffee** service, we need to create an HTTPRoute named **coffee** and attach it to the Gateway. This HTTPRoute will have a single routing rule that routes all traffic to the hostname "cafe.example.com" from the Gateway to the **coffee** service.
104160

105161
Once NGINX Gateway Fabric processes the **cafe** Gateway and **coffee** HTTPRoute, it will configure a data plane (NGINX) to route all HTTP requests sent to "cafe.example.com" to the pods that the **coffee** service targets:
106162

107-
{{<img src="ngf/img/route-all-traffic-flow.png" alt="Traffic Flow">}}
163+
```mermaid
164+
graph LR
165+
style cluster fill:#FFFFFF,stroke:#000000
166+
clients[Clients]
167+
ngfSvc["Public IP Address for<br>cafe.example.com"]
168+
subgraph cluster [Kubernetes Cluster]
169+
170+
subgraph appNs [Namespace<br>default]
171+
subgraph nsPadding [" "]
172+
nginxPod[Pod NGINX]
173+
coffeePod1[Pod coffee]
174+
coffeePod2[Pod coffee]
175+
end
176+
end
177+
end
178+
179+
ngfSvc --> nginxPod
180+
nginxPod --> coffeePod1 & coffeePod2
181+
clients --> ngfSvc
182+
183+
class clusterPadding,nsPadding,clusterPadding2 noBorder
184+
class gwNS,appNs namespace
185+
class nginxPod nginxNode
186+
class coffeePod1,coffeePod2 coffeeNode
187+
class ngfSvc svc
188+
class clients clientNode
189+
190+
classDef noBorder stroke:none,fill:none
191+
classDef default fill:#FFFFFF,stroke:#000000
192+
classDef namespace fill:#FFFFFF,stroke:#036ffc,stroke-dasharray: 5 5,text-align:center
193+
classDef nginxNode fill:#b4e0ad,stroke:#2AA317
194+
classDef svc fill:lightblue,stroke:darkblue
195+
classDef coffeeNode fill:#edbd8c,stroke:#D9822B
196+
classDef clientNode fill:#D3D3D3
197+
```
108198

109199
The **coffee** service is omitted from the diagram above because the NGINX Pod routes directly to the pods that the **coffee** service targets.
110200

static/ngf/img/src/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

static/ngf/img/src/advanced-routing.mermaid

Lines changed: 0 additions & 35 deletions
This file was deleted.

static/ngf/img/src/route-all-traffic-app.mermaid

Lines changed: 0 additions & 13 deletions
This file was deleted.

static/ngf/img/src/route-all-traffic-config.mermaid

Lines changed: 0 additions & 42 deletions
This file was deleted.

static/ngf/img/src/route-all-traffic-flow.mermaid

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)