Class: AWSCDK::Batch::EKSContainerDefinitionProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Batch::EKSContainerDefinitionProps
- Defined in:
- batch/eks_container_definition_props.rb
Overview
Props to configure an EksContainerDefinition.
Instance Attribute Summary collapse
-
#args ⇒ Array<String>?
readonly
An array of arguments to the entrypoint.
-
#command ⇒ Array<String>?
readonly
The entrypoint for the container.
-
#cpu_limit ⇒ Numeric?
readonly
The hard limit of CPUs to present to this container.
-
#cpu_reservation ⇒ Numeric?
readonly
The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.
-
#env ⇒ Hash{String => String}?
readonly
The environment variables to pass to this container.
-
#gpu_limit ⇒ Numeric?
readonly
The hard limit of GPUs to present to this container.
-
#gpu_reservation ⇒ Numeric?
readonly
The soft limit of CPUs to reserve for the container Must be an even multiple of 0.25.
-
#image ⇒ AWSCDK::ECS::ContainerImage
readonly
The image that this container will run.
-
#image_pull_policy ⇒ AWSCDK::Batch::ImagePullPolicy?
readonly
The image pull policy for this container.
-
#memory_limit ⇒ AWSCDK::Size?
readonly
The amount (in MiB) of memory to present to the container.
-
#memory_reservation ⇒ AWSCDK::Size?
readonly
The soft limit (in MiB) of memory to reserve for the container.
-
#name ⇒ String?
readonly
The name of this container.
-
#privileged ⇒ Boolean?
readonly
If specified, gives this container elevated permissions on the host container instance.
-
#readonly_root_filesystem ⇒ Boolean?
readonly
If specified, gives this container readonly access to its root file system.
-
#run_as_group ⇒ Numeric?
readonly
If specified, the container is run as the specified group ID (
gid). -
#run_as_root ⇒ Boolean?
readonly
If specified, the container is run as a user with a
uidother than 0. -
#run_as_user ⇒ Numeric?
readonly
If specified, this container is run as the specified user ID (
uid). -
#volumes ⇒ Array<AWSCDK::Batch::EKSVolume>?
readonly
The Volumes to mount to this container.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(image:, args: nil, command: nil, cpu_limit: nil, cpu_reservation: nil, env: nil, gpu_limit: nil, gpu_reservation: nil, image_pull_policy: nil, memory_limit: nil, memory_reservation: nil, name: nil, privileged: nil, readonly_root_filesystem: nil, run_as_group: nil, run_as_root: nil, run_as_user: nil, volumes: nil) ⇒ EKSContainerDefinitionProps
constructor
A new instance of EKSContainerDefinitionProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(image:, args: nil, command: nil, cpu_limit: nil, cpu_reservation: nil, env: nil, gpu_limit: nil, gpu_reservation: nil, image_pull_policy: nil, memory_limit: nil, memory_reservation: nil, name: nil, privileged: nil, readonly_root_filesystem: nil, run_as_group: nil, run_as_root: nil, run_as_user: nil, volumes: nil) ⇒ EKSContainerDefinitionProps
Returns a new instance of EKSContainerDefinitionProps.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'batch/eks_container_definition_props.rb', line 25 def initialize(image:, args: nil, command: nil, cpu_limit: nil, cpu_reservation: nil, env: nil, gpu_limit: nil, gpu_reservation: nil, image_pull_policy: nil, memory_limit: nil, memory_reservation: nil, name: nil, privileged: nil, readonly_root_filesystem: nil, run_as_group: nil, run_as_root: nil, run_as_user: nil, volumes: nil) @image = image Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckltYWdlIn0=")), "image") @args = args Jsii::Type.check_type(@args, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "args") unless @args.nil? @command = command Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil? @cpu_limit = cpu_limit Jsii::Type.check_type(@cpu_limit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpuLimit") unless @cpu_limit.nil? @cpu_reservation = cpu_reservation Jsii::Type.check_type(@cpu_reservation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpuReservation") unless @cpu_reservation.nil? @env = env Jsii::Type.check_type(@env, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "env") unless @env.nil? @gpu_limit = gpu_limit Jsii::Type.check_type(@gpu_limit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "gpuLimit") unless @gpu_limit.nil? @gpu_reservation = gpu_reservation Jsii::Type.check_type(@gpu_reservation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "gpuReservation") unless @gpu_reservation.nil? @image_pull_policy = image_pull_policy Jsii::Type.check_type(@image_pull_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guSW1hZ2VQdWxsUG9saWN5In0=")), "imagePullPolicy") unless @image_pull_policy.nil? @memory_limit = memory_limit Jsii::Type.check_type(@memory_limit, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "memoryLimit") unless @memory_limit.nil? @memory_reservation = memory_reservation Jsii::Type.check_type(@memory_reservation, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "memoryReservation") unless @memory_reservation.nil? @name = name Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil? @privileged = privileged Jsii::Type.check_type(@privileged, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "privileged") unless @privileged.nil? @readonly_root_filesystem = readonly_root_filesystem Jsii::Type.check_type(@readonly_root_filesystem, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "readonlyRootFilesystem") unless @readonly_root_filesystem.nil? @run_as_group = run_as_group Jsii::Type.check_type(@run_as_group, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "runAsGroup") unless @run_as_group.nil? @run_as_root = run_as_root Jsii::Type.check_type(@run_as_root, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "runAsRoot") unless @run_as_root.nil? @run_as_user = run_as_user Jsii::Type.check_type(@run_as_user, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "runAsUser") unless @run_as_user.nil? @volumes = volumes Jsii::Type.check_type(@volumes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5Fa3NWb2x1bWUifSwia2luZCI6ImFycmF5In19")), "volumes") unless @volumes.nil? end |
Instance Attribute Details
#args ⇒ Array<String>? (readonly)
Default: - no args
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.
81 82 83 |
# File 'batch/eks_container_definition_props.rb', line 81 def args @args end |
#command ⇒ Array<String>? (readonly)
Default: - no command
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.
97 98 99 |
# File 'batch/eks_container_definition_props.rb', line 97 def command @command end |
#cpu_limit ⇒ Numeric? (readonly)
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.
108 109 110 |
# File 'batch/eks_container_definition_props.rb', line 108 def cpu_limit @cpu_limit end |
#cpu_reservation ⇒ Numeric? (readonly)
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.
119 120 121 |
# File 'batch/eks_container_definition_props.rb', line 119 def cpu_reservation @cpu_reservation end |
#env ⇒ Hash{String => String}? (readonly)
Default: - no environment variables
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.
127 128 129 |
# File 'batch/eks_container_definition_props.rb', line 127 def env @env end |
#gpu_limit ⇒ Numeric? (readonly)
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.
137 138 139 |
# File 'batch/eks_container_definition_props.rb', line 137 def gpu_limit @gpu_limit end |
#gpu_reservation ⇒ Numeric? (readonly)
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.
147 148 149 |
# File 'batch/eks_container_definition_props.rb', line 147 def gpu_reservation @gpu_reservation end |
#image ⇒ AWSCDK::ECS::ContainerImage (readonly)
The image that this container will run.
67 68 69 |
# File 'batch/eks_container_definition_props.rb', line 67 def image @image end |
#image_pull_policy ⇒ AWSCDK::Batch::ImagePullPolicy? (readonly)
Default: - ALWAYS if the :latest tag is specified, IF_NOT_PRESENT otherwise
The image pull policy for this container.
153 154 155 |
# File 'batch/eks_container_definition_props.rb', line 153 def image_pull_policy @image_pull_policy end |
#memory_limit ⇒ AWSCDK::Size? (readonly)
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.
168 169 170 |
# File 'batch/eks_container_definition_props.rb', line 168 def memory_limit @memory_limit end |
#memory_reservation ⇒ AWSCDK::Size? (readonly)
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.
190 191 192 |
# File 'batch/eks_container_definition_props.rb', line 190 def memory_reservation @memory_reservation end |
#name ⇒ String? (readonly)
Default: : 'Default'
The name of this container.
195 196 197 |
# File 'batch/eks_container_definition_props.rb', line 195 def name @name end |
#privileged ⇒ Boolean? (readonly)
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
207 208 209 |
# File 'batch/eks_container_definition_props.rb', line 207 def privileged @privileged end |
#readonly_root_filesystem ⇒ Boolean? (readonly)
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
217 218 219 |
# File 'batch/eks_container_definition_props.rb', line 217 def readonly_root_filesystem @readonly_root_filesystem end |
#run_as_group ⇒ Numeric? (readonly)
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/eks_container_definition_props.rb', line 228 def run_as_group @run_as_group end |
#run_as_root ⇒ Boolean? (readonly)
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
239 240 241 |
# File 'batch/eks_container_definition_props.rb', line 239 def run_as_root @run_as_root end |
#run_as_user ⇒ Numeric? (readonly)
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
249 250 251 |
# File 'batch/eks_container_definition_props.rb', line 249 def run_as_user @run_as_user end |
#volumes ⇒ Array<AWSCDK::Batch::EKSVolume>? (readonly)
Default: - no volumes
The Volumes to mount to this container.
Automatically added to the Pod.
257 258 259 |
# File 'batch/eks_container_definition_props.rb', line 257 def volumes @volumes end |
Class Method Details
.jsii_properties ⇒ Object
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'batch/eks_container_definition_props.rb', line 259 def self.jsii_properties { :image => "image", :args => "args", :command => "command", :cpu_limit => "cpuLimit", :cpu_reservation => "cpuReservation", :env => "env", :gpu_limit => "gpuLimit", :gpu_reservation => "gpuReservation", :image_pull_policy => "imagePullPolicy", :memory_limit => "memoryLimit", :memory_reservation => "memoryReservation", :name => "name", :privileged => "privileged", :readonly_root_filesystem => "readonlyRootFilesystem", :run_as_group => "runAsGroup", :run_as_root => "runAsRoot", :run_as_user => "runAsUser", :volumes => "volumes", } end |
Instance Method Details
#to_jsii ⇒ Object
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'batch/eks_container_definition_props.rb', line 282 def to_jsii result = {} result.merge!({ "image" => @image, "args" => @args, "command" => @command, "cpuLimit" => @cpu_limit, "cpuReservation" => @cpu_reservation, "env" => @env, "gpuLimit" => @gpu_limit, "gpuReservation" => @gpu_reservation, "imagePullPolicy" => @image_pull_policy, "memoryLimit" => @memory_limit, "memoryReservation" => @memory_reservation, "name" => @name, "privileged" => @privileged, "readonlyRootFilesystem" => @readonly_root_filesystem, "runAsGroup" => @run_as_group, "runAsRoot" => @run_as_root, "runAsUser" => @run_as_user, "volumes" => @volumes, }) result.compact end |