Skip to content

PersistentVolumeClaim

Gregory Nickonov edited this page Mar 12, 2019 · 3 revisions

Quick Start

R.persistent_volume_claim :database do
  access_mode :ReadWriteOnce

  storage_class_name :ssd

  storage_request '2Gi'
end

This will create PersistentVolumeClaim requesting 2 Gigabytes of storage with the storage class ssd.

PersistentVolumeClaim

Kubernetes Documentation

Sunstone property Kubernetes property Type
metadata metadata Kubernetes Object Metadata
spec spec PersistentVolumeClaimSpec

access_modes

Shortcut to add specified values to spec.access_modes array. For aesthetic purposes access_mode alias is available:

R.persistent_volume_claim :storage do
  access_mode :ReadWriteMany
end

See Persistent Volumes Access Modes in Kubernetes documentation for the list available values and their meaning.

match_labels

Adds specified sets of labels to spec.selector:

R.persistent_volume_claim :storage do
  match_labels speed: :fast, region: :west
end

storage_class_name

Shortcut to spec.storage_class_name:

R.persistent_volume_claim :storage do
  storage_class_name :ssd
end

storage_limit

Shortcut to spec.storage_limit:

R.persistent_volume_claim :storage do
  storage_limit '8Gi'
end

storage_request

Shortcut to spec.storage_request:

R.persistent_volume_claim :storage do
  storage_request '2Gi'
end

PersistentVolumeClaimSpec

Kubernetes Documentation

Sunstone property Kubernetes property Type
access_modes accessModes Array of String
data_source dataSource TypedLocalObjectReference
selector selector LabelSelector
storage_class_name storageClassName String
resources resources ResourceRequirements
volume_mode volumeMode String
volume_name volumeName String

storage_limit

Sets the value of resources.limits.storage:

R.persistent_volume_claim :database do
  spec.storage_limit '8Gi'
end

storage_request

Sets the value of resources.requests.storage:

R.persistent_volume_claim :database do
  spec.storage_request '2Gi'
end
Clone this wiki locally