Skip to contentSkip to conversation

cri-o: install policy.json to avoid image pulling error

PATCH In review Chen Qi 2 participants 4 messages Feb 17, 2023

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/2 cri-o: install policy.json to avoid image pulling error

We met the following error when using cri-o with k8s.

[ERROR ImagePull]: failed to pull image registry.k8s.io/etcd:3.5.6-0:
rpc error: code = Unknown desc = open /etc/containers/policy.json: no such file or directory"

Install policy.json to /etc/containers/ to fix such error.

---
 recipes-containers/cri-o/cri-o_git.bb | 2 ++
 1 file changed, 2 insertions(+)
recipes-containers/cri-o/cri-o_git.bb +2 -0
index 315659d..f69dc0f 100644
@@ -98,6 +98,8 @@ do_install() {
     install -m 0644 ${S}/src/import/contrib/systemd/crio-wipe.service  ${D}${systemd_unitdir}/system/
 
     install -d ${D}${localstatedir}/lib/crio
+    install -d ${D}${sysconfdir}/containers
+    install -m 0644 ${S}/src/import/contrib/policy.json ${D}${sysconfdir}/containers
 }
 
 FILES:${PN}-config = "${sysconfdir}/crio/config/*"
Signature · 1 line
2.37.1
author
#1 lore raw

PATCH 2/2 cri-o: create registries.conf to avoid image inspection error

When deploying a simple workload using 'kubectl appy -f', we met the following error.

Failed to inspect image "ubuntu:latest": rpc error: code = Unknown desc = short-name "ubuntu:latest" did not resolve to an alias and no containers-registries.conf(5) was found

Create a registries.conf and install it to /etc/containers to fix this issue. The contents come from test/registries.conf in cri-o git repo, with test specific alias removed.

---
 recipes-containers/cri-o/cri-o_git.bb          | 2 ++
 recipes-containers/cri-o/files/registries.conf | 1 +
 2 files changed, 3 insertions(+)
 create mode 100644 recipes-containers/cri-o/files/registries.conf
recipes-containers/cri-o/cri-o_git.bb +2 -0
index f69dc0f..6e58b49 100644
@@ -19,6 +19,7 @@ SRC_URI = "\
 	git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.25;name=cri-o;protocol=https \
 	file://0001-Makefile-force-symlinks.patch \
         file://crio.conf \
+        file://registries.conf \
 	"
 
 # Apache-2.0 for docker
@@ -100,6 +101,7 @@ do_install() {
     install -d ${D}${localstatedir}/lib/crio
     install -d ${D}${sysconfdir}/containers
     install -m 0644 ${S}/src/import/contrib/policy.json ${D}${sysconfdir}/containers
+    install -m 0644 ${WORKDIR}/registries.conf ${D}${sysconfdir}/containers
 }
 
 FILES:${PN}-config = "${sysconfdir}/crio/config/*"
recipes-containers/cri-o/files/registries.conf new file +1 -0
new file mode 100644
index 0000000..0b929da
@@ -0,0 +1 @@
+unqualified-search-registries = ['quay.io' ,'registry.access.redhat.com', 'registry.fedoraproject.org', 'docker.io']
Signature · 1 line
2.37.1
#2 lore raw

Re: [meta-virtualization][PATCH 2/2] cri-o: create registries.conf to avoid image inspection error

Quoted 11 lines · Chen Qi

When deploying a simple workload using 'kubectl appy -f', we met the following error.

Failed to inspect image "ubuntu:latest": rpc error: code = Unknown desc = short-name "ubuntu:latest" did not resolve to an alias and no containers-registries.conf(5) was found

Create a registries.conf and install it to /etc/containers to fix this issue. The contents come from test/registries.conf in cri-o git repo, with test specific alias removed.

This will conflict with skopeo if both are installed in the same image.

Let's drop this patch, as I have a WIP change to create a configuration-only package that adds files like these.

I can clean it up and push it to master-next shortly.

Bruce

Quoted 47 lines
---
 recipes-containers/cri-o/cri-o_git.bb          | 2 ++
 recipes-containers/cri-o/files/registries.conf | 1 +
 2 files changed, 3 insertions(+)
 create mode 100644 recipes-containers/cri-o/files/registries.conf
recipes-containers/cri-o/cri-o_git.bb +2 -0
index f69dc0f..6e58b49 100644
@@ -19,6 +19,7 @@ SRC_URI = "\
        git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.25;name=cri-o;protocol=https \
        file://0001-Makefile-force-symlinks.patch \
         file://crio.conf \
+        file://registries.conf \
        "
 
 # Apache-2.0 for docker
@@ -100,6 +101,7 @@ do_install() {
     install -d ${D}${localstatedir}/lib/crio
     install -d ${D}${sysconfdir}/containers
     install -m 0644 ${S}/src/import/contrib/policy.json ${D}${sysconfdir}/containers
+    install -m 0644 ${WORKDIR}/registries.conf ${D}${sysconfdir}/containers
 }
 
 FILES:${PN}-config = "${sysconfdir}/crio/config/*"
recipes-containers/cri-o/files/registries.conf new file +1 -1
new file mode 100644
index 0000000..0b929da
@@ -0,0 +1 @@
+unqualified-search-registries = ['quay.io' ,'registry.access.redhat.com', 'registry.fedoraproject.org', 'docker.io']
--

2.37.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7865): https://lists.yoctoproject.org/g/meta-virtualization/message/7865
Mute This Topic: https://lists.yoctoproject.org/mt/97025063/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
author
#3 lore raw

RE: [meta-virtualization][PATCH 2/2] cri-o: create registries.conf to avoid image inspection error

Yes, indeed. Thanks a lot for spotting that.
A common configuration-only package does seem to be the most reasonable solution.

Regards,
Qi

-----Original Message-----
From: Bruce Ashfield <[email protected]>
Sent: Friday, February 17, 2023 9:55 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [meta-virtualization][PATCH 2/2] cri-o: create registries.conf to avoid image inspection error

Quoted 11 lines · Chen Qi

When deploying a simple workload using 'kubectl appy -f', we met the following error.

Failed to inspect image "ubuntu:latest": rpc error: code = Unknown desc = short-name "ubuntu:latest" did not resolve to an alias and no containers-registries.conf(5) was found

Create a registries.conf and install it to /etc/containers to fix this issue. The contents come from test/registries.conf in cri-o git repo, with test specific alias removed.

This will conflict with skopeo if both are installed in the same image.

Let's drop this patch, as I have a WIP change to create a configuration-only package that adds files like these.

I can clean it up and push it to master-next shortly.

Bruce

Quoted 45 lines
---
 recipes-containers/cri-o/cri-o_git.bb          | 2 ++
 recipes-containers/cri-o/files/registries.conf | 1 +
 2 files changed, 3 insertions(+)
 create mode 100644 recipes-containers/cri-o/files/registries.conf
recipes-containers/cri-o/cri-o_git.bb +1 -0
index f69dc0f..6e58b49 100644
@@ -19,6 +19,7 @@ SRC_URI = "\
        git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.25;name=cri-o;protocol=https \
        file://0001-Makefile-force-symlinks.patch \
         file://crio.conf \
+        file://registries.conf \
        "
 
 # Apache-2.0 for docker
@@ -100,6 +101,7 @@ do_install() {
     install -d ${D}${localstatedir}/lib/crio
     install -d ${D}${sysconfdir}/containers
     install -m 0644 ${S}/src/import/contrib/policy.json 

${D}${sysconfdir}/containers

recipes-containers/cri-o/cri-o_git.bb +2 -0
+    install -m 0644 ${WORKDIR}/registries.conf 
+ ${D}${sysconfdir}/containers
 }
 
 FILES:${PN}-config = "${sysconfdir}/crio/config/*"
recipes-containers/cri-o/files/registries.conf new file +3 -1
new file mode 100644
index 0000000..0b929da
@@ -0,0 +1 @@
+unqualified-search-registries = ['quay.io' 
+,'registry.access.redhat.com', 'registry.fedoraproject.org', 
+'docker.io']
--

2.37.1

Quoted 11 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#7865):
https://lists.yoctoproject.org/g/meta-virtualization/message/7865
Mute This Topic: https://lists.yoctoproject.org/mt/97025063/1050810
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/meta-virtualization/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II