@@ -405,6 +405,9 @@ def _scale_pods(self, scale_types):
405405 # see if the app config has deploy timeout preference, otherwise use global
406406 deploy_timeout = release .config .values .get ('DEIS_DEPLOY_TIMEOUT' , settings .DEIS_DEPLOY_TIMEOUT ) # noqa
407407
408+ # get application level pod termination grace period
409+ pod_termination_grace_period_seconds = release .config .values .get ('KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS' , settings .KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS ) # noqa
410+
408411 tasks = []
409412 for scale_type , replicas in scale_types .items ():
410413 # only web / cmd are routable
@@ -433,6 +436,7 @@ def _scale_pods(self, scale_types):
433436 'routable' : routable ,
434437 'deploy_batches' : batches ,
435438 'deploy_timeout' : deploy_timeout ,
439+ 'pod_termination_grace_period_seconds' : pod_termination_grace_period_seconds ,
436440 }
437441
438442 # gather all proc types to be deployed
@@ -486,6 +490,9 @@ def deploy(self, release, force_deploy=False):
486490
487491 deployment_history = release .config .values .get ('KUBERNETES_DEPLOYMENTS_REVISION_HISTORY_LIMIT' , settings .KUBERNETES_DEPLOYMENTS_REVISION_HISTORY_LIMIT ) # noqa
488492
493+ # get application level pod termination grace period
494+ pod_termination_grace_period_seconds = release .config .values .get ('KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS' , settings .KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS ) # noqa
495+
489496 # deploy application to k8s. Also handles initial scaling
490497 deploys = {}
491498 image = release .image
@@ -512,7 +519,6 @@ def deploy(self, release, force_deploy=False):
512519 'tags' : tags ,
513520 'envs' : envs ,
514521 'registry' : release .config .registry ,
515- # only used if there is no previous RC
516522 'replicas' : replicas ,
517523 'version' : version ,
518524 'app_type' : scale_type ,
@@ -522,7 +528,8 @@ def deploy(self, release, force_deploy=False):
522528 'deploy_batches' : batches ,
523529 'deploy_timeout' : deploy_timeout ,
524530 'deployment_history_limit' : deployment_history ,
525- 'release_summary' : release .summary
531+ 'release_summary' : release .summary ,
532+ 'pod_termination_grace_period_seconds' : pod_termination_grace_period_seconds ,
526533 }
527534
528535 # Sort deploys so routable comes first
@@ -729,6 +736,9 @@ def pod_name(size=5, chars=string.ascii_lowercase + string.digits):
729736 # see if the app config has deploy timeout preference, otherwise use global
730737 deploy_timeout = release .config .values .get ('DEIS_DEPLOY_TIMEOUT' , settings .DEIS_DEPLOY_TIMEOUT ) # noqa
731738
739+ # get application level pod termination grace period
740+ pod_termination_grace_period_seconds = release .config .values .get ('KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS' , settings .KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS ) # noqa
741+
732742 name = self ._get_job_id (scale_type ) + '-' + pod_name ()
733743 self .log ("{} on {} runs '{}'" .format (user .username , name , command ))
734744
@@ -743,7 +753,8 @@ def pod_name(size=5, chars=string.ascii_lowercase + string.digits):
743753 'registry' : release .config .registry ,
744754 'version' : version ,
745755 'build_type' : release .build .type ,
746- 'deploy_timeout' : deploy_timeout
756+ 'deploy_timeout' : deploy_timeout ,
757+ 'pod_termination_grace_period_seconds' : pod_termination_grace_period_seconds ,
747758 }
748759
749760 try :
0 commit comments