Link Search Menu Expand Document

How to define the storage

Some components need to configure storage. This storage may or may not be persistent. The way to define them is as follows:

In the case of persistent volumes, we can refer to a volume that already exists or, on the contrary, define one that must be created.

kind: Component
metadata:
  name: <componentName>
spec:
  workload:
    apiVersion: core.oam.dev/v1alpha2
    kind: ContainerizedWorkload
    metadata:
      name: <workloadName>
    spec:
      osType: linux
      containers:
        - name: <containerName>
          image: <image>
          ...
          resources:
            ...
            volumes:
              - name: <volumeName>
                mountPath: <mountPath>
                useExistingVolumeName: false
                storageClass: <class>
                accessMode: <RO|RW>
                disk:
                  required: 1Gi
                  ephemeral: false
...                  

where:

  • useExistingVolumeName is a field to indicate if the pvc named volumeName alredy exists or not and
  • ephemeral is a flag to indicate if the volume is persistent or not.