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

StatefulSet's PodSpec should allow specifying volumeDevices

Open jirislav opened this issue 6 months ago • 1 comments

Description

Since the schema of StatefulSet uses PodSpec under the hood, we should allow all the features of PodSpec to be used within the StatefulSet. But the support of volumeDevices is missing.

Potential Terraform Configuration

resource "kubernetes_stateful_set_v1" "ss-test" {

  metadata {
    name = "ss-test"
  }

  spec {
    replicas = 1

    selector {
      match_labels = {
        app = "ss-test"
      }
    }

    template {
      metadata {
        labels = {
          app = "ss-test"
        }
      }

      spec {
        container {
          name  = "ss-test"

          volume_mount {
            name       = "ss-test"
            mount_path = "/work-dir"
          }

          volume_device { # This is not supported, but should be
            name        = "ss-device-test"
            device_path = "/dev/xvda"
          }
        }
      }
    }

    volume_claim_template {
      metadata {
        name = "ss-test"
      }

      spec {
        access_modes = ["ReadWriteOnce"]
        resources {
          requests = {
            storage = "1Gi"
          }
        }
      }
    }

    volume_claim_template {
      metadata {
        name = "ss-device-test"
      }

      spec {
        access_modes = ["ReadWriteOnce"]
        volume_mode  = "Block"
        resources {
          requests = {
            storage = "1Gi"
          }
        }
      }
    }
  }
}

References

  • https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#volumes-1

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

jirislav avatar Aug 15 '24 21:08 jirislav