1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-10 01:16:42 +00:00

osbuilder: Allow image registry to be customizable

Give the user chance to specify their own registry in event the default
provided are not accessible, desirable.

Fixes: 

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
This commit is contained in:
Eric Ernst 2021-02-10 12:32:55 -08:00
parent cb6d2f3c40
commit 49bdbac606
2 changed files with 28 additions and 11 deletions
tools/osbuilder
image-builder
rootfs-builder

View File

@ -84,14 +84,15 @@ Options:
-r Free space of the root partition in MB ENV: ROOT_FREE_SPACE
Extra environment variables:
AGENT_BIN: Use it to change the expected agent binary name
AGENT_INIT: Use kata agent as init process
FS_TYPE: Filesystem type to use. Only xfs and ext4 are supported.
NSDAX_BIN: Use to specify path to pre-compiled 'nsdax' tool.
USE_DOCKER: If set will build image in a Docker Container (requries docker)
DEFAULT: not set
USE_PODMAN: If set and USE_DOCKER not set, will build image in a Podman Container (requries podman)
DEFAULT: not set
AGENT_BIN: Use it to change the expected agent binary name
AGENT_INIT: Use kata agent as init process
IMAGE_REGISTRY: Hostname for the image registry used to pull down the rootfs build image.
FS_TYPE: Filesystem type to use. Only xfs and ext4 are supported.
NSDAX_BIN: Use to specify path to pre-compiled 'nsdax' tool.
USE_DOCKER: If set will build image in a Docker Container (requries docker)
DEFAULT: not set
USE_PODMAN: If set and USE_DOCKER not set, will build image in a Podman Container (requries podman)
DEFAULT: not set
Following diagram shows how the resulting image will look like
@ -137,7 +138,13 @@ build_with_container() {
image_dir=$(readlink -f "$(dirname "${image}")")
image_name=$(basename "${image}")
REGISTRY_ARG=""
if [ -n "${IMAGE_REGISTRY}" ]; then
REGISTRY_ARG="--build-arg IMAGE_REGISTRY=${IMAGE_REGISTRY}"
fi
"${container_engine}" build \
${REGISTRY_ARG} \
--build-arg http_proxy="${http_proxy}" \
--build-arg https_proxy="${https_proxy}" \
-t "${container_image_name}" "${script_dir}"

View File

@ -100,13 +100,13 @@ AGENT_INIT When set to "yes", use ${AGENT_BIN} as init process in place
of systemd.
Default value: no
AGENT_VERSION Version of the agent to include in the rootfs.
Default value: ${AGENT_VERSION:-<not set>}
AGENT_SOURCE_BIN Path to the directory of agent binary.
If set, use the binary as agent but not build agent package.
Default value: <not set>
AGENT_VERSION Version of the agent to include in the rootfs.
Default value: ${AGENT_VERSION:-<not set>}
DISTRO_REPO Use host repositories to install guest packages.
Default value: <not set>
@ -123,6 +123,10 @@ GRACEFUL_EXIT If set, and if the DISTRO configuration specifies a
specific distributions.
Default value: <not set>
IMAGE_REGISTRY Hostname for the image registry used to pull down the rootfs
build image.
Default value: docker.io
KERNEL_MODULES_DIR Path to a directory containing kernel modules to include in
the rootfs.
Default value: <empty>
@ -371,9 +375,15 @@ build_rootfs_distro()
image_name="${distro}-rootfs-osbuilder"
REGISTRY_ARG=""
if [ -n "${IMAGE_REGISTRY}" ]; then
REGISTRY_ARG="--build-arg IMAGE_REGISTRY=${IMAGE_REGISTRY}"
fi
# setup to install go or rust here
generate_dockerfile "${distro_config_dir}"
"$container_engine" build \
${REGISTRY_ARG} \
--build-arg http_proxy="${http_proxy}" \
--build-arg https_proxy="${https_proxy}" \
-t "${image_name}" "${distro_config_dir}"