terraform-provider-kubernetes
terraform-provider-kubernetes copied to clipboard
StatefulSet's PodSpec should allow specifying volumeDevices
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
Even though I have found it to be missing in StatefulSet, the PR #2573 implements it to all the resources that use PodSpec, namely:
- StatefulSet
- DaemonSet
- Deployment
- ReplicationController
- CronJob
- Job
- Pod