Skip to content
Merged
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
22 changes: 12 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ Next install our CAPMS provider into the cluster.
make push-to-capi-lab
```

A basic cluster configuration resides in `config/samples`.
Before creating a cluster some manual steps are required beforehand: you need to allocate a node network and a firewall.

```bash
kubectl apply -k config/samples
make -C capi-lab node-network firewall
```

For now it is required to manually create the firewall. This might be changed in the future, but for now run:
A basic cluster configuration that relies on `config/clusterctl-templates/cluster-template.yaml` and uses the aforementioned node network can be generated and applied to the management cluster using a make target.

```bash
make apply-sample-cluster
```

Once the control plane node has phoned home, run:

```bash
make -C capi-lab firewall
# once the firewall is up run
make -C capi-lab mtu-fix
```

Expand Down Expand Up @@ -112,19 +116,17 @@ make deploy IMG=<some-registry>/cluster-api-provider-metal-stack:tag
privileges or be logged in as admin.

**Create instances of your solution**
You can apply the samples (examples) from the config/sample:
You can apply the sample cluster configuration:

```sh
kubectl apply -k config/samples/
make apply-sample-cluster
```

>**NOTE**: Ensure that the samples has default values to test it out.

### To Uninstall
**Delete the instances (CRs) from the cluster:**

```sh
kubectl delete -k config/samples/
make delete-sample-cluster
```

**Delete the APIs(CRDs) from the cluster:**
Expand Down
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,34 @@ endef

# mini-lab developer environment

export METAL_PARTITION ?= mini-lab
export METAL_PROJECT_ID ?= 00000000-0000-0000-0000-000000000001
export METAL_NODE_NETWORK_ID ?= $(shell metalctl network list --name metal-test -o template --template '{{ .id }}')
export CONTROL_PLANE_ENDPOINT ?= "203.0.113.129:443"
export CONTROL_PLANE_MACHINE_IMAGE ?= ubuntu-24.04
export CONTROL_PLANE_MACHINE_SIZE ?= v1-small-x86
export WORKER_MACHINE_IMAGE ?= ubuntu-24.04
export WORKER_MACHINE_SIZE ?= v1-small-x86

.PHONY: up
up: bake deploy-cloud-stack

.PHONY: apply-sample-cluster
apply-sample-cluster: generate manifests
clusterctl generate cluster metal-test \
--kubeconfig=$(KUBECONFIG) \
--worker-machine-count 1 \
--control-plane-machine-count 1 \
--kubernetes-version 1.30.6 \
--from config/clusterctl-templates/cluster-template.yaml \
| kubectl --kubeconfig=$(KUBECONFIG) apply -f -

.PHONY: delete-sample-cluster
delete-sample-cluster: generate manifests
clusterctl generate cluster metal-test \
--kubeconfig=$(KUBECONFIG) \
--worker-machine-count 1 \
--control-plane-machine-count 1 \
--kubernetes-version 1.30.6 \
--from config/clusterctl-templates/cluster-template.yaml \
| kubectl --kubeconfig=$(KUBECONFIG) delete -f -
4 changes: 4 additions & 0 deletions capi-lab/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ controller:
firewall:
metalctl firewall create --description fw --name fw --hostname fw --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image firewall-ubuntu-3.0 --size v1-small-x86 --firewall-rules-file=firewall-rules.yaml --networks internet-mini-lab,$(shell metalctl network list --name metal-test -o template --template '{{ .id }}')

.PHONY: node-network
node-network:
metalctl network allocate --description "node network for metal-test cluster" --name metal-test --project 00000000-0000-0000-0000-000000000001 --partition mini-lab

.PHONY: mtu-fix
mtu-fix:
cd mini-lab && ssh -F files/ssh/config leaf01 'ip link set dev vtep-1001 mtu 9100 && echo done'
Expand Down
1 change: 1 addition & 0 deletions config/clusterctl-templates/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ metadata:
spec:
projectID: ${METAL_PROJECT_ID}
partition: ${METAL_PARTITION}
nodeNetworkID: ${METAL_NODE_NETWORK_ID}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: MetalStackMachineTemplate
Expand Down
2 changes: 1 addition & 1 deletion config/clusterctl-templates/example_variables.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ export METAL_API_HMAC=metal-admin
export METAL_PROJECT_ID=00000000-0000-0000-0000-000000000001
export POD_CIDR=10.240.0.0/12
export METAL_PARTITION=mini-lab
export METAL_NODE_NETWORK_ID=00000000-0000-0000-0000-000000000002

export FIREWALL_MACHINE_SIZE=v1-small-x86
export FIREWALL_MACHINE_IMAGE=
export FIREWALL_NETWORKS=[internet]

export NODE_NETWORK_ID=00000000-0000-0000-0000-000000000002
export CONTROL_PLANE_ENDPOINT=203.0.113.129:443
export CONTROL_PLANE_PORT=443
export CONTROL_PLANE_MACHINE_SIZE=v1-small-x86
Expand Down
117 changes: 0 additions & 117 deletions config/samples/example-kubeadm.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions config/samples/kustomization.yaml

This file was deleted.

Loading