Develop Setup

  1. download kubebuilder
  2. download kustomize from kustomize
  3. init project and run kubebuilder
kubebuilder init --domain metal-stack.io
kubebuilder create api --group firewall --version v1 --kind Network
  1. run test
export KUBEBUILDER_ASSETS=~/dev/kubebuilder_2.3.1_linux_amd64/bin
make test

Testing locally

# start kind cluster
kind create cluster

# deploy manifests
k apply -f deploy

# start the controller
bin/firewall-controller --hosts-file ./hosts

# watch results
k describe -n firewall firewall
cat nftables.v4
cat hosts