Skip to content

Commit 10c153b

Browse files
docs(readme): improve prerequisites, deployment and examples (#52)
* docs: add requirements and setup section * docs: improve local development setup * docs(readme): enhance example sections * fix: typo * docs: revert to `host-docker.sock`
1 parent 2fe335f commit 10c153b

File tree

1 file changed

+98
-2
lines changed

1 file changed

+98
-2
lines changed

README.md

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,101 @@
44

55
## About this project
66

7-
A cluster provider for OpenMCP that uses [kind](https://kind.sigs.k8s.io/) to provision clusters. Ideal for local development and E2E tests.
7+
A cluster provider for [OpenMCP](https://github.com/openmcp-project/openmcp-operator) that uses [kind](https://kind.sigs.k8s.io/) (Kubernetes IN Docker) to provision and manage Kubernetes clusters. This provider enables you to create and manage multiple Kubernetes clusters running as Docker containers, making it ideal for:
8+
9+
- **Local Development**: Quickly spin up multiple clusters for testing multi-cluster scenarios
10+
- **E2E Testing**: Automated testing of multi-cluster applications and operators
11+
- **CI/CD Pipelines**: Lightweight cluster provisioning for testing environments
12+
13+
## Prerequisites
14+
15+
Before using this cluster provider, ensure you have:
16+
17+
- **Docker**: Running Docker daemon with socket accessible
18+
- **kind**: [kind CLI tool](https://kind.sigs.k8s.io/docs/user/quick-start/) installed
19+
- **kubectl**: For interacting with Kubernetes clusters
20+
21+
## Installation
22+
23+
### Production Deployment
24+
25+
In combination with the [OpenMCP Operator](https://github.com/openmcp-project/openmcp-operator), this operator can be deployed via a simple Kubernetes resource:
26+
27+
```yaml
28+
apiVersion: openmcp.cloud/v1alpha1
29+
kind: ClusterProvider
30+
metadata:
31+
name: kind
32+
spec:
33+
image: "ghcr.io/openmcp-project/images/cluster-provider-kind:<latest-version>"
34+
```
35+
36+
### Local Development
37+
38+
To run the operator locally for development:
39+
40+
1. **Start a platform kind cluster**:
41+
```shell
42+
kind create cluster --name platform
43+
kubectl config use-context kind-platform
44+
```
45+
2. Install the Platform CRDs of the openmcp-operator:
46+
Apply the CRDs from the OpenMCP operator repository [here](https://github.com/openmcp-project/openmcp-operator/tree/main/api/crds/manifests).
47+
48+
3. **Initialize the CRDs**:
49+
```shell
50+
go run ./cmd/cluster-provider-kind/main.go init
51+
```
52+
53+
4. **Run the operator**:
54+
```shell
55+
go run ./cmd/cluster-provider-kind/main.go run
56+
```
57+
58+
## Usage Examples
59+
60+
### Creating a Cluster
61+
62+
Create a new kind cluster by applying a Cluster resource:
63+
64+
```yaml
65+
apiVersion: clusters.openmcp.cloud/v1alpha1
66+
kind: Cluster
67+
metadata:
68+
name: my-managedcontrolplane
69+
namespace: default
70+
spec:
71+
profile: kind # This tells the kind provider to handle this cluster
72+
tenancy: Exclusive
73+
```
74+
75+
```shell
76+
kubectl apply -f cluster.yaml
77+
```
78+
79+
### Requesting Access to a Cluster
80+
81+
Create an AccessRequest to get kubeconfig for a cluster:
82+
83+
```yaml
84+
apiVersion: clusters.openmcp.cloud/v1alpha1
85+
kind: AccessRequest
86+
metadata:
87+
name: my-access
88+
namespace: default
89+
spec:
90+
clusterRef:
91+
name: my-managedcontrolplane
92+
namespace: default
93+
permissions: []
94+
```
95+
96+
The kubeconfig will be stored in a Secret in the same namespace as the `AccessRequest`.
897

998
## How it works
1099

100+
### Docker Socket Access
101+
11102
In order to create new kind clusters from within a kind cluster, the Docker socket (usually `/var/run/docker.sock`) needs to be available to the `cluster-provider-kind` pod. As a prerequisite, the Docker socket of the host machine must be mounted into the nodes of the platform kind cluster. In this case, there is only a single node (`platform-control-plane`). The socket can then be mounted by the cluster-provider-kind pod using a `hostPath` volume.
12103

13104
```mermaid
@@ -37,6 +128,8 @@ end
37128
style HostMachine fill:#eee
38129
```
39130

131+
### Platform Cluster Configuration
132+
40133
The kind configuration for the platform cluster may look like this:
41134

42135
```yaml
@@ -48,7 +141,10 @@ nodes:
48141
- hostPath: /var/run/docker.sock
49142
containerPath: /var/run/host-docker.sock
50143
```
51-
In order to test that the socket is functional, a simple pod can be deployed:
144+
145+
### Testing Docker Socket Access
146+
147+
In order to test that the socket is functional, a simple pod can be deployed:
52148

53149
```yaml
54150
apiVersion: v1

0 commit comments

Comments
 (0)