Resource Definitions
Driver
Capability
Flavor
Resource Type
Volumes
This example illustrates how a Workload can use persistent storage service through the Kubernetes
volumes
system. It uses the
volume-pvc
Driver to create a
PersistentVolume
for your application. If you have special requirements for your PersistentVolume, you can also use the
Template Driver
to create it as shown in
this other example
.
score.yaml
(
view on GitHub
)
:
apiVersion: score.dev/v1b1
metadata:
name: my-workload
containers:
my-container:
image: .
volumes:
- source: ${resources.my-pvc}
target: /target/dir
resources:
my-pvc:
type: volume
Resource Definitions #
volume-pvc.yaml
(
view on GitHub
)
:
apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
id: volume-pvc
entity:
type: volume
driver_type: humanitec/volume-pvc
name: volume-pvc
driver_inputs:
values:
access_modes: ReadWriteOnce
capacity: 10Gi
criteria:
- {}
volume-pvc.tf
(
view on GitHub
)
:
resource "humanitec_resource_definition" "volume-pvc" {
driver_type = "humanitec/volume-pvc"
id = "volume-pvc"
name = "volume-pvc"
type = "volume"
driver_inputs = {
values_string = jsonencode({
"access_modes" = "ReadWriteOnce"
"capacity" = "10Gi"
})
}
}
resource "humanitec_resource_definition_criteria" "volume-pvc_criteria_0" {
resource_definition_id = resource.humanitec_resource_definition.volume-pvc.id
}