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
  4. run test
    export KUBEBUILDER_ASSETS=/usr/local/kubebuilder/bin # path-to-kubebuilder/bin
    make test

Testing locally

# make binary
make

# start the controller
bin/firewall-controller --hosts-file ./hosts --enable-signature-check=false --enable-IDS=false

# install kind (k8s in docker)

# create a local kind cluster
kind create cluster

# deploy manifests
k apply -f deploy

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