-
Notifications
You must be signed in to change notification settings - Fork 1
VolumeArray
volumes do
config_map 'config-volume', appsettings: 'appsettings.json'
empty_dir :temp
host_path :logs, '/var/log'
nfs :export, 'files.example.org', '/data/export'
persistent_volume_claim :data, 'db-data'
secret :secrets, 'application-secrets', passwords: 'passwords.txt'
end
VolumeArray
contains list of volumes to be mounted to the Pod. To mount the volume use one of the following helpers:
Adds a named volume with the configured ConfigMapVolumeSource to the Pod. You can specify the name of the ConfigMap (if not, then the name of the top-level object will be used) and the set of the ConfigMap keys and corresponding file names:
R.scope :backend do
config_map do
file appsettings: 'files/appsettings.json'
end
deployment do
container do
mount_volume 'config-volume', '/etc/config'
end
# Add volume named 'config-volume' from the ConfigMap 'backend',
# exposing key 'appsettings' as a file 'appsettings.json'
volumes.config_map 'config-volume', :backend, appsettings: 'appsettings.json'
# The same, but ConfigMap defaults to the current scope (which is 'backend')
volumes.config_map 'config-volume', appsettings: 'appsettings.json'
# The same, but perform an extra configuration
volumes.config_map 'config-volume', appsettings: 'appsettings.json' do
optional!
end
end
end
Adds a named volume with the configured EmptyDirVolumeSource to the Pod:
volumes do
# Create default empty directory volume without size limit
empty_dir :temp
# Create empty directory volume with size limit set to 4Gi
empty_dir :temp, size_limit: '4Gi'
# Create in-memory empty directory with size limit set to 200Mi
empty_dir :temp, size_limit: '200Mi', in_memory: true
end
Adds a named volume with the configured HostPathVolumeSource to the Pod:
volumes do
host_path :logs, '/var/log'
end
Adds a named volume with the configured NFSVolumeSource to the Pod:
volumes do
# Add path /data from server files.example.org as the volume named 'data'
nfs :data, 'files.example.org', '/data'
# The same, but volume is read-only
nfs :data, 'files.example.org', '/data', readonly: true
end
Adds a named volume with the configured PersistentVolumeClaimVolumeSource to the Pod:
volumes do
# Add volume 'data' bound to PVC 'db-data'
persistent_volume_claim :data, 'db-data'
# The same, but add volume as read only and using an alias
pvc :data, 'db-data', readonly: true
end
An alias pvc
is also available to save some characters when typing.
Adds a named volume with the configured SecretVolumeSource to the Pod. You can specify the name of the Secret (if not, then the name of the top-level object will be used) and the set of the Secret keys and corresponding file names:
R.scope :backend do
secret do
file passwords: 'files/passwords.txt'
end
deployment do
container do
mount_volume :passwords, '/var/data'
end
# Add volume named 'passwords' from the secret 'secret-passwords'
# exposing key 'passwords' as file 'passwords.txt'
volumes.secret :passwords, 'secret-passwords', passwords: 'passwords.txt'
# The same, but use the secret with the same name as the current scope
volumes.secret :passwords, passwords: 'passwords.txt'
# The same, but perform extra-configuration afterwards
volumes.secret :passwords, passwords: 'passwords.txt' do
default_mode 0600
optional!
end
end
end
Property | Kubernetes property | Type |
---|---|---|
default_mode | defaultMode | Integer |
items | items | Array of KeyToPath |
name | name | String |
optional | optional | Boolean |
Property | Kubernetes property | Type |
---|---|---|
key | key | String |
mode | mode | Integer |
path | path | String |
Property | Kubernetes property | Type |
---|---|---|
medium | medium | String |
size_limit | sizeLimit | Integer or String |
Property | Kubernetes property | Type |
---|---|---|
path | path | String |
type | type | String |
Property | Kubernetes property | Type |
---|---|---|
path | path | String |
readonly | readOnly | Boolean |
server | server | String |
Property | Kubernetes property | Type |
---|---|---|
claim_name | claimName | String |
readonly | readOnly | Boolean |
Property | Kubernetes property | Type |
---|---|---|
default_mode | defaultMode | Integer |
items | items | Array of KeyToPath |
secret_name | secretName | String |
optional | optional | Boolean |