Repository: cdk8s-team/cdk8s-plus
Pull request #2029 (2023-05-23 17:04:05)

feat(pod): termination grace period (#2026)
# Backport

This will backport the following commits from `k8s-26/main` to `k8s-24/main`:
 - [feat(pod): termination grace period (#2026)](https://github.com/cdk8s-team/cdk8s-plus/pull/2026)

<!--- Backport version: 8.5.0 -->

### Questions ?
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)


Patch:
diff --git a/src/pod.ts b/src/pod.ts
index fe294e2f..db6ea332 100644
--- a/src/pod.ts
+++ b/src/pod.ts
@@ -20,6 +20,7 @@ export abstract class AbstractPod extends base.Resource implements IPodSelector,
   public readonly dockerRegistryAuth?: secret.ISecret;
   public readonly automountServiceAccountToken: boolean;
   public readonly hostNetwork?: boolean;
+  public readonly terminationGracePeriod?: Duration;
 
   protected readonly isolate: boolean;
 
@@ -41,6 +42,7 @@ export abstract class AbstractPod extends base.Resource implements IPodSelector,
     this.automountServiceAccountToken = props.automountServiceAccountToken ?? false;
     this.isolate = props.isolate ?? false;
     this.hostNetwork = props.hostNetwork ?? false;
+    this.terminationGracePeriod = props.terminationGracePeriod ?? Duration.seconds(30);
 
     if (props.containers) {
       props.containers.forEach(c => this.addContainer(c));
@@ -237,6 +239,7 @@ export abstract class AbstractPod extends base.Resource implements IPodSelector,
       imagePullSecrets: this.dockerRegistryAuth ? [{ name: this.dockerRegistryAuth.name }] : undefined,
       automountServiceAccountToken: this.automountServiceAccountToken,
       hostNetwork: this.hostNetwork,
+      terminationGracePeriodSeconds: this.terminationGracePeriod?.toSeconds(),
     };
 
   }
@@ -437,6 +440,13 @@ export interface AbstractPodProps extends base.ResourceProps {
    * @default false
    */
   readonly hostNetwork?: boolean;
+
+  /**
+   * Grace period until the pod is terminated
+   *
+   * @default Duration.seconds(30)
+   */
+  readonly terminationGracePeriod?: Duration;
 }
 
 /**


Test patch:
diff --git a/test/__snapshots__/container.test.ts.snap b/test/__snapshots__/container.test.ts.snap
index aec9b313..5271e331 100644
--- a/test/__snapshots__/container.test.ts.snap
+++ b/test/__snapshots__/container.test.ts.snap
@@ -55,6 +55,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -104,6 +105,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -174,6 +176,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -229,6 +232,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
       "volumes": Array [
         Object {
           "name": "pvc-pvc-test-pv-c8b2a2c6",
diff --git a/test/__snapshots__/cron-job.test.ts.snap b/test/__snapshots__/cron-job.test.ts.snap
index 9a910c21..e8f2501a 100644
--- a/test/__snapshots__/cron-job.test.ts.snap
+++ b/test/__snapshots__/cron-job.test.ts.snap
@@ -52,6 +52,7 @@ Array [
                 "runAsNonRoot": true,
               },
               "setHostnameAsFQDN": false,
+              "terminationGracePeriodSeconds": 30,
             },
           },
         },
@@ -137,6 +138,7 @@ Array [
                 "runAsNonRoot": true,
               },
               "setHostnameAsFQDN": false,
+              "terminationGracePeriodSeconds": 30,
             },
           },
         },
@@ -203,6 +205,7 @@ Array [
                 "runAsNonRoot": true,
               },
               "setHostnameAsFQDN": false,
+              "terminationGracePeriodSeconds": 30,
             },
           },
         },
diff --git a/test/__snapshots__/daemon-set.test.ts.snap b/test/__snapshots__/daemon-set.test.ts.snap
index 7456ab88..3b07d8a5 100644
--- a/test/__snapshots__/daemon-set.test.ts.snap
+++ b/test/__snapshots__/daemon-set.test.ts.snap
@@ -54,6 +54,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -133,6 +134,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -194,6 +196,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
diff --git a/test/__snapshots__/deployment.test.ts.snap b/test/__snapshots__/deployment.test.ts.snap
index 63c4e653..77b95800 100644
--- a/test/__snapshots__/deployment.test.ts.snap
+++ b/test/__snapshots__/deployment.test.ts.snap
@@ -74,6 +74,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -193,6 +194,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -289,6 +291,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -395,6 +398,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -487,6 +491,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -577,6 +582,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -666,6 +672,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -736,6 +743,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -818,6 +826,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -888,6 +897,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -967,6 +977,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1059,6 +1070,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1148,6 +1160,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1218,6 +1231,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1300,6 +1314,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1370,6 +1385,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1449,6 +1465,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1541,6 +1558,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1630,6 +1648,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1717,6 +1736,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1801,6 +1821,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1852,6 +1873,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
       "tolerations": Array [
         Object {
           "key": "key1",
@@ -1974,6 +1996,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
diff --git a/test/__snapshots__/horizontal-pod-autoscaler.test.ts.snap b/test/__snapshots__/horizontal-pod-autoscaler.test.ts.snap
index a0b60388..c4a24c10 100644
--- a/test/__snapshots__/horizontal-pod-autoscaler.test.ts.snap
+++ b/test/__snapshots__/horizontal-pod-autoscaler.test.ts.snap
@@ -62,6 +62,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -176,6 +177,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -303,6 +305,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -430,6 +433,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -557,6 +561,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -683,6 +688,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -809,6 +815,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -935,6 +942,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1061,6 +1069,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1187,6 +1196,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1313,6 +1323,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1439,6 +1450,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1566,6 +1578,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1697,6 +1710,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1830,6 +1844,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1997,6 +2012,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -2130,6 +2146,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -2249,6 +2266,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -2376,6 +2394,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -2490,6 +2509,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -2613,6 +2633,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
       "updateStrategy": Object {
@@ -2733,6 +2754,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -2847,6 +2869,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -2967,6 +2990,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
           "volumes": Array [
             Object {
               "emptyDir": Object {},
diff --git a/test/__snapshots__/job.test.ts.snap b/test/__snapshots__/job.test.ts.snap
index ac4b3594..5aca1007 100644
--- a/test/__snapshots__/job.test.ts.snap
+++ b/test/__snapshots__/job.test.ts.snap
@@ -48,6 +48,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
diff --git a/test/__snapshots__/network-policy.test.ts.snap b/test/__snapshots__/network-policy.test.ts.snap
index 9ba2206f..514e47f9 100644
--- a/test/__snapshots__/network-policy.test.ts.snap
+++ b/test/__snapshots__/network-policy.test.ts.snap
@@ -136,6 +136,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -180,6 +181,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -265,6 +267,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -328,6 +331,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -415,6 +419,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -497,6 +502,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -578,6 +584,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -664,6 +671,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -758,6 +766,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -848,6 +857,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -952,6 +962,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1037,6 +1048,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1123,6 +1135,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1167,6 +1180,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1252,6 +1266,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1315,6 +1330,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1402,6 +1418,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1484,6 +1501,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1565,6 +1583,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1651,6 +1670,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1745,6 +1765,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1835,6 +1856,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1939,6 +1961,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2024,6 +2047,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2110,6 +2134,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2192,6 +2217,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
diff --git a/test/__snapshots__/pod.test.ts.snap b/test/__snapshots__/pod.test.ts.snap
index 0c9544e1..137d7e68 100644
--- a/test/__snapshots__/pod.test.ts.snap
+++ b/test/__snapshots__/pod.test.ts.snap
@@ -44,6 +44,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -98,6 +99,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -171,6 +173,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -288,6 +291,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -337,6 +341,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -412,6 +417,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -461,6 +467,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -536,6 +543,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -585,6 +593,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -712,6 +721,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -761,6 +771,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -836,6 +847,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -885,6 +897,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -960,6 +973,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -1009,6 +1023,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1112,6 +1127,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1190,6 +1206,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1307,6 +1324,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1413,6 +1431,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -1462,6 +1481,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1587,6 +1607,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -1638,6 +1659,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1806,6 +1828,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -1850,6 +1873,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -1899,6 +1923,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2009,6 +2034,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2128,6 +2154,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -2177,6 +2204,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2338,6 +2366,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2449,6 +2478,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2552,6 +2582,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2630,6 +2661,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2747,6 +2779,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -2863,6 +2896,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -2912,6 +2946,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3037,6 +3072,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -3088,6 +3124,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3256,6 +3293,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3300,6 +3338,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -3349,6 +3388,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3459,6 +3499,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3578,6 +3619,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -3627,6 +3669,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3788,6 +3831,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3899,6 +3943,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -3966,6 +4011,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -4015,6 +4061,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -4108,6 +4155,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -4209,6 +4257,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -4302,6 +4351,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -4390,6 +4440,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -4439,6 +4490,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -4546,6 +4598,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
@@ -4707,6 +4760,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -4757,6 +4811,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -4826,6 +4881,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -4894,6 +4950,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -4943,6 +5000,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -5004,6 +5062,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5053,6 +5112,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -5111,6 +5171,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5177,6 +5238,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5241,6 +5303,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5290,6 +5353,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -5351,6 +5415,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5400,6 +5465,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
   Object {
@@ -5458,6 +5524,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5524,6 +5591,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5595,6 +5663,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
     },
   },
 ]
@@ -5644,6 +5713,7 @@ Array [
         "runAsNonRoot": true,
       },
       "setHostnameAsFQDN": false,
+      "terminationGracePeriodSeconds": 30,
       "tolerations": Array [
         Object {
           "key": "key1",
diff --git a/test/__snapshots__/service.test.ts.snap b/test/__snapshots__/service.test.ts.snap
index 5ae63a08..51c9d49f 100644
--- a/test/__snapshots__/service.test.ts.snap
+++ b/test/__snapshots__/service.test.ts.snap
@@ -95,6 +95,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
     },
diff --git a/test/__snapshots__/statefulset.test.ts.snap b/test/__snapshots__/statefulset.test.ts.snap
index 31725752..86d6f7b3 100644
--- a/test/__snapshots__/statefulset.test.ts.snap
+++ b/test/__snapshots__/statefulset.test.ts.snap
@@ -76,6 +76,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
       "updateStrategy": Object {
@@ -196,6 +197,7 @@ Array [
             "runAsNonRoot": true,
           },
           "setHostnameAsFQDN": false,
+          "terminationGracePeriodSeconds": 30,
         },
       },
       "updateStrategy": Object {
diff --git a/test/pod.test.ts b/test/pod.test.ts
index 372a41bf..9378cb28 100644
--- a/test/pod.test.ts
+++ b/test/pod.test.ts
@@ -1521,4 +1521,39 @@ test('pod hostNetwork is not added by default', () => {
 
   expect(spec.hostNetwork).toEqual(false);
   expect(manifest).toMatchSnapshot();
+});
+
+test('default termination grace period', () => {
+  const chart = Testing.chart();
+  new kplus.Pod(chart, 'Pod', {
+    containers: [{ image: 'image' }],
+  });
+
+  const manifest = Testing.synth(chart);
+  const spec = manifest[0].spec;
+  expect(spec.terminationGracePeriodSeconds).toEqual(30);
+});
+
+test('custom termination grace period', () => {
+  const chart = Testing.chart();
+  new kplus.Pod(chart, 'Pod', {
+    containers: [{ image: 'image' }],
+    terminationGracePeriod: Duration.seconds(60),
+  });
+
+  const manifest = Testing.synth(chart);
+  const spec = manifest[0].spec;
+  expect(spec.terminationGracePeriodSeconds).toEqual(60);
+});
+
+test('custom termination grace period - minutes', () => {
+  const chart = Testing.chart();
+  new kplus.Pod(chart, 'Pod', {
+    containers: [{ image: 'image' }],
+    terminationGracePeriod: Duration.minutes(2),
+  });
+
+  const manifest = Testing.synth(chart);
+  const spec = manifest[0].spec;
+  expect(spec.terminationGracePeriodSeconds).toEqual(120);
 });
\ No newline at end of file