This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 763f4dd Stop loading registry images into Kind in the test scripts
(#860)
763f4dd is described below
commit 763f4dd8690a561ca7194554f2754b2d265f877b
Author: Jan Høydahl <[email protected]>
AuthorDate: Sun Oct 25 20:28:17 2026 +0100
Stop loading registry images into Kind in the test scripts (#860)
---
hack/release/smoke_test/test_cluster.sh | 52 ++++++++++++++++++++++++--------
tests/scripts/manage_e2e_tests.sh | 53 ++++++++++++++++++++-------------
2 files changed, 73 insertions(+), 32 deletions(-)
diff --git a/hack/release/smoke_test/test_cluster.sh
b/hack/release/smoke_test/test_cluster.sh
index 2ee3e43..4af018e 100755
--- a/hack/release/smoke_test/test_cluster.sh
+++ b/hack/release/smoke_test/test_cluster.sh
@@ -148,6 +148,25 @@ else
SOLR_HELM_CHART="apache-solr-test-${VERSION}/solr"
fi
+# Decide how the Solr Operator image gets into the Kind cluster.
+#
+# When LOCATION is a URL the image was just pulled from a registry, so the
Kind nodes can
+# pull it themselves. When LOCATION is a local path the image is typically a
local build that
+# exists nowhere else, so it has to be loaded into the nodes and must never be
pulled.
+#
+# Only locally built images are loaded. Loading a registry image fails with
Docker's
+# containerd image store (the default since Docker Engine 29): 'kind load
docker-image'
+# exports the full multi-platform index, but only the host platform's content
was pulled,
+# so the import dies with "content digest sha256:...: not found".
+# See https://github.com/kubernetes-sigs/kind/issues/3795
+if (echo "${LOCATION}" | grep -q "http"); then
+ LOAD_OPERATOR_IMAGE=false
+ OPERATOR_PULL_POLICY="IfNotPresent"
+else
+ LOAD_OPERATOR_IMAGE=true
+ OPERATOR_PULL_POLICY="Never"
+fi
+
# The charts published to an OCI registry are the same artifacts that were
staged at
# LOCATION, so only where the charts are pulled from changes. CRDs still come
from LOCATION.
# Unlike a helm repo, an OCI reference has no index, so the version must be
given explicitly.
@@ -174,19 +193,28 @@ fi
echo "Create test Kubernetes ${KUBERNETES_VERSION} cluster in Kind. This will
allow us to test the CRDs, Helm chart and the Docker image."
kind create cluster --name "${CLUSTER_NAME}" --image
"kindest/node:${KUBERNETES_VERSION}"
-# Load the docker images into the cluster
-if (docker image inspect "${IMAGE}" &>/dev/null); then
- kind load docker-image --name "${CLUSTER_NAME}" "${IMAGE}"
- printf "\nUsing local version of Solr Operator image \"${IMAGE}\".\nIf you
want to use an updated version of this image, run \"docker pull ${SOLR_IMAGE}\"
before running the smoke test again.\n\n"
-else
- printf "\nUsing the remote Solr Operator image \"${IMAGE}\", since it was
not found in the local Docker image list.\n\n"
-fi
-if (docker image inspect "${SOLR_IMAGE}" &>/dev/null); then
- kind load docker-image --name "${CLUSTER_NAME}" "${SOLR_IMAGE}"
- printf "\nUsing local version of Solr image \"${SOLR_IMAGE}\".\nIf you want
to use an updated version of this image, run \"docker pull ${SOLR_IMAGE}\"
before running the smoke test again.\n\n"
+# Load the Solr Operator image into the cluster, but only when it is a local
build.
+# The Solr image is never loaded: it always comes from a registry, and the
Kind nodes pull it.
+if [[ "${LOAD_OPERATOR_IMAGE}" = true ]]; then
+ if ! (docker image inspect "${IMAGE}" &>/dev/null); then
+ echo "Solr Operator image \"${IMAGE}\" was not found locally. Build it
locally before running this smoke test with a local artifact location." >&2
+ exit 1
+ fi
+ printf "\nLoading local Solr Operator image \"${IMAGE}\" into the Kind
cluster.\n\n"
+ if ! kind load docker-image --name "${CLUSTER_NAME}" "${IMAGE}"; then
+ cat >&2 <<ERR
+
+Failed to load "${IMAGE}" into Kind. If the error above mentions a missing
content digest,
+Docker's containerd image store exported a multi-platform index whose content
is not all
+present locally. Only locally built, single-platform images can be loaded this
way.
+See https://github.com/kubernetes-sigs/kind/issues/3795
+ERR
+ exit 1
+ fi
else
- printf "\nUsing the remote Solr image \"${SOLR_IMAGE}\", since it was not
found in the local Docker image list.\n\n"
+ printf "\nThe Kind nodes will pull the Solr Operator image \"${IMAGE}\" from
its registry.\n\n"
fi
+printf "The Kind nodes will pull the Solr image \"${SOLR_IMAGE}\" from its
registry.\n\n"
# Add a temporary directory for backups
docker exec "${CLUSTER_NAME}-control-plane" bash -c "mkdir -p /tmp/backup"
@@ -211,7 +239,7 @@ kubectl create -f
"${LOCATION}/crds/all-with-dependencies.yaml" || kubectl repla
helm install --kube-context "${KUBE_CONTEXT}" ${VERIFY_OR_NOT} solr-operator
"${OP_HELM_CHART}" ${CHART_VERSION_ARG[@]+"${CHART_VERSION_ARG[@]}"} \
--set-string image.tag="${IMAGE##*:}" \
--set image.repository="${IMAGE%%:*}" \
- --set image.pullPolicy="Never"
+ --set image.pullPolicy="${OPERATOR_PULL_POLICY}"
printf "\nInstall a test Solr Cluster\n"
helm install --kube-context "${KUBE_CONTEXT}" ${VERIFY_OR_NOT} example
"${SOLR_HELM_CHART}" ${CHART_VERSION_ARG[@]+"${CHART_VERSION_ARG[@]}"} \
diff --git a/tests/scripts/manage_e2e_tests.sh
b/tests/scripts/manage_e2e_tests.sh
index c9cfd7f..12fb282 100755
--- a/tests/scripts/manage_e2e_tests.sh
+++ b/tests/scripts/manage_e2e_tests.sh
@@ -36,11 +36,12 @@ Available actions are: run-tests, create-cluster,
destroy-cluster, kubeconfig
-i Solr Operator docker image to use (Optional, defaults to
apache/solr-operator:<version>)
-k Kubernetes Version to test with (full tag, e.g. v1.24.16) (Optional,
defaults to a compatible version)
-s Full solr image, or image tag (for the official Solr image), to test
with (e.g. apache/solr-nightly:9.4.0, 9.10.0). (Optional, defaults to a
compatible version)
- -a Load additional local images into the test Kubernetes cluster. Provide
option multiple times for multiple images. (Optional)
+ -a Load additional locally built images into the test Kubernetes cluster.
Provide option multiple times for multiple images. (Optional)
+ Only images that exist nowhere but the local Docker need this; images
from a registry are pulled by the Kind nodes.
EOF
}
-ADDITIONAL_IMAGES=("pravega/zookeeper:0.2.15")
+ADDITIONAL_IMAGES=()
OPTIND=1
while getopts hv:i:k:s:a: opt; do
case $opt in
@@ -100,20 +101,30 @@ export RAWFILE_LOCAL_PV_VERSION=0.13.1
export CERT_MANAGER_VERSION=1.17.4
export CERT_MANAGER_CSI_DRIVER_VERSION=0.5.0
-function add_image_to_kind_repo_if_local() {
+# Load a locally built image into the Kind cluster. Images that come from a
registry are
+# never loaded; the Kind nodes pull those themselves.
+#
+# Loading a registry image fails with Docker's containerd image store (the
default since
+# Docker Engine 29): 'kind load docker-image' exports the full multi-platform
index, but only
+# the host platform's content was pulled, so the import dies with
+# "content digest sha256:...: not found". See
https://github.com/kubernetes-sigs/kind/issues/3795
+function load_local_image_into_kind() {
IMAGE="$1"
- PULL_IF_NOT_LOCAL="$2"
- if (docker image inspect "${IMAGE}" &>/dev/null); then
- printf "\nUsing local version of image \"%s\".\nIf you want to use an
updated version of this image, run \"docker pull %s\" before running the
integration tests again.\n\n" "${IMAGE}" "${IMAGE}"
- kind load docker-image --name "${CLUSTER_NAME}" "${IMAGE}"
- else
- if [ "${PULL_IF_NOT_LOCAL}" = true ]; then
- printf "\nPulling image \"%s\" since it was not found locally.\n\n"
"${IMAGE}"
- docker pull "${IMAGE}"
- kind load docker-image --name "${CLUSTER_NAME}" "${IMAGE}"
- else
- printf "\nUsing the remote image \"%s\", since it was not found in the
local Docker image list.\n\n" "${IMAGE}"
- fi
+ if ! (docker image inspect "${IMAGE}" &>/dev/null); then
+ printf "\nUsing the remote image \"%s\", since it was not found in the
local Docker image list.\n\n" "${IMAGE}"
+ return
+ fi
+ printf "\nLoading local image \"%s\" into the Kind cluster.\n\n" "${IMAGE}"
+ if ! kind load docker-image --name "${CLUSTER_NAME}" "${IMAGE}"; then
+ cat >&2 <<ERR
+
+Failed to load "${IMAGE}" into Kind. If the error above mentions a missing
content digest,
+Docker's containerd image store exported a multi-platform index whose content
is not all
+present locally. Only locally built, single-platform images can be loaded this
way; images
+from a registry should not be loaded at all, the Kind nodes pull them.
+See https://github.com/kubernetes-sigs/kind/issues/3795
+ERR
+ exit 1
fi
}
@@ -174,12 +185,14 @@ function start_cluster() {
}
function setup_cluster() {
- # Load the docker images into the cluster
- add_image_to_kind_repo_if_local "${OPERATOR_IMAGE}" false
- add_image_to_kind_repo_if_local "${SOLR_IMAGE}" true
- for IMAGE in "${ADDITIONAL_IMAGES[@]}"; do
- add_image_to_kind_repo_if_local "${IMAGE}" true
+ # Only locally built images are loaded into the cluster. The Solr and
Zookeeper images
+ # always come from a registry, so the Kind nodes pull them.
+ load_local_image_into_kind "${OPERATOR_IMAGE}"
+ # The array may be empty, and bash < 4.4 treats "${arr[@]}" on an empty
array as unbound under 'set -u'.
+ for IMAGE in ${ADDITIONAL_IMAGES[@]+"${ADDITIONAL_IMAGES[@]}"}; do
+ load_local_image_into_kind "${IMAGE}"
done
+ printf "The Kind nodes will pull the Solr image \"%s\" from its
registry.\n\n" "${SOLR_IMAGE}"
printf "Installing Solr & Zookeeper CRDs\n"
kubectl create -f "${REPO_DIR}/config/crd/bases/" 2>/dev/null || kubectl
replace -f "${REPO_DIR}/config/crd/bases/"