The network bandwidth annotation manager is a dynamic admission controller for Kubernetes setting a pod's network bandwidth annotations using its resource requests, stripping extended resources, and optionally changing a pod's scheduler.
The primary motivation behind creating NBAM is the ability to use [extended resources|extended resource] FQDNs in pod resource requests and limits, as many helm charts or other packaged Kubernetes deployments do not allow setting custom pod annotations, as required by the CNI spec. Yet, one can usually set CPU and memory limits in helm charts or Kubernetes primitives. Thus nbam takes care of rewriting those to the corresponding pod annotations in multiple modes.
By adding specific labels to namespaces or pods, NBAM mutates pod definitions accordingly to the selected mutation mode.
These mutations occur before the object's persistence by the apiserver. Thus, the kube-scheduler and CNI can use the object without further changes.
One can find a mutation mode and feature overview in the project documentation's feature section.
One can find pre-built OCI images in the project's package section, with the controller available here.
One can create the OCI image using the following:
docker build -t nbam:latest "."
One can build a release binary using the following:
cargo build --release
network-bandwidth-annotation-manager --listen 0.0.0.0:8443 --tls-cert ./cert.pem --tls-key ./key.pem
The following example of a Kubernetes deployment assumes one installed cert-manager and its webhook correctly.
One can find an example deployment at deployments/manager.yaml
.
A prerequisite for setting up a local development environment is installing k3d, tilt, and just locally.
By running the following, one will create a local environment consisting of a customized k3d-managed registry, k3d multi-server cluster, and tilt:
just run
To add networking-related node capacities and allocatable amounts, open a new shell instance, leaving the previous one open, and run the following:
just annotate-nodes
One can then inspect all resources and allocations using, e.g., kubectl-view-allocations.
kubectl view-allocations
To apply all examples listed above, one should use the following:
just apply-examples
To stop the local development environment, one should run the following:
just stop
To generate the license file, followed by mkdocs serve
, one can run the following:
just docs