Module: AWSCDK::Batch::IEKSContainerDefinition

Includes:
Constructs::IConstruct
Included in:
EKSContainerDefinition
Defined in:
batch/ieks_container_definition.rb

Overview

A container that can be run with EKS orchestration on EC2 resources.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'batch/ieks_container_definition.rb', line 284

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :image => { kind: :property, name: "image", is_optional: false },
    :volumes => { kind: :property, name: "volumes", is_optional: false },
    :args => { kind: :property, name: "args", is_optional: true },
    :command => { kind: :property, name: "command", is_optional: true },
    :cpu_limit => { kind: :property, name: "cpuLimit", is_optional: true },
    :cpu_reservation => { kind: :property, name: "cpuReservation", is_optional: true },
    :env => { kind: :property, name: "env", is_optional: true },
    :gpu_limit => { kind: :property, name: "gpuLimit", is_optional: true },
    :gpu_reservation => { kind: :property, name: "gpuReservation", is_optional: true },
    :image_pull_policy => { kind: :property, name: "imagePullPolicy", is_optional: true },
    :memory_limit => { kind: :property, name: "memoryLimit", is_optional: true },
    :memory_reservation => { kind: :property, name: "memoryReservation", is_optional: true },
    :name => { kind: :property, name: "name", is_optional: true },
    :privileged => { kind: :property, name: "privileged", is_optional: true },
    :readonly_root_filesystem => { kind: :property, name: "readonlyRootFilesystem", is_optional: true },
    :run_as_group => { kind: :property, name: "runAsGroup", is_optional: true },
    :run_as_root => { kind: :property, name: "runAsRoot", is_optional: true },
    :run_as_user => { kind: :property, name: "runAsUser", is_optional: true },
    :with => { kind: :method, name: "with", is_optional: false },
    :add_volume => { kind: :method, name: "addVolume", is_optional: false },
  }
end

Instance Method Details

#add_volume(volume) ⇒ void

This method returns an undefined value.

Mount a Volume to this container.

Automatically added to the Pod.

Parameters:



279
280
281
282
# File 'batch/ieks_container_definition.rb', line 279

def add_volume(volume)
  Jsii::Type.check_type(volume, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guRWtzVm9sdW1lIn0=")), "volume")
  jsii_call_method("addVolume", [volume])
end

#argsArray<String>?

An array of arguments to the entrypoint.

If this isn't specified, the CMD of the container image is used. This corresponds to the args member in the Entrypoint portion of the Pod in Kubernetes. Environment variable references are expanded using the container's environment. If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if the reference is to "$(NAME1)" and the NAME1 environment variable doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with $, and the resulting string isn't expanded. or example, $$(VAR_NAME) is passed as $(VAR_NAME) whether or not the VAR_NAME environment variable exists.



44
45
46
# File 'batch/ieks_container_definition.rb', line 44

def args()
  jsii_get_property("args")
end

#commandArray<String>?

The entrypoint for the container.

This isn't run within a shell. If this isn't specified, the ENTRYPOINT of the container image is used. Environment variable references are expanded using the container's environment. If the referenced environment variable doesn't exist, the reference in the command isn't changed. For example, if the reference is to "$(NAME1)" and the NAME1 environment variable doesn't exist, the command string will remain "$(NAME1)." $$ is replaced with $ and the resulting string isn't expanded. For example, $$(VAR_NAME) will be passed as $(VAR_NAME) whether or not the VAR_NAME environment variable exists.

The entrypoint can't be updated.



62
63
64
# File 'batch/ieks_container_definition.rb', line 62

def command()
  jsii_get_property("command")
end

#cpu_limitNumeric?

Note:

Default: - No CPU limit

The hard limit of CPUs to present to this container. Must be an even multiple of 0.25.

If your container attempts to exceed this limit, it will be terminated.

At least one of cpu_reservation and cpu_limit is required. If both are specified, then cpu_limit must be at least as large as cpu_reservation.



76
77
78
# File 'batch/ieks_container_definition.rb', line 76

def cpu_limit()
  jsii_get_property("cpuLimit")
end

#cpu_reservationNumeric?

Note:

Default: - No CPUs reserved

The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.

The container will given at least this many CPUs, but may consume more.

At least one of cpu_reservation and cpu_limit is required. If both are specified, then cpu_limit must be at least as large as cpu_reservation.



90
91
92
# File 'batch/ieks_container_definition.rb', line 90

def cpu_reservation()
  jsii_get_property("cpuReservation")
end

#envHash{String => String}?

The environment variables to pass to this container.

Note: Environment variables cannot start with "AWS_BATCH". This naming convention is reserved for variables that AWS Batch sets.

Returns:

  • (Hash{String => String}, nil)


100
101
102
# File 'batch/ieks_container_definition.rb', line 100

def env()
  jsii_get_property("env")
end

#gpu_limitNumeric?

Note:

Default: - No GPU limit

The hard limit of GPUs to present to this container.

If your container attempts to exceed this limit, it will be terminated.

If both gpu_reservation and gpu_limit are specified, then gpu_limit must be equal to gpu_reservation.



113
114
115
# File 'batch/ieks_container_definition.rb', line 113

def gpu_limit()
  jsii_get_property("gpuLimit")
end

#gpu_reservationNumeric?

Note:

Default: - No GPUs reserved

The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.

The container will given at least this many CPUs, but may consume more.

If both gpu_reservation and gpu_limit are specified, then gpu_limit must be equal to gpu_reservation.



126
127
128
# File 'batch/ieks_container_definition.rb', line 126

def gpu_reservation()
  jsii_get_property("gpuReservation")
end

#imageAWSCDK::ECS::ContainerImage

The image that this container will run.



18
19
20
# File 'batch/ieks_container_definition.rb', line 18

def image()
  jsii_get_property("image")
end

#image_pull_policyAWSCDK::Batch::ImagePullPolicy?

Note:

Default: - ALWAYS if the :latest tag is specified, IF_NOT_PRESENT otherwise

The image pull policy for this container.



135
136
137
# File 'batch/ieks_container_definition.rb', line 135

def image_pull_policy()
  jsii_get_property("imagePullPolicy")
end

#memory_limitAWSCDK::Size?

Note:

Default: - No memory limit

The amount (in MiB) of memory to present to the container.

If your container attempts to exceed the allocated memory, it will be terminated.

Must be larger that 4 MiB

At least one of memory_limit and memory_reservation is required

Note: To maximize your resource utilization, provide your jobs with as much memory as possible for the specific instance type that you are using.



153
154
155
# File 'batch/ieks_container_definition.rb', line 153

def memory_limit()
  jsii_get_property("memoryLimit")
end

#memory_reservationAWSCDK::Size?

Note:

Default: - No memory reserved

The soft limit (in MiB) of memory to reserve for the container.

Your container will be given at least this much memory, but may consume more.

Must be larger that 4 MiB

When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first.

At least one of memory_limit and memory_reservation is required. If both are specified, then memory_limit must be equal to memory_reservation

Note: To maximize your resource utilization, provide your jobs with as much memory as possible for the specific instance type that you are using.



178
179
180
# File 'batch/ieks_container_definition.rb', line 178

def memory_reservation()
  jsii_get_property("memoryReservation")
end

#nameString?

Note:

Default: : 'Default'

The name of this container.

Returns:

  • (String, nil)


186
187
188
# File 'batch/ieks_container_definition.rb', line 186

def name()
  jsii_get_property("name")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


11
12
13
# File 'batch/ieks_container_definition.rb', line 11

def node()
  jsii_get_property("node")
end

#privilegedBoolean?

Note:

Default: false

If specified, gives this container elevated permissions on the host container instance.

The level of permissions are similar to the root user permissions.

This parameter maps to privileged policy in the Privileged pod security policies in the Kubernetes documentation.

Note: this is only compatible with Kubernetes < v1.25



201
202
203
# File 'batch/ieks_container_definition.rb', line 201

def privileged()
  jsii_get_property("privileged")
end

#readonly_root_filesystemBoolean?

Note:

Default: false

If specified, gives this container readonly access to its root file system.

This parameter maps to ReadOnlyRootFilesystem policy in the Volumes and file systems pod security policies in the Kubernetes documentation.

Note: this is only compatible with Kubernetes < v1.25



214
215
216
# File 'batch/ieks_container_definition.rb', line 214

def readonly_root_filesystem()
  jsii_get_property("readonlyRootFilesystem")
end

#run_as_groupNumeric?

Note:

Default: none

If specified, the container is run as the specified group ID (gid).

If this parameter isn't specified, the default is the group that's specified in the image metadata. This parameter maps to RunAsGroup and MustRunAs policy in the Users and groups pod security policies in the Kubernetes documentation.

Note: this is only compatible with Kubernetes < v1.25



228
229
230
# File 'batch/ieks_container_definition.rb', line 228

def run_as_group()
  jsii_get_property("runAsGroup")
end

#run_as_rootBoolean?

Note:

Default: - the container is not required to run as a non-root user

If specified, the container is run as a user with a uid other than 0.

Otherwise, no such rule is enforced. This parameter maps to RunAsUser and MustRunAsNonRoot policy in the Users and groups pod security policies in the Kubernetes documentation.

Note: this is only compatible with Kubernetes < v1.25



242
243
244
# File 'batch/ieks_container_definition.rb', line 242

def run_as_root()
  jsii_get_property("runAsRoot")
end

#run_as_userNumeric?

Note:

Default: - the user that is specified in the image metadata.

If specified, this container is run as the specified user ID (uid).

This parameter maps to RunAsUser and MustRunAs policy in the Users and groups pod security policies in the Kubernetes documentation.

Note: this is only compatible with Kubernetes < v1.25



255
256
257
# File 'batch/ieks_container_definition.rb', line 255

def run_as_user()
  jsii_get_property("runAsUser")
end

#volumesArray<AWSCDK::Batch::EKSVolume>

The Volumes to mount to this container.

Automatically added to the Pod.



28
29
30
# File 'batch/ieks_container_definition.rb', line 28

def volumes()
  jsii_get_property("volumes")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



266
267
268
269
270
271
# File 'batch/ieks_container_definition.rb', line 266

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end