Class: AWSCDK::Batch::EKSContainerDefinition
- Inherits:
-
Constructs::Construct
- Object
- Constructs::Construct
- AWSCDK::Batch::EKSContainerDefinition
- Includes:
- IEKSContainerDefinition
- Defined in:
- batch/eks_container_definition.rb
Overview
A container that can be run with EKS orchestration on EC2 resources.
Class Method Summary collapse
- .jsii_overridable_methods ⇒ Object
-
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
Instance Method Summary collapse
-
#add_volume(volume) ⇒ void
Mount a Volume to this container.
-
#args ⇒ Array<String>?
An array of arguments to the entrypoint.
-
#command ⇒ Array<String>?
The entrypoint for the container.
-
#cpu_limit ⇒ Numeric?
The hard limit of CPUs to present to this container.
-
#cpu_reservation ⇒ Numeric?
The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.
-
#env ⇒ Hash{String => String}?
The environment variables to pass to this container.
-
#gpu_limit ⇒ Numeric?
The hard limit of GPUs to present to this container.
-
#gpu_reservation ⇒ Numeric?
The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.
-
#image ⇒ AWSCDK::ECS::ContainerImage
The image that this container will run.
-
#image_pull_policy ⇒ AWSCDK::Batch::ImagePullPolicy?
The image pull policy for this container.
-
#initialize(scope, id, props) ⇒ EKSContainerDefinition
constructor
A new instance of EKSContainerDefinition.
-
#memory_limit ⇒ AWSCDK::Size?
The amount (in MiB) of memory to present to the container.
-
#memory_reservation ⇒ AWSCDK::Size?
The soft limit (in MiB) of memory to reserve for the container.
-
#name ⇒ String?
The name of this container.
-
#node ⇒ Constructs::Node
The tree node.
-
#privileged ⇒ Boolean?
If specified, gives this container elevated permissions on the host container instance.
-
#readonly_root_filesystem ⇒ Boolean?
If specified, gives this container readonly access to its root file system.
-
#run_as_group ⇒ Numeric?
If specified, the container is run as the specified group ID (
gid). -
#run_as_root ⇒ Boolean?
If specified, the container is run as a user with a
uidother than 0. -
#run_as_user ⇒ Numeric?
If specified, this container is run as the specified user ID (
uid). -
#to_string ⇒ String
Returns a string representation of this construct.
-
#volumes ⇒ Array<AWSCDK::Batch::EKSVolume>
The Volumes to mount to this container.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props) ⇒ EKSContainerDefinition
Returns a new instance of EKSContainerDefinition.
12 13 14 15 16 17 18 |
# File 'batch/eks_container_definition.rb', line 12 def initialize(scope, id, props) props = props.is_a?(Hash) ? ::AWSCDK::Batch::EKSContainerDefinitionProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guRWtzQ29udGFpbmVyRGVmaW5pdGlvblByb3BzIn0=")), "props") Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'batch/eks_container_definition.rb', line 20 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 }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :add_volume => { kind: :method, name: "addVolume", is_optional: false }, } end |
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
57 58 59 |
# File 'batch/eks_container_definition.rb', line 57 def self.PROPERTY_INJECTION_ID() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_batch.EksContainerDefinition", "PROPERTY_INJECTION_ID") 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.
306 307 308 309 |
# File 'batch/eks_container_definition.rb', line 306 def add_volume(volume) Jsii::Type.check_type(volume, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guRWtzVm9sdW1lIn0=")), "volume") jsii_call_method("addVolume", [volume]) end |
#args ⇒ Array<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.
88 89 90 |
# File 'batch/eks_container_definition.rb', line 88 def args() jsii_get_property("args") end |
#command ⇒ Array<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.
105 106 107 |
# File 'batch/eks_container_definition.rb', line 105 def command() jsii_get_property("command") end |
#cpu_limit ⇒ Numeric?
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.
117 118 119 |
# File 'batch/eks_container_definition.rb', line 117 def cpu_limit() jsii_get_property("cpuLimit") end |
#cpu_reservation ⇒ Numeric?
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.
129 130 131 |
# File 'batch/eks_container_definition.rb', line 129 def cpu_reservation() jsii_get_property("cpuReservation") end |
#env ⇒ Hash{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.
139 140 141 |
# File 'batch/eks_container_definition.rb', line 139 def env() jsii_get_property("env") end |
#gpu_limit ⇒ Numeric?
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.
150 151 152 |
# File 'batch/eks_container_definition.rb', line 150 def gpu_limit() jsii_get_property("gpuLimit") end |
#gpu_reservation ⇒ Numeric?
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.
161 162 163 |
# File 'batch/eks_container_definition.rb', line 161 def gpu_reservation() jsii_get_property("gpuReservation") end |
#image ⇒ AWSCDK::ECS::ContainerImage
The image that this container will run.
64 65 66 |
# File 'batch/eks_container_definition.rb', line 64 def image() jsii_get_property("image") end |
#image_pull_policy ⇒ AWSCDK::Batch::ImagePullPolicy?
The image pull policy for this container.
168 169 170 |
# File 'batch/eks_container_definition.rb', line 168 def image_pull_policy() jsii_get_property("imagePullPolicy") end |
#memory_limit ⇒ AWSCDK::Size?
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.
184 185 186 |
# File 'batch/eks_container_definition.rb', line 184 def memory_limit() jsii_get_property("memoryLimit") end |
#memory_reservation ⇒ AWSCDK::Size?
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.
207 208 209 |
# File 'batch/eks_container_definition.rb', line 207 def memory_reservation() jsii_get_property("memoryReservation") end |
#name ⇒ String?
The name of this container.
214 215 216 |
# File 'batch/eks_container_definition.rb', line 214 def name() jsii_get_property("name") end |
#node ⇒ Constructs::Node
The tree node.
50 51 52 |
# File 'batch/eks_container_definition.rb', line 50 def node() jsii_get_property("node") end |
#privileged ⇒ Boolean?
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
227 228 229 |
# File 'batch/eks_container_definition.rb', line 227 def privileged() jsii_get_property("privileged") end |
#readonly_root_filesystem ⇒ Boolean?
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
238 239 240 |
# File 'batch/eks_container_definition.rb', line 238 def readonly_root_filesystem() jsii_get_property("readonlyRootFilesystem") end |
#run_as_group ⇒ Numeric?
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
250 251 252 |
# File 'batch/eks_container_definition.rb', line 250 def run_as_group() jsii_get_property("runAsGroup") end |
#run_as_root ⇒ Boolean?
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
262 263 264 |
# File 'batch/eks_container_definition.rb', line 262 def run_as_root() jsii_get_property("runAsRoot") end |
#run_as_user ⇒ Numeric?
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
273 274 275 |
# File 'batch/eks_container_definition.rb', line 273 def run_as_user() jsii_get_property("runAsUser") end |
#to_string ⇒ String
Returns a string representation of this construct.
280 281 282 |
# File 'batch/eks_container_definition.rb', line 280 def to_string() jsii_call_method("toString", []) end |
#volumes ⇒ Array<AWSCDK::Batch::EKSVolume>
The Volumes to mount to this container.
Automatically added to the Pod.
73 74 75 |
# File 'batch/eks_container_definition.rb', line 73 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.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
293 294 295 296 297 298 |
# File 'batch/eks_container_definition.rb', line 293 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 |