-
Notifications
You must be signed in to change notification settings - Fork 1
Container
R.deployment :backend do
container do
image 'tutum/hello-world'
end
endSets up main container of deployment with tutum/hello-world image.
| Property | Kubernetes property | Type |
|---|---|---|
| args | args | Array of String |
| command | command | Array of String |
| env | env | Array of EnvVar |
| env_from | envFrom | Array of EnvFromSource |
| image | image | String |
| image_pull_policy | imagePullPolicy | String |
| lifecycle | lifecycle | Lifecycle |
| liveness_probe | livenessProbe | Probe |
| name | name | String |
| ports | ports | Array of ContainerPort |
| readiness_probe | readinessProbe | Probe |
| resources | resources | ResourceRequirements |
| security_context | securityContext | SecurityContext |
| stdin | stdin | Boolean |
| stdin_once | stdinOnce | Boolean |
| termination_message_path | terminationMessagePath | String |
| termination_message_policy | terminationMessagePolicy | String |
| tty | tty | Boolean |
| volume_devices | volumeDevices | Array of VolumeDevice |
| volume_mounts | volumeMounts | Array of VolumeMount |
| working_dir | workingDir | String |
Passing list of values adds them to the args array:
R.deployment :backend do
container do
args '-v', '1', '-l', 42
end
endPassing list of values adds them to the command array:
R.deployment :backend do
container do
command '/bin/sh', '-c', 'ls -al'
end
endA complex helper to manipulate container's environment-oriented properties env and env_from. Available
methods are described in Container Environment Helper.
Adds a port information to the ports array:
R.deployment :backend do
container do
expose_port 80, host_ip: '0.0.0.0', host_port: 8080, name: :http, protocol: :TCP
end
endA shortcut for exposing container's port 80 with the name 'http:
R.deployment :backend do
container do
expose_default_http_port
end
endWith arguments passed sets image and optionally sets image pull policy for the container:
R.deployment :backend do
container do
# Specify image
image 'myregistry.com/backend:latest'
# Specify image and image pull policy
image 'myregistry.com/backend:latest', :IfNotExists
end
endAdds a VolumeDevice with the specified parameters to the volume_devices array:
R.deployment :backend do
container do
mount_device :data, '/data'
end
endAdds a VolumeMount with the specified parameters to the volume_mounts array:
R.deployment :backend do
container do
# Mount volume 'appsettings' at path '/etc/config'
mount_device :data, '/data'
# Mount volume 'appsettings' at path '/etc/config' marking it as readonly
mount_volume :appsettings, '/etc/config', readonly: true
# Mount volume 'appsettings' at path '/etc/config' marking it as readonly
mount_volume :appsettings, '/etc/config', readonly: true
# Mount volume 'appsettings' at path '/etc/config' marking it as readonly,
# specifying mount propagation mode and root inside the volume
mount_volume :appsettings, '/etc/config', readonly: true,
mount_propagation: :MountPropagationNone, sub_path: '/data'
end
end| Property | Kubernetes property | Type |
|---|---|---|
| container_port | containerPort | Integer |
| host_ip | hostIP | String |
| host_port | hostPort | Integer |
| name | name | String |
| protocol | protocol | String |
| Property | Kubernetes property | Type |
|---|---|---|
| post_start | postStart | Handler |
| pre_stop | preStop | Handler |
| Property | Kubernetes property | Type |
|---|---|---|
| exec | exec | ExecAction |
| http_get | httpGet | HTTPGetAction |
| tcp_socket | tcpSocket | TCPSocketAction |
Handler also provides all helpers defined by an ActionsOwner.
| Property | Kubernetes property | Type |
|---|---|---|
| device_path | devicePath | String |
| name | name | String |
| Property | Kubernetes property | Type |
|---|---|---|
| mount_path | mountPath | String |
| mount_propagation | mountPropagation | String |
| name | name | String |
| readonly | readOnly | Boolean |
| sub_path | subPath | String |
| Property | Kubernetes property | Type |
|---|---|---|
| allow_privilege_escalation | allowPrivilegeEscalation | Boolean |
| capabilities | capabilities | Capabilities |
| privileged | privileged | Boolean |
| proc_mount | procMount | String |
| readonly_root_filesystem | readOnlyRootFilesystem | Boolean |
| run_as_group | runAsGroup | Integer |
| run_as_non_root | runAsNonRoot | Boolean |
| run_as_user | runAsUser | Integer |
| se_linux_options | seLinuxOptions | SELinuxOptions |
| Property | Kubernetes property | Type |
|---|---|---|
| add | add | Array of String |
| drop | drop | Array of String |
When list of values is passed add adds them to the add array:
container do
security_context.capabilities.add 'A', 'B', 'C'
endWhen list of values is passed drop adds them to the drop array:
container do
security_context.capabilities.drop 'A', 'B', 'C'
end