Skip to content

Support generic ephemeral volumes with volumeClaimTemplate on pods/deployments #2032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
willhughes-au opened this issue Mar 8, 2023 · 2 comments · Fixed by #2183
Closed

Comments

@willhughes-au
Copy link

Description

As of Kubernetes 1.23, deployments can have generic ephemeral volumes by using volumeClaimTemplate.

Currently it does not appear to be possible to configure this within either a kubernetes_pod_v1 or kubernetes_deployment_v1 resource. Both resources should ephemeral volumes like this available.

Potential Terraform Configuration

This example is just for a pod resource, as per the example from the kubernetes documentation

resource "kubernetes_pod_v1" "name" {
  spec { 
    volume {
      name =  "scratch-volume"
      ephemeral {
        volume_claim_template {
          spec {
            access_modes = [ "ReadWriteOnce" ]
            resources {
              requests {
                storage = "10Gi"
              }
            }
            storage_class_name = "scratch-storage-class"
            volume_mode = "FileSystem"
          }
        }
    }
  }
}

References

Kubernetes ephemeral volumes documentation: https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes

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
@willhughes-au
Copy link
Author

@BBBmau The linked issue #2183 only seems to resolve ephemeral volumes for pod spec. I don't believe it will work for deployments still. Also possibly stateful sets, cronjobs/jobs, etc.

Could you please re-open this issue if it's not fixed for those, too?

@jbg
Copy link

jbg commented Jul 16, 2023

@BBBmau The linked issue #2183 only seems to resolve ephemeral volumes for pod spec. I don't believe it will work for deployments still. Also possibly stateful sets, cronjobs/jobs, etc.

Could you please re-open this issue if it's not fixed for those, too?

The PodSpec within a deployment, statefulset, job, daemonset etc is the same object, and the code for PodSpec isn't duplicated everywhere a PodSpec is used, so it should fix it everywhere.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.