mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-17 08:53:26 +00:00
kata-deploy: add PULL_TYPE handler for CRI-O
A new PULL_TYPE environment variable is recognized by the kata-deploy's install script to allow it to configure CRIO-O for guest-pull image pulling type. The tests/integration/kubernetes/gha-run.sh change allows for testing it: ``` export PULL_TYPE=guest-pull cd tests/integration/kubernetes ./gha-run.sh deploy-k8s ``` Fixes #9474 Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
parent
647560539f
commit
af4f9afb71
@ -215,6 +215,13 @@ function deploy_kata() {
|
|||||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set the PULL_TYPE_MAPPING
|
||||||
|
if [ "${PULL_TYPE}" != "default" ]; then
|
||||||
|
yq -i \
|
||||||
|
".spec.template.spec.containers[0].env[10].value = \"${KATA_HYPERVISOR}:${PULL_TYPE}\"" \
|
||||||
|
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "::group::Final kata-deploy.yaml that is used in the test"
|
echo "::group::Final kata-deploy.yaml that is used in the test"
|
||||||
cat "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
cat "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||||
grep "${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}" "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" || die "Failed to setup the tests image"
|
grep "${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}" "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" || die "Failed to setup the tests image"
|
||||||
|
@ -24,6 +24,7 @@ spec:
|
|||||||
exec:
|
exec:
|
||||||
command: ["bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh cleanup"]
|
command: ["bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh cleanup"]
|
||||||
command: ["bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh install"]
|
command: ["bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh install"]
|
||||||
|
# NOTE: Please don't change the order of the environment variables below.
|
||||||
env:
|
env:
|
||||||
- name: NODE_NAME
|
- name: NODE_NAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@ -47,6 +48,8 @@ spec:
|
|||||||
value: ""
|
value: ""
|
||||||
- name: AGENT_NO_PROXY
|
- name: AGENT_NO_PROXY
|
||||||
value: ""
|
value: ""
|
||||||
|
- name: PULL_TYPE_MAPPING
|
||||||
|
value: ""
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
@ -32,6 +32,9 @@ snapshotters_delimiter=':'
|
|||||||
AGENT_HTTPS_PROXY="${AGENT_HTTPS_PROXY:-}"
|
AGENT_HTTPS_PROXY="${AGENT_HTTPS_PROXY:-}"
|
||||||
AGENT_NO_PROXY="${AGENT_NO_PROXY:-}"
|
AGENT_NO_PROXY="${AGENT_NO_PROXY:-}"
|
||||||
|
|
||||||
|
PULL_TYPE_MAPPING="${PULL_TYPE_MAPPING:-}"
|
||||||
|
IFS=',' read -a pull_types <<< "$PULL_TYPE_MAPPING"
|
||||||
|
|
||||||
# If we fail for any reason a message will be displayed
|
# If we fail for any reason a message will be displayed
|
||||||
die() {
|
die() {
|
||||||
msg="$*"
|
msg="$*"
|
||||||
@ -426,6 +429,27 @@ function configure_crio_runtime() {
|
|||||||
runtime_config_path = "${kata_config_path}"
|
runtime_config_path = "${kata_config_path}"
|
||||||
privileged_without_host_devices = true
|
privileged_without_host_devices = true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
local key
|
||||||
|
local value
|
||||||
|
if [ -n "${PULL_TYPE_MAPPING}" ]; then
|
||||||
|
for m in "${pull_types[@]}"; do
|
||||||
|
key="${m%"$snapshotters_delimiter"*}"
|
||||||
|
value="${m#*"$snapshotters_delimiter"}"
|
||||||
|
|
||||||
|
if [[ "${value}" = "default" || "${key}" != "${shim}" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${value}" == "guest-pull" ]; then
|
||||||
|
echo -e "\truntime_pull_image = true" | \
|
||||||
|
tee -a "$crio_drop_in_conf_file"
|
||||||
|
else
|
||||||
|
die "Unsupported pull type '$value' for ${shim}"
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_crio() {
|
function configure_crio() {
|
||||||
@ -616,6 +640,7 @@ function main() {
|
|||||||
echo "* SNAPSHOTTER_HANDLER_MAPPING: ${SNAPSHOTTER_HANDLER_MAPPING}"
|
echo "* SNAPSHOTTER_HANDLER_MAPPING: ${SNAPSHOTTER_HANDLER_MAPPING}"
|
||||||
echo "* AGENT_HTTPS_PROXY: ${AGENT_HTTPS_PROXY}"
|
echo "* AGENT_HTTPS_PROXY: ${AGENT_HTTPS_PROXY}"
|
||||||
echo "* AGENT_NO_PROXY: ${AGENT_NO_PROXY}"
|
echo "* AGENT_NO_PROXY: ${AGENT_NO_PROXY}"
|
||||||
|
echo "* PULL_TYPE_MAPPING: ${PULL_TYPE_MAPPING}"
|
||||||
|
|
||||||
# script requires that user is root
|
# script requires that user is root
|
||||||
euid=$(id -u)
|
euid=$(id -u)
|
||||||
|
Loading…
Reference in New Issue
Block a user