Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #193

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
18 changes: 11 additions & 7 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,17 @@ const config = {
darkTheme: darkCodeTheme,
},
}),
plugins: [
[require.resolve('docusaurus-lunr-search'),
{
indexBaseUrl: true
}
]
],
plugins: [
[require.resolve('docusaurus-lunr-search'),
{
indexBaseUrl: true
}
]
],
markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
};

module.exports = config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dependencies": {
"@docusaurus/core": "^2.4.0",
"@docusaurus/preset-classic": "^2.4.0",
"@docusaurus/theme-mermaid": "^2.4.0",
"@mdx-js/react": "^1.6.21",
"clsx": "^1.1.1",
"docusaurus-lunr-search": "^2.1.15",
Expand Down
149 changes: 148 additions & 1 deletion versioned_docs/version-1.7/references/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,153 @@
title: Architecture
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

![Rancher Desktop Architecture](../img/how-it-works-rancher-desktop.svg)

Rancher Desktop is an electron-based application that wraps other tools while it also provides the user experience to create a simple experience. On macOS and Linux, Rancher Desktop leverages a virtual machine to run containerd or dockerd and Kubernetes. Windows Subsystem for Linux v2 is leveraged for Windows systems. All you need to do is download and run the application.
Rancher Desktop is an electron-based application that wraps other tools while it also provides the user experience to create a simple experience. On macOS and Linux, Rancher Desktop leverages a virtual machine to run containerd or dockerd and Kubernetes. Windows Subsystem for Linux v2 is leveraged for Windows systems. All you need to do is download and run the application.

<Tabs>
<TabItem value="Windows">

## Functional Architecture

```mermaid
flowchart TD
subgraph WSL
subgraph RD_distro[rancher-desktop]
RD_data_distro[volume]
dockerd(dockerd)
end
subgraph kubernetes_components[kubernetes components]
direction TB
kubectl(kubectl) --- k3s(k3s)
traefik(traefik)
end
trivy(trivy)
end
subgraph RD
GUI(GUI) --- rdctl(rdctl)
subgraph backend[interfaces to backend]
direction TB
nerdctl(nerdctl)
docker_CLI(docker CLI)
helm(helm)
k8s_manager(k8s manager)
end
rdctl(rdctl) --- backend
subgraph communication_layer[communication layer]
direction TB
HTTP_cmd_server(HTTP command server)
ipc_proxy(IPC Proxy server)
end
backend --- communication_layer
end
communication_layer --- WSL
```

## Networking Layer

```mermaid
flowchart LR;
subgraph Host["HOST"]
subgraph hostSwitch["Host Switch"]
vsockHost["Host Daemon"]
Win32_API(("Win32 API"))
dhcp["DHCP"]
dns["DNS"]
api["API"]
portForwarding["Port Forwarding"]
vsockHost --system calls---- Win32_API
vsockHost ---- dhcp
vsockHost ---- dns
vsockHost ---- portForwarding
vsockHost ---- api
end
end
subgraph VM["VM"]
subgraph vmSwitch["VM Switch"]
vsockVM["VM Daemon"]
tapDevice("tap device")
tapDevice ---- vsockVM
end
end
vsockVM --- |AF_VSOCK| vsockHost
```
</TabItem>

<TabItem value="macOS">

```mermaid
flowchart TD
subgraph RD
GUI(GUI) --- rdctl
rdctl(rdctl) --- backend
subgraph backend[interfaces to backend]
direction TB
nerdctl(nerdctl)
docker_CLI(docker CLI)
helm(helm)
k8s_manager(k8s manager)
LimaCTL
end
subgraph communication_layer[communication layer]
direction TB
HTTP_cmd_server(HTTP command server)
ipc_proxy(IPC proxy server)
end
backend --- communication_layer
end
subgraph Lima
data_volume(data volume)
dockerd(dockerd)
subgraph kubernetes_components[kubernetes components]
direction TB
kubectl(kubectl)
k3s(k3s)
kubectl --- k3s
traefik(Traefik)
end
trivy(Trivy)
end
communication_layer --- Lima
```
</TabItem>

<TabItem value="Linux">

```mermaid
flowchart TD
subgraph RD
GUI(GUI) --- rdctl
rdctl(rdctl) --- backend
subgraph backend[interfaces to backend]
nerdctl(nerdctl)
docker_CLI(docker CLI)
helm(helm)
k8s_manager(k8s manager)
LimaCTL
end
subgraph communication_layer[communication layer]
HTTP_cmd_server(HTTP command server)
ipc_proxy(IPC proxy server)
end
backend --- communication_layer
end
subgraph Lima
data_volume(data volume)
dockerd(dockerd)
subgraph kubernetes_components[kubernetes components]
direction TB
kubectl(kubectl)
k3s(k3s)
kubectl --- k3s
traefik(Traefik)
end
trivy(Trivy)
end
communication_layer --- Lima
```
</TabItem>
</Tabs>
64 changes: 64 additions & 0 deletions versioned_docs/version-1.7/references/glossary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: Glossary
---

### containerd
Daemon process in charge of managing containers. Is it the default container engine in Rancher-Desktop.

### dockerd
#### On Windows
On the host, `wslhelper.exe` spawns a Docker socket proxy for communication with WSL. For the different distributions, a separate socket is set up in each distro (see [*windowsIntegrationManager.ts*](https://github.com/rancher-sandbox/rancher-desktop/blob/main/pkg/rancher-desktop/integrations/windowsIntegrationManager.ts)).
#### On macOS
The dockerd process runs directly in the alpine-lima distro.
#### On Linux
The dockerd process runs directly in the alpine-lima distro.

### docker CLI
The Docker interface that allows to issue commands to dockerd.

### DNS resolver
A process that listens through both UDP and TCP ports on WSL and communicates with a peer process on the host machine (through `AF_VSOCK` sockets) to perform DNS resolution. Makes use of split tunneling to redirect requests to either VPN or to the internet (see [corresponding repository](https://github.com/rancher-sandbox/rancher-desktop-host-resolver)).

### helm
The interface to Helm. Helm is a tool that helps install and configure Kubernetes resources in a cluster using [charts](https://helm.sh/docs/topics/charts/).

### host-switch
#### Windows specific
The host switch process is used to provide DNS, DHCP and port forwarding to the VM through `AF_VSOCK` by communicating with the VM switch (`vm-switch` process) that is running on WSL. It is part of the experimental networking layer that makes use of the gVisor networking stack.

### k3s
k3s is a lightweight Kubernetes implementation. It is an optional component to Rancher-Desktop.

### k8s manager
A module that is responsible for setting up Kubernetes and creating an image processor depending on the runtime and thus container engine in use.

### Lima
#### macOS and Linux specific
Lima is a virtual machine manager used to run the Linux images necessary to Rancher-Desktop's functioning.

### nerdctl
The process running on the host acts as an interface and is a wrapper for the containerd engine commands that run on the WSL virtual machine.

### rancher-desktop (distro)
Distro that is prepackaged and started by default on WSL when Rancher-Desktop is started. Used to run the main components of Rancher-Desktop.

### rancher-desktop-data
#### Windows specific
Accompanying volume to the rancher-desktop distro, used to persist configuration and data needed by Rancher-Desktop. Different distros may use separate instances of WSL as storage volumes as well.

### rdctl
Command line interface allowing access to Rancher-Desktop features.

### Traefik
Load balancer and proxy handler; used as the default ingress controller for the Kubernetes cluster. It is installed with k3s.

### Trivy
A security scanner used to find vulnerabilities or configuration issues in images.

### vm-switch
#### Windows specific
Daemon that that runs in WSL and connects to the host switch via `AF_VSOCK`. When it first starts the vm switch will create both a tap device (ethernet) and a loopback device. It is part of the experimental networking layer that makes use of the gVisor networking stack.

### WSL
#### Windows specific
WSL is a tool that makes uses of a lightweight virtual machine to run Linux distributions and binaries needed by Rancher-Desktop on Windows.
Loading