Score

Capability

Volumes

Define volumes and volume mounts for a Workload.

Volume mounts are declared in the volumes section of the Score file. There should be a resource of type volume defined in your resource definitions, see examples here .

One trick is that the content of source in the volume section should only reference the name of the resource, not an output. For example: ${resources.my-volume}.


score.yaml (view on GitHub ) :

apiVersion: score.dev/v1b1
metadata:
  name: my-workload
containers:
  my-container:
    image: .
    volumes:
    - source: ${resources.my-ephemeral-volume}
      target: /tmp/ephemeral-dir
    - source: ${resources.my-config-volume}
      target: /var/config
    - source: ${resources.my-projected-volume}
      target: /var/all-in-one
      readOnly: true
    - source: ${resources.my-dynamic-provisioning-volume}
      target: /var/dynamic
    - source: ${resources.my-nfs-volume}
      target: /var/nfs
resources:
  my-ephemeral-volume:
    type: volume
    class: ephemeral
  my-config-volume:
    type: volume
    class: config
  my-projected-volume:
    type: volume
    class: projected
  my-dynamic-provisioning-volume:
    type: volume
    class: standard-rwo
  my-nfs-volume:
    type: volume
    class: nfs
Top