summaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authorDmitry Puzikov <dmitry.puzikov@tieto.com>2019-04-25 14:53:03 +0200
committerAlexis de Talhouƫt <adetalhouet89@gmail.com>2019-05-10 17:53:28 +0000
commit0c588d5a5e55dbe77d06e6a9e188ac60fccee632 (patch)
treed106dea4d2c69591fe5caafd4335fc7fd7a7451f /kubernetes
parentd0101df34803d6266c8ae3be2be3befd79e459de (diff)
Add deviation in readiness check sleep time
Added some random delay avoiding massive parallel call of k8s API by multiple readiness-check containers Change-Id: Ia5e6e49b91db9f0339ab828734eedb94eb3029cb Issue-ID: INT-1045 Signed-off-by: Dmitry Puzikov <dmitry.puzikov@tieto.com>
Diffstat (limited to 'kubernetes')
-rw-r--r--kubernetes/readiness/docker/init/job_complete.py4
-rw-r--r--kubernetes/readiness/docker/init/ready.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/kubernetes/readiness/docker/init/job_complete.py b/kubernetes/readiness/docker/init/job_complete.py
index 2b3180aa2e..b20cb5adec 100644
--- a/kubernetes/readiness/docker/init/job_complete.py
+++ b/kubernetes/readiness/docker/init/job_complete.py
@@ -4,6 +4,7 @@ import logging
import os
import sys
import time
+import random
from kubernetes import client
@@ -91,7 +92,8 @@ def main(argv):
log.warning("timed out waiting for '" + job_name + "' to be completed")
exit(1)
else:
- time.sleep(5)
+ # spread in time potentially parallel execution in multiple containers
+ time.sleep(random.randint(5, 11))
if __name__ == "__main__":
main(sys.argv[1:]) \ No newline at end of file
diff --git a/kubernetes/readiness/docker/init/ready.py b/kubernetes/readiness/docker/init/ready.py
index 20872f9897..0e133eab01 100644
--- a/kubernetes/readiness/docker/init/ready.py
+++ b/kubernetes/readiness/docker/init/ready.py
@@ -4,6 +4,7 @@ import logging
import os
import sys
import time
+import random
from kubernetes import client
@@ -154,7 +155,8 @@ def main(argv):
log.warning("timed out waiting for '" + container_name + "' to be ready")
exit(1)
else:
- time.sleep(5)
+ # spread in time potentially parallel execution in multiple containers
+ time.sleep(random.randint(5, 11))
if __name__ == "__main__":
main(sys.argv[1:])