HostPathVolumeOptions

class aws_cdk.aws_batch.HostPathVolumeOptions(*, name, mount_path=None, readonly=None, host_path)

Bases: EksVolumeOptions

Options for a kubernetes HostPath volume.

Parameters:
  • name (str) – The name of this volume. The name must be a valid DNS subdomain name.

  • mount_path (Optional[str]) – The path on the container where the volume is mounted. Default: - the volume is not mounted

  • readonly (Optional[bool]) – If specified, the container has readonly access to the volume. Otherwise, the container has read/write access. Default: false

  • host_path (str) – The path of the file or directory on the host to mount into containers on the pod. Note: HothPath Volumes present many security risks, and should be avoided when possible.

See:

https://kubernetes.io/docs/concepts/storage/volumes/#hostpath

ExampleMetadata:

infused

Example:

# job_defn: batch.EksJobDefinition

job_defn.container.add_volume(batch.EksVolume.empty_dir(
    name="emptyDir",
    mount_path="/Volumes/emptyDir"
))
job_defn.container.add_volume(batch.EksVolume.host_path(
    name="hostPath",
    host_path="/sys",
    mount_path="/Volumes/hostPath"
))
job_defn.container.add_volume(batch.EksVolume.secret(
    name="secret",
    optional=True,
    mount_path="/Volumes/secret",
    secret_name="mySecret"
))

Attributes

host_path

The path of the file or directory on the host to mount into containers on the pod.

Note: HothPath Volumes present many security risks, and should be avoided when possible.

See:

https://kubernetes.io/docs/concepts/storage/volumes/#hostpath

mount_path

The path on the container where the volume is mounted.

Default:
  • the volume is not mounted

name

The name of this volume.

The name must be a valid DNS subdomain name.

See:

https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names

readonly

If specified, the container has readonly access to the volume.

Otherwise, the container has read/write access.

Default:

false