kuryr-kubernetes/tools/build_cni_daemonset_image
Michał Dulko 18db649943 Support kuryr-daemon when running containerized
This commit implements kuryr-daemon support when
KURYR_K8S_CONTAINERIZED_DEPLOYMENT=True. It's done by:

* CNI docker image installs Kuryr-Kubernetes pip package and adds
  exectution of kuryr-daemon into entrypoint script.
* Hosts /proc and /var/run/openvswitch are mounted into the CNI
  container.
* Code is changed to use /host_proc instead of /proc when in a container
  (it's impossible to mount host's /proc into container's /proc).

Implements: blueprint cni-split-exec-daemon

Change-Id: I9155a2cba28f578cee129a4c40066209f7ab543d
2017-12-13 11:45:22 +01:00

29 lines
723 B
Bash
Executable File

#!/bin/bash -ex
CNI_BIN_DIR=$1
CNI_CONF_DIR=$2
CNI_DAEMON=${3:-"False"}
BUILDER_TAG="kuryr/cni-builder"
CNI_TAG="kuryr/cni"
# build the cni image
if [ -z "$CNI_BIN_DIR" ] && [ -z "$CNI_CONF_DIR" ]; then
docker build -t "$BUILDER_TAG" -f cni_builder.Dockerfile .
else
docker build -t "$BUILDER_TAG" \
--build-arg "CNI_BIN_DIR_PATH=$CNI_BIN_DIR" \
--build-arg "CNI_CONFIG_DIR_PATH=$CNI_CONF_DIR" \
--build-arg "CNI_DAEMON=$CNI_DAEMON" \
-f cni_builder.Dockerfile .
fi
docker run \
--rm \
-v $(pwd):/opt/kuryr-kubernetes \
"$BUILDER_TAG":latest
# create cni daemonset image
docker build -t "$CNI_TAG" \
--build-arg "CNI_DAEMON=$CNI_DAEMON" \
-f cni.Dockerfile .