Change entry point busy loop to 'sleep infinity'

When the Kubernetes, OpenShift or OpenShiftPods drivers start a
container, they replace the image entrypoint by a busy loop:

  /bin/sh -c 'while true; do sleep 30; done;'

The argument to sleep is parsed as a floating point number via
strtold(3) which states:

  An infinity is either "INF" or "INFINITY", disregarding case.

Remove the `while true` and sleep for eternity instead.

Change-Id: Icc05403c594bae996a2b5a61bb1ad56b2e2fb735
This commit is contained in:
Antoine Musso
2025-06-04 21:47:33 +02:00
parent 9389e9e8aa
commit 7176b3df79
11 changed files with 15 additions and 15 deletions

View File

@@ -528,4 +528,4 @@ Selecting the kubernetes driver adds the following options to the
image: ubuntu:jammy
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args: ["while true; do sleep 30; done;"]
args: ["sleep infinity"]

View File

@@ -458,4 +458,4 @@ Selecting the openshift pods driver adds the following options to the
image: ubuntu:jammy
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args: ["while true; do sleep 30; done;"]
args: ["sleep infinity"]

View File

@@ -542,4 +542,4 @@ Selecting the openshift driver adds the following options to the
image: ubuntu:jammy
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args: ["while true; do sleep 30; done;"]
args: ["sleep infinity"]

View File

@@ -354,7 +354,7 @@ class KubernetesProvider(Provider, QuotaSupport):
'image': label.image,
'imagePullPolicy': label.image_pull,
'command': ["/bin/sh", "-c"],
'args': ["while true; do sleep 30; done;"],
'args': ["sleep infinity"],
'env': label.env,
}

View File

@@ -257,7 +257,7 @@ class OpenshiftProvider(Provider, QuotaSupport):
'image': label.image,
'imagePullPolicy': label.image_pull,
'command': ["/bin/sh", "-c"],
'args': ["while true; do sleep 30; done;"],
'args': ["sleep infinity"],
'env': label.env,
}

View File

@@ -62,4 +62,4 @@ providers:
image: ubuntu:jammy
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args: ["while true; do sleep 30; done;"]
args: ["sleep infinity"]

View File

@@ -67,4 +67,4 @@ providers:
image: ubuntu:jammy
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args: ["while true; do sleep 30; done;"]
args: ["sleep infinity"]

View File

@@ -40,4 +40,4 @@ providers:
image: ubuntu:jammy
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
args: ["while true; do sleep 30; done;"]
args: ["sleep infinity"]

View File

@@ -155,7 +155,7 @@ class TestDriverKubernetes(tests.DBTestCase):
'image': 'docker.io/fedora:28',
'imagePullPolicy': 'IfNotPresent',
'command': ['/bin/sh', '-c'],
'args': ['while true; do sleep 30; done;'],
'args': ['sleep infinity'],
'env': []
}],
})
@@ -206,7 +206,7 @@ class TestDriverKubernetes(tests.DBTestCase):
})
self.assertEqual(pod['spec'], {
'containers': [{
'args': ['while true; do sleep 30; done;'],
'args': ['sleep infinity'],
'command': ['/bin/sh', '-c'],
'env': [],
'image': 'docker.io/fedora:28',
@@ -655,7 +655,7 @@ class TestDriverKubernetes(tests.DBTestCase):
'image': 'ubuntu:jammy',
'imagePullPolicy': 'IfNotPresent',
'command': ['/bin/sh', '-c'],
'args': ['while true; do sleep 30; done;'],
'args': ['sleep infinity'],
}],
})

View File

@@ -185,7 +185,7 @@ class TestDriverOpenshift(tests.DBTestCase):
'image': 'docker.io/fedora:28',
'imagePullPolicy': 'IfNotPresent',
'command': ['/bin/sh', '-c'],
'args': ['while true; do sleep 30; done;'],
'args': ['sleep infinity'],
'env': []
}],
'imagePullSecrets': [],
@@ -239,7 +239,7 @@ class TestDriverOpenshift(tests.DBTestCase):
})
self.assertEqual(pod['spec'], {
'containers': [{
'args': ['while true; do sleep 30; done;'],
'args': ['sleep infinity'],
'command': ['/bin/sh', '-c'],
'env': [],
'image': 'docker.io/fedora:28',
@@ -661,7 +661,7 @@ class TestDriverOpenshift(tests.DBTestCase):
'image': 'ubuntu:jammy',
'imagePullPolicy': 'IfNotPresent',
'command': ['/bin/sh', '-c'],
'args': ['while true; do sleep 30; done;'],
'args': ['sleep infinity'],
}],
})

View File

@@ -485,7 +485,7 @@ class TestDriverOpenshiftPods(tests.DBTestCase):
'image': 'ubuntu:jammy',
'imagePullPolicy': 'IfNotPresent',
'command': ['/bin/sh', '-c'],
'args': ['while true; do sleep 30; done;'],
'args': ['sleep infinity'],
}],
})