terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

Support Probe-level `terminationGracePeriodSeconds`

Open andrewpage opened this issue 9 months ago • 2 comments

Description

Kubernetes >v1.25 supports a terminationGracePeriodSeconds field on livenessProbe and startupProbe. This field overrides the Pod-level terminationGracePeriod field when a SIGTERM is triggered by a probe failure.

Probe-level terminationGracePeriodSeconds cannot be set for readiness probes.

https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#probe-level-terminationgraceperiodseconds

Potential Terraform Configuration

resource "kubernetes_deployment" "example" {
  metadata {
    # ...
  }

  spec {
    # ...

    template {
      # ...

      spec {
        container {
          # ...

          liveness_probe {
            # ...

            termination_grace_period_seconds = 3
          }
        }
      }
    }
  }
}

References

  • https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#probe-level-terminationgraceperiodseconds

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

andrewpage avatar Feb 26 '25 23:02 andrewpage

Opened a PR: https://github.com/hashicorp/terraform-provider-kubernetes/pull/2697

andrewpage avatar Feb 27 '25 20:02 andrewpage

There's some relevant discussion in https://github.com/hashicorp/terraform-provider-kubernetes/issues/2705#issuecomment-2736679918:

We're working on a comprehensive solution to cover all of the missing attributes consistently, through code generation.

Hopefully this solution can be released soon.

gabegorelick avatar Mar 26 '25 19:03 gabegorelick