Skip to content

Commit ff5ebde

Browse files
salt: Always import images with platform "linux/amd64"
1 parent e2aa698 commit ff5ebde

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

salt/_modules/containerd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def load_cri_image(path, fullname=None):
2626
Path of the Docker image archive to load
2727
"""
2828
log.info('Importing image from "%s" into CRI cache', path)
29-
cmd = f'ctr --debug -n k8s.io image import "{path}"'
29+
cmd = f'ctr --debug -n k8s.io image import --platform "linux/amd64" "{path}"'
3030
if fullname:
3131
cmd += f' --index-name "{fullname}"'
3232
return __salt__["cmd.run_all"](cmd)

salt/tests/unit/modules/test_containerd.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def test_load_cri_image(self, path):
3737
with patch.dict(containerd.__salt__, {"cmd.run_all": mock_cmd}):
3838
self.assertEqual(containerd.load_cri_image(path), cmd)
3939
mock_cmd.assert_called_once_with(
40-
'ctr --debug -n k8s.io image import "{}"'.format(path)
40+
'ctr --debug -n k8s.io image import --platform "linux/amd64" "{}"'.format(
41+
path
42+
)
4143
)
4244

4345
def test_load_cri_image_with_fullname(self):
@@ -61,5 +63,5 @@ def test_load_cri_image_with_fullname(self):
6163
cmd,
6264
)
6365
mock_cmd.assert_called_once_with(
64-
'ctr --debug -n k8s.io image import "/tmp/toto.tar" --index-name "abc.def/my-image:3.5"'
66+
'ctr --debug -n k8s.io image import --platform "linux/amd64" "/tmp/toto.tar" --index-name "abc.def/my-image:3.5"'
6567
)

0 commit comments

Comments
 (0)