Class: AWSCDK::Batch::CfnJobDefinition::EKSContainerProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
batch/cfn_job_definition.rb

Overview

EKS container properties are used in job definitions for Amazon EKS based job definitions to describe the properties for a container node in the pod that's launched as part of a job.

This can't be specified for Amazon ECS based job definitions.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image:, args: nil, command: nil, env: nil, image_pull_policy: nil, name: nil, resources: nil, security_context: nil, volume_mounts: nil) ⇒ EKSContainerProperty

Returns a new instance of EKSContainerProperty.

Parameters:



1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
# File 'batch/cfn_job_definition.rb', line 1517

def initialize(image:, args: nil, command: nil, env: nil, image_pull_policy: nil, name: nil, resources: nil, security_context: nil, volume_mounts: nil)
  @image = image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "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?
  @env = env
  Jsii::Type.check_type(@env, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5Fa3NDb250YWluZXJFbnZpcm9ubWVudFZhcmlhYmxlUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "env") unless @env.nil?
  @image_pull_policy = image_pull_policy
  Jsii::Type.check_type(@image_pull_policy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imagePullPolicy") unless @image_pull_policy.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @resources = resources.is_a?(Hash) ? ::AWSCDK::Batch::CfnJobDefinition::ResourcesProperty.new(**resources.transform_keys(&:to_sym)) : resources
  Jsii::Type.check_type(@resources, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Kb2JEZWZpbml0aW9uLlJlc291cmNlc1Byb3BlcnR5In1dfX0=")), "resources") unless @resources.nil?
  @security_context = security_context.is_a?(Hash) ? ::AWSCDK::Batch::CfnJobDefinition::SecurityContextProperty.new(**security_context.transform_keys(&:to_sym)) : security_context
  Jsii::Type.check_type(@security_context, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Kb2JEZWZpbml0aW9uLlNlY3VyaXR5Q29udGV4dFByb3BlcnR5In1dfX0=")), "securityContext") unless @security_context.nil?
  @volume_mounts = volume_mounts
  Jsii::Type.check_type(@volume_mounts, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5Fa3NDb250YWluZXJWb2x1bWVNb3VudFByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "volumeMounts") unless @volume_mounts.nil?
end

Instance Attribute Details

#argsArray<String>? (readonly)

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. For example, $$(VAR_NAME) is passed as $(VAR_NAME) whether or not the VAR_NAME environment variable exists. For more information, see Dockerfile reference: CMD and Define a command and arguments for a pod in the Kubernetes documentation .



1551
1552
1553
# File 'batch/cfn_job_definition.rb', line 1551

def args
  @args
end

#commandArray<String>? (readonly)

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. For more information, see ENTRYPOINT in the Dockerfile reference and Define a command and arguments for a container and Entrypoint in the Kubernetes documentation .



1560
1561
1562
# File 'batch/cfn_job_definition.rb', line 1560

def command
  @command
end

#envAWSCDK::IResolvable, ... (readonly)

The environment variables to pass to a container.

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



1567
1568
1569
# File 'batch/cfn_job_definition.rb', line 1567

def env
  @env
end

#imageString (readonly)

The Docker image used to start the container.



1542
1543
1544
# File 'batch/cfn_job_definition.rb', line 1542

def image
  @image
end

#image_pull_policyString? (readonly)

The image pull policy for the container.

Supported values are Always , IfNotPresent , and Never . This parameter defaults to IfNotPresent . However, if the :latest tag is specified, it defaults to Always . For more information, see Updating images in the Kubernetes documentation .



1574
1575
1576
# File 'batch/cfn_job_definition.rb', line 1574

def image_pull_policy
  @image_pull_policy
end

#nameString? (readonly)

The name of the container.

If the name isn't specified, the default name " Default " is used. Each container in a pod must have a unique name.



1581
1582
1583
# File 'batch/cfn_job_definition.rb', line 1581

def name
  @name
end

#resourcesAWSCDK::IResolvable, ... (readonly)

The type and amount of resources to assign to a container.

The supported resources include memory , cpu , and nvidia.com/gpu . For more information, see Resource management for pods and containers in the Kubernetes documentation .



1588
1589
1590
# File 'batch/cfn_job_definition.rb', line 1588

def resources
  @resources
end

#security_contextAWSCDK::IResolvable, ... (readonly)

The security context for a job.

For more information, see Configure a security context for a pod or container in the Kubernetes documentation .



1595
1596
1597
# File 'batch/cfn_job_definition.rb', line 1595

def security_context
  @security_context
end

#volume_mountsAWSCDK::IResolvable, ... (readonly)

The volume mounts for the container.

AWS Batch supports empty_dir , host_path , and secret volume types. For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes documentation .



1602
1603
1604
# File 'batch/cfn_job_definition.rb', line 1602

def volume_mounts
  @volume_mounts
end

Class Method Details

.jsii_propertiesObject



1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
# File 'batch/cfn_job_definition.rb', line 1604

def self.jsii_properties
  {
    :image => "image",
    :args => "args",
    :command => "command",
    :env => "env",
    :image_pull_policy => "imagePullPolicy",
    :name => "name",
    :resources => "resources",
    :security_context => "securityContext",
    :volume_mounts => "volumeMounts",
  }
end

Instance Method Details

#to_jsiiObject



1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
# File 'batch/cfn_job_definition.rb', line 1618

def to_jsii
  result = {}
  result.merge!({
    "image" => @image,
    "args" => @args,
    "command" => @command,
    "env" => @env,
    "imagePullPolicy" => @image_pull_policy,
    "name" => @name,
    "resources" => @resources,
    "securityContext" => @security_context,
    "volumeMounts" => @volume_mounts,
  })
  result.compact
end