Skip to content

Commit 056d1b2

Browse files
committed
fix sample 1 and 2 for new structure
1 parent 8039bc4 commit 056d1b2

21 files changed

+942
-207
lines changed

docs/examples/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# NetBox Operator Examples
22

3-
This folder shows some examples how the NetBox Operator can be used. The demo environment can be prepared with the 'docs/examples/set-up/prepare-demo-env.sh' script, which creates two kind clusters with NetBox Operator and [kro] installed. One one of the clusters a NetBox instance is installed which is available to both NetBox Operator deployments.
3+
This folder shows some examples how the NetBox Operator can be used.
44

5-
![Demo Set Up](demo-setup.drawio.svg)
6-
7-
[kro]: https://github.com/kro-run/kro/
5+
Each example folder contains a README.md which explains how you can set up your local enviroment to step through the examples.
86

97
Prerequisites:
108
- go version v1.24.0+

docs/examples/example1-getting-started/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
# 0.1 Create a local cluster with nebox-installed
44

5-
1. use the 'create-kind' target from the Makefile to create a kind cluster and deploy NetBox on it
5+
1. use the 'create-kind' and 'deploy-kind' targets from the Makefile to create a kind cluster and deploy NetBox and NetBox Operator on it
66
```bash
77
make create-kind
8+
make deploy-kind
89
```
910

1011
# 0.2 Manually Create a Prefix in NetBox
@@ -18,12 +19,14 @@ kubectl port-forward deploy/netbox 8080:8080
1819
2. Open <http://localhost:8080> in your favorite browser and log in with the username `admin` and password `admin`
1920
3. Create a new prefix '3.0.0.64/26' with custom field 'environment: prod'
2021

22+
# 0.3 Navigate to the example
23+
24+
Navigate to 'docs/examples/example1-getting-started' to run the examples below
25+
2126
# 1.1 Claim a Prefix
2227

2328
In this example, we use a `.spec.parentPrefix` that we know in advance. This is useful if you already know exactly from which prefix you want to claim from.
2429

25-
Navigate to 'docs/examples/example1-getting-started' to run the following commands.
26-
2730
1. Inspect the spec of the sample prefix claim CR
2831
```bash
2932
cat prefixclaim-simple.yaml

docs/examples/example1-getting-started/prefixclaim-dynamic.drawio.svg

Lines changed: 72 additions & 72 deletions
Loading

docs/examples/example1-getting-started/simple_prefixclaim-large-font.drawio.svg

Lines changed: 70 additions & 70 deletions
Loading

docs/examples/example2-krm-glue/README.md renamed to docs/examples/example2-load-balancer-ip/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ So we have Prefixes represented as Kubernetes Resources. Now what can we do with
66

77
We use kro.run to glue this to MetalLB IPAddressPools
88

9-
Navigate to 'docs/examples/example2-krm-glue' to run the following commands.
10-
11-
0. Install kro and metallb with the installation script `docs/examples/new/example2-krm-glue/prepare-demo-env.sh`
12-
Then navigate to 'docs/examples/example2-krm-glue' to follow the steps below.
9+
0. Install kro and metallb with the installation script `docs/examples/example2-load-balancer-ip/prepare-demo-env.sh`
10+
Then navigate to 'docs/examples/example2-load-balancer-ip' to follow the steps below.
1311

1412
1. Inspect the spec of the sample prefix claim CR
1513
```bash
16-
cat kro-rdg-poolfromnetbox.yaml
14+
cat zurich-pool.yaml
1715
```
1816
2. Apply the manifests to create a deployment with a service and a metallb-ip-address-pool-netbox to create a metalLB IPAddressPool from the prefix claimed from NetBox
1917
```bash
20-
kubectl apply -f kro-rdg-poolfromnetbox.yaml
18+
kubectl apply -f zurich-pool.yaml
2119
```
2220
3. Check if the prefixclaim CR and the metalLB ipaddresspool CR got created
2321
```bash
@@ -31,9 +29,9 @@ cat sample-deployment.yaml
3129
```bash
3230
kubectl apply -f sample-deployment.yaml
3331
```
34-
6. check if the service got an external ip address assigned
32+
6. check if the service got an external ip address assigned and that the nginx deployment is ready
3533
```bash
36-
kubectl get svc my-nginx -n nginx
34+
kubectl get deploy,svc -n nginx
3735
```
3836
7. try to connect to your service with the external ip
3937
```bash

docs/examples/example2-load-balancer-ip/load-balancer-ip-pool-netbox-large-font.drawio.svg

Lines changed: 738 additions & 0 deletions
Loading

docs/examples/example2-krm-glue/metallb-ip-address-pool-netbox.yaml renamed to docs/examples/example2-load-balancer-ip/load-balancer-ip-pool-netbox.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
apiVersion: kro.run/v1alpha1
22
kind: ResourceGraphDefinition
33
metadata:
4-
name: metallb-ip-address-pool-netbox
4+
name: load-balancer-ip-pool-netbox
55
spec:
66
schema:
77
apiVersion: v1alpha1
8-
kind: MetalLBIPAddressPoolNetBox
8+
kind: LoadBalancerIPPoolNetBox
99
spec:
1010
name: string
1111
tenant: string
1212
prefixLength: string
1313
parentPrefixSelector:
14-
tenant: string
1514
environment: string
1615
family: string
1716
status:
@@ -25,7 +24,6 @@ spec:
2524
metadata:
2625
name: ${schema.spec.name}
2726
spec:
28-
tenant: ${schema.spec.tenant}
2927
prefixLength: ${schema.spec.prefixLength}
3028
parentPrefixSelector: ${schema.spec.parentPrefixSelector}
3129

docs/examples/example2-krm-glue/prepare-demo-env.sh renamed to docs/examples/example2-load-balancer-ip/prepare-demo-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ while true; do
3939
sleep 5
4040
fi
4141
done
42-
kubectl apply --context $CONTEXT -f docs/examples/new/example2-krm-glue/metallb-ip-address-pool-netbox.yaml
42+
kubectl apply --context $CONTEXT -f docs/examples/example2-load-balancer-ip/load-balancer-ip-pool-netbox.yaml

0 commit comments

Comments
 (0)