terraform-provider-iterative
terraform-provider-iterative copied to clipboard
Support volume mounts (e.g. nfs) for Kubernetes
Requested Functionality
If you're using k8s as your compute environment and you're operating on-prem, it's quite likely that you also have some kind of shared storage system (e.g. NFS). The user should be able to specify such volume mounts for their TPI task.
Candidate Implementation
See https://github.com/iterative/terraform-provider-iterative/compare/master...sjawhar:terraform-provider-iterative:feature/nfs-volume#diff-0fe990bc324a7948aa5a28972474908770afb9f012a7d0586ee0b4af8f808d8eR200-R216
Relevant section in TF would look like this:
resource "iterative_task" "task_with_nfs_volume" {
cloud = "k8s"
nfs_volume {
server = "10.0.20.3"
server_path = "/data/projects"
mount_path = "/projects"
}
}
Isn't a StorageClass the traditional approach to solve this use case? 🤔
Isn't a StorageClass the traditional approach to solve this use case? thinking
I don't think so? I based my implementation on the Kubernetes plugin for Jenkins, which generates pod specs that look like this:
apiVersion: "v1"
kind: "Pod"
spec:
containers:
- command:
- "/bin/bash"
image: "python3.9"
volumeMounts:
- mountPath: "/mount/path/here"
name: "volume-0"
readOnly: false
workingDir: "/home/jenkins/agent"
nodeSelector:
nodetype: "cpu"
restartPolicy: "Never"
volumes:
- name: "volume-0"
nfs:
path: "/server/path/here"
readOnly: true
server: "10.0.20.3"