Calico HostEndpoint controller
1.8K
This is a few minutes hack to manage calico hostendpoint resources when nodes are added or deleted.
Please note that the code is messy, names were not carefully chosen, directories for better organization might be missing, has several TODOs.
Also, another important consideration is that since a node start till the policy is applied, the node should not be exposed. This is not covered by this controller.
Depending on your architecture you would use one of the commands:
ARCH=amd64 docker build -t kinvolk/calico-hostendpoint-controller:v0.0.2-amd64 --build-arg ARCH . && docker push kinvolk/calico-hostendpoint-controller:v0.0.2-amd64
ARCH=arm64 docker build -t kinvolk/calico-hostendpoint-controller:v0.0.2-arm64 --build-arg ARCH . && docker push kinvolk/calico-hostendpoint-controller:v0.0.2-arm64
There are multiple ways for building an image for another architecture which is
not your native OS architecture.
The most convenient one is to install the qemu-user-static package on your
system to set up binary translation so that the Linux kernel can run binaries
for other architectures.
NOTE: You may have to run
sudo systemctl restart systemd-binfmt.serviceafter installing.
The downside of this approach is that a base image for the non-native
architecture must be explicitly specified in the FROM directive of the
Dockerfile instead of an image like debian:9, which is a multiarch image.
For example, for building a Debian-based ARM64 image on an x86-64 machine you
need to use arm64v8/debian:9 (prefixed because there is no debian:9-arm64).
When done building, you can change the Dockerfile back to the way it was
before. Unfortunately the FROM directive does not handle build arguments.
Now make sure you have "experimental": "enabled" in your
~/.docker/config.json (surrounded by { and } if the file is otherwise
empty).
When all images are built on the respective architectures and pushed they can be combined through a manifest to build a multiarch image:
docker manifest create kinvolk/calico-hostendpoint-controller:v0.0.2 --amend kinvolk/calico-hostendpoint-controller:v0.0.2-amd64 --amend kinvolk/calico-hostendpoint-controller:v0.0.2-arm64
docker manifest annotate kinvolk/calico-hostendpoint-controller:v0.0.2 kinvolk/calico-hostendpoint-controller:v0.0.2-amd64 --arch=amd64 --os=linux
docker manifest annotate kinvolk/calico-hostendpoint-controller:v0.0.2 kinvolk/calico-hostendpoint-controller:v0.0.2-arm64 --arch=arm64 --os=linux
docker manifest push kinvolk/calico-hostendpoint-controller:v0.0.2
Content type
Image
Digest
Size
61.1 MB
Last updated
over 6 years ago
docker pull logan2211/calico-hostendpoint-controller