You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using make run-on-kind to deploy a cluster, the image referenced by ${BPFMAN_IMG} is not loaded into the KIND cluster. As a result, Kubernetes resolves and always pulls the bpfman image from quay.io, even if a locally built version of the bpfman image with the same tag exists. This behaviour occurs because the image pull policy is set to IfNotPresent, which should prevent pulling the image if it already exists locally, but since the image is tagged with :latest, Kubernetes defaults to pulling it from the remote registry.
Note: The digest ea8fc9e10bf9b83ce6e289848010bd1672a9bc4b4d41af1599ec570434a99661 in the cluster matches the output from skopeo; the image was pulled from quay.io. And the repoDigests also references quay.io.
If we contrast with the ${BPFMAN_OPERATOR_IMG} image, which is explicitly loaded into the cluster, we see that it was imported:
Although a local bpfman image was built and tagged correctly, when make run-on-kind is executed, the KIND cluster pulls the bpfman image from quay.io. This happens because the image reference in the Makefile ${BPFMAN_IMG} (which defaults to quay.io/bpfman/bpfman:latest) was not explicitly loaded into the cluster; we only explicitly load the operator and agent images. Due to the use of the :latest tag, Kubernetes defaults to pulling the image from the remote registry, quay.io, bypassing the locally built bpfman image with the same tag.
Workaround
To use a locally built bpfman image, avoid tagging the image as :latest, or explicitly set imagePullPolicy: Never in the daemonset deployment.
Fix
Update the call to ./hack/kind-load-image.sh in the Makefile target load-images-kind to always load whatever is referenced in ${BPFMAN_IMG}. This will ensure that the BPFMAN_IMG is explicitly loaded into the KIND cluster, preventing Kubernetes from pulling the image from quay.io and ensuring the locally built bpfman image is used instead.
If we load the bpfman image ala:
.PHONY: load-images-kind
load-images-kind: ## Load bpfman, bpfman-agent, and bpfman-operator images into the running local kind devel cluster.
./hack/kind-load-image.sh ${KIND_CLUSTER_NAME}${BPFMAN_OPERATOR_IMG}${BPFMAN_AGENT_IMG}${BPFMAN_IMG}
$ make run-on-kind
$ oc logs -n bpfman bpfman-daemon-znxzm
Defaulted container "bpfman" out of: bpfman, bpfman-agent, node-driver-registrar, mount-bpffs (init)
Hello world
[INFO bpfman_rpc::serve] Using no inactivity timer
[INFO bpfman_rpc::serve] Using default Unix socket
[INFO bpfman_rpc::serve] Listening on /run/bpfman-sock/bpfman.sock
[INFO bpfman_rpc::storage] CSI Plugin Listening on /run/bpfman/csi/csi.sock
To avoid any surprises in local development I would recommend local image references only:
Fix an issue where the bpfman image referenced by `${BPFMAN_IMG}` is not
loaded into the Kind cluster when using `make run-on-kind`. This
resulted in Kubernetes pulling the image from quay.io, even if a locally
built version with the same tag exists.
Fixes: bpfman#105.
Signed-off-by: Andrew McDermott <amcdermo@redhat.com>
msherif1234
pushed a commit
to msherif1234/bpfman-operator
that referenced
this issue
Nov 19, 2024
When using
make run-on-kind
to deploy a cluster, the image referenced by${BPFMAN_IMG}
is not loaded into the KIND cluster. As a result, Kubernetes resolves and always pulls the bpfman image fromquay.io
, even if a locally built version of the bpfman image with the same tag exists. This behaviour occurs because the image pull policy is set toIfNotPresent
, which should prevent pulling the image if it already exists locally, but since the image is tagged with:latest
, Kubernetes defaults to pulling it from the remote registry.This pull behaviour is called out in https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster.
Steps to Reproduce
Build a
bpfman
image locally:Make a modification to bpfman; for example:
Build your changes:
Verify the locally built image exists:
$ podman images | grep bpfman quay.io/bpfman/bpfman latest b0655bd63d58 6 seconds ago 1.81 GB quay.io/bpfman/bpfman-agent latest a54235a7988d 28 minutes ago 492 MB quay.io/bpfman/bpfman-operator latest ca65b12695e5 29 minutes ago 178 MB
Verify your change shows up:
Which it doesn't.
% oc logs -n bpfman bpfman-daemon-gfj9p Defaulted container "bpfman" out of: bpfman, bpfman-agent, node-driver-registrar, mount-bpffs (init) [INFO bpfman_rpc::serve] Using no inactivity timer [INFO bpfman_rpc::serve] Using default Unix socket [INFO bpfman_rpc::serve] Listening on /run/bpfman-sock/bpfman.sock [INFO bpfman_rpc::storage] CSI Plugin Listening on /run/bpfman/csi/csi.sock
Verify the remote SHA using skopeo without pulling the image:
$ skopeo inspect docker://quay.io/bpfman/bpfman:latest --format '{{.Digest}}' sha256:ea8fc9e10bf9b83ce6e289848010bd1672a9bc4b4d41af1599ec570434a99661
Run
make run-on-kind
to deploy the cluster:Check the running pods in the
bpfman
namespace:Enter the kind cluster and inspect the digest for the bpfman image:
Note: The digest
ea8fc9e10bf9b83ce6e289848010bd1672a9bc4b4d41af1599ec570434a99661
in the cluster matches the output from skopeo; the image was pulled fromquay.io
. And therepoDigests
also references quay.io.If we contrast with the
${BPFMAN_OPERATOR_IMG}
image, which is explicitly loaded into the cluster, we see that it was imported:Conclusion
Although a local bpfman image was built and tagged correctly, when
make run-on-kind
is executed, the KIND cluster pulls the bpfman image fromquay.io
. This happens because the image reference in the Makefile${BPFMAN_IMG}
(which defaults toquay.io/bpfman/bpfman:latest
) was not explicitly loaded into the cluster; we only explicitly load the operator and agent images. Due to the use of the:latest
tag, Kubernetes defaults to pulling the image from the remote registry,quay.io
, bypassing the locally built bpfman image with the same tag.Workaround
To use a locally built
bpfman
image, avoid tagging the image as:latest
, or explicitly setimagePullPolicy: Never
in the daemonset deployment.Fix
Update the call to
./hack/kind-load-image.sh
in the Makefile targetload-images-kind
to always load whatever is referenced in${BPFMAN_IMG}
. This will ensure that the BPFMAN_IMG is explicitly loaded into the KIND cluster, preventing Kubernetes from pulling the image from quay.io and ensuring the locally built bpfman image is used instead.If we load the bpfman image ala:
$ oc logs -n bpfman bpfman-daemon-znxzm Defaulted container "bpfman" out of: bpfman, bpfman-agent, node-driver-registrar, mount-bpffs (init) Hello world [INFO bpfman_rpc::serve] Using no inactivity timer [INFO bpfman_rpc::serve] Using default Unix socket [INFO bpfman_rpc::serve] Listening on /run/bpfman-sock/bpfman.sock [INFO bpfman_rpc::storage] CSI Plugin Listening on /run/bpfman/csi/csi.sock
To avoid any surprises in local development I would recommend local image references only:
The text was updated successfully, but these errors were encountered: