Skip to content

Commit f58984a

Browse files
committed
(Fixes #19) Added documentation for running the operator locally
1 parent 78d7c1b commit f58984a

2 files changed

Lines changed: 181 additions & 1 deletion

File tree

README.md

Lines changed: 158 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,47 @@ specific APIs in order to satisfy the intents defined in custom resources
1010

1111
[infra-provider-gcp]: https://github.com/datum-cloud/infra-provider-gcp
1212

13+
## Architecture
14+
15+
The Network Services Operator uses a multi-cluster architecture that implements a control plane/data plane separation pattern:
16+
17+
### Control Plane (nso-standard cluster)
18+
- Runs the Network Services Operator and manages high-level network configurations
19+
- Defines APIs and core controllers for network-related entities
20+
- Responsible for defining the desired state of network resources
21+
- Focuses on what network resources should exist
22+
23+
### Data Plane (nso-infra cluster)
24+
- Contains the actual network infrastructure and resources
25+
- Implements the infrastructure provider (e.g., GCP Infrastructure Provider)
26+
- Responsible for implementing the actual network resources based on control plane configurations
27+
- Focuses on how to implement the resources using specific infrastructure providers
28+
29+
This separation provides several benefits:
30+
- Clear separation of concerns between configuration and implementation
31+
- Infrastructure independence (control plane doesn't need to know implementation details)
32+
- Enhanced security through isolation of control plane from infrastructure
33+
- Flexible resource management across clusters
34+
35+
## Location Configuration
36+
37+
Locations define where network resources should be provisioned in the data plane. Example configurations can be found in the `config/samples` directory. For instance, to create a GCP-based location:
38+
39+
1. Make sure you're connected to the data plane cluster:
40+
```sh
41+
KUBECONFIG="${TMPDIR}/.kind-nso-infra.yaml" kubectl config use-context kind-nso-infra
42+
```
43+
44+
2. Apply the location from the samples:
45+
```sh
46+
kubectl apply -f config/samples/location.yaml
47+
```
48+
49+
3. Verify the location was created:
50+
```sh
51+
kubectl get locations
52+
```
53+
1354
## Documentation
1455

1556
Documentation will be available at [docs.datum.net](https://docs.datum.net/)
@@ -22,8 +63,124 @@ shortly.
2263
- go version v1.23.0+
2364
- docker version 17.03+.
2465
- kubectl version v1.31.0+.
66+
- kustomize (required for deploying CRs)
67+
- helm (required for deploying CRs with helm charts)
2568
- Access to a Kubernetes v1.31.0+ cluster.
2669

70+
#### Development Setup
71+
72+
When running the operator locally with `make run`, you need to provide a kubeconfig file for the downstream cluster. The operator expects this file at `./infra.kubeconfig` by default. You can either:
73+
74+
1. Create a symbolic link to your kubeconfig:
75+
```sh
76+
ln -s ~/.kube/config ./infra.kubeconfig
77+
```
78+
79+
2. Or modify the configuration in `config/dev/config.yaml` to point to your kubeconfig file:
80+
```yaml
81+
downstreamResourceManagement:
82+
kubeconfigPath: /path/to/your/kubeconfig
83+
```
84+
85+
#### Using k9s with Kind Clusters
86+
87+
The project uses two Kind clusters: `nso-standard` and `nso-infra`. If the clusters don't exist, create them first:
88+
89+
1. Create the standard cluster:
90+
```sh
91+
make kind-standard-cluster
92+
```
93+
94+
2. Create the infrastructure cluster:
95+
```sh
96+
make kind-infra-cluster
97+
```
98+
99+
If the clusters already exist but you need to get their kubeconfigs:
100+
```sh
101+
# For standard cluster
102+
kind get kubeconfig --name nso-standard > "${TMPDIR}/.kind-nso-standard.yaml"
103+
104+
# For infrastructure cluster
105+
kind get kubeconfig --name nso-infra > "${TMPDIR}/.kind-nso-infra.yaml"
106+
```
107+
108+
After getting the kubeconfigs, you can connect to them using k9s:
109+
110+
To connect to the standard cluster:
111+
```sh
112+
KUBECONFIG="${TMPDIR}/.kind-nso-standard.yaml" k9s
113+
```
114+
115+
To connect to the infrastructure cluster:
116+
```sh
117+
KUBECONFIG="${TMPDIR}/.kind-nso-infra.yaml" k9s
118+
```
119+
120+
You can also create an alias in your shell configuration for easier access:
121+
```sh
122+
# Add to your ~/.zshrc or ~/.bashrc
123+
alias k9s-standard='KUBECONFIG="${TMPDIR}/.kind-nso-standard.yaml" k9s'
124+
alias k9s-infra='KUBECONFIG="${TMPDIR}/.kind-nso-infra.yaml" k9s'
125+
```
126+
127+
To delete the clusters when you're done:
128+
```sh
129+
kind delete cluster --name nso-standard
130+
kind delete cluster --name nso-infra
131+
```
132+
133+
#### Installing Kustomize
134+
135+
The project uses a local version of Kustomize to ensure version consistency. You can install it using the project's Makefile:
136+
137+
```sh
138+
make kustomize
139+
```
140+
141+
This will install Kustomize v5.5.0 in the project's `bin` directory.
142+
143+
Alternatively, you can install Kustomize globally using one of the following methods:
144+
145+
**Using Homebrew (macOS):**
146+
```sh
147+
brew install kustomize
148+
```
149+
150+
**Using curl (Unix-like systems):**
151+
```sh
152+
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
153+
```
154+
155+
**Using go install (if you have Go installed):**
156+
```sh
157+
go install sigs.k8s.io/kustomize/kustomize/v5@latest
158+
```
159+
160+
Verify the installation:
161+
```sh
162+
kustomize version
163+
```
164+
165+
#### Installing Helm
166+
167+
You can install Helm using one of the following methods:
168+
169+
**Using Homebrew (macOS):**
170+
```sh
171+
brew install helm
172+
```
173+
174+
**Using curl (Unix-like systems):**
175+
```sh
176+
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
177+
```
178+
179+
Verify the installation:
180+
```sh
181+
helm version
182+
```
183+
27184
### To Deploy on the cluster
28185

29186
**Build and push your image to the location specified by `IMG`:**
@@ -34,7 +191,7 @@ make docker-build docker-push IMG=<some-registry>/tmp:tag
34191

35192
**NOTE:** This image ought to be published in the personal registry you specified.
36193
And it is required to have access to pull the image from the working environment.
37-
Make sure you have the proper permission to the registry if the above commands dont work.
194+
Make sure you have the proper permission to the registry if the above commands don't work.
38195

39196
**Install the CRDs into the cluster:**
40197

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: networking.datumapis.com/v1alpha
2+
kind: Location
3+
metadata:
4+
name: us-central1-a
5+
namespace: default
6+
spec:
7+
# The location class that indicates control plane behavior
8+
# Valid values are: datum-managed, self-managed
9+
locationClassName: datum-managed
10+
11+
# The topology of the location
12+
topology:
13+
topology.datum.net/city-code: "us-central1"
14+
15+
# The location provider configuration
16+
provider:
17+
gcp:
18+
# The GCP project servicing the location
19+
projectId: "your-gcp-project-id"
20+
# The GCP region servicing the location
21+
region: "us-central1"
22+
# The GCP zone servicing the location
23+
zone: "us-central1-a"

0 commit comments

Comments
 (0)