EksContainerProperty Struct
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.
| Source | |
|---|---|
| Type last changed |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_batch as batch } from 'aws-cdk-lib';
declare const limits: any;
declare const requests: any;
const eksContainerProperty: batch.CfnJobDefinition.EksContainerProperty = {
image: 'image',
// the properties below are optional
args: ['args'],
command: ['command'],
env: [{
name: 'name',
// the properties below are optional
value: 'value',
}],
imagePullPolicy: 'imagePullPolicy',
name: 'name',
resources: {
limits: limits,
requests: requests,
},
securityContext: {
allowPrivilegeEscalation: false,
capabilities: {
add: ['add'],
drop: ['drop'],
},
privileged: false,
readOnlyRootFilesystem: false,
runAsGroup: 123,
runAsNonRoot: false,
runAsUser: 123,
seccompProfile: {
type: 'type',
// the properties below are optional
localhostProfile: 'localhostProfile',
},
},
volumeMounts: [{
mountPath: 'mountPath',
name: 'name',
readOnly: false,
subPath: 'subPath',
}],
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_batch as batch
# limits: Any
# requests: Any
eks_container_property = batch.CfnJobDefinition.EksContainerProperty(
image="image",
# the properties below are optional
args=["args"],
command=["command"],
env=[batch.CfnJobDefinition.EksContainerEnvironmentVariableProperty(
name="name",
# the properties below are optional
value="value"
)],
image_pull_policy="imagePullPolicy",
name="name",
resources=batch.CfnJobDefinition.ResourcesProperty(
limits=limits,
requests=requests
),
security_context=batch.CfnJobDefinition.SecurityContextProperty(
allow_privilege_escalation=False,
capabilities=batch.CfnJobDefinition.EksContainerLinuxCapabilitiesProperty(
add=["add"],
drop=["drop"]
),
privileged=False,
read_only_root_filesystem=False,
run_as_group=123,
run_as_non_root=False,
run_as_user=123,
seccomp_profile=batch.CfnJobDefinition.EksSeccompProfileProperty(
type="type",
# the properties below are optional
localhost_profile="localhostProfile"
)
),
volume_mounts=[batch.CfnJobDefinition.EksContainerVolumeMountProperty(
mount_path="mountPath",
name="name",
read_only=False,
sub_path="subPath"
)]
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.batch.*;
Object limits;
Object requests;
EksContainerProperty eksContainerProperty = EksContainerProperty.builder()
.image("image")
// the properties below are optional
.args(List.of("args"))
.command(List.of("command"))
.env(List.of(EksContainerEnvironmentVariableProperty.builder()
.name("name")
// the properties below are optional
.value("value")
.build()))
.imagePullPolicy("imagePullPolicy")
.name("name")
.resources(ResourcesProperty.builder()
.limits(limits)
.requests(requests)
.build())
.securityContext(SecurityContextProperty.builder()
.allowPrivilegeEscalation(false)
.capabilities(EksContainerLinuxCapabilitiesProperty.builder()
.add(List.of("add"))
.drop(List.of("drop"))
.build())
.privileged(false)
.readOnlyRootFilesystem(false)
.runAsGroup(123)
.runAsNonRoot(false)
.runAsUser(123)
.seccompProfile(EksSeccompProfileProperty.builder()
.type("type")
// the properties below are optional
.localhostProfile("localhostProfile")
.build())
.build())
.volumeMounts(List.of(EksContainerVolumeMountProperty.builder()
.mountPath("mountPath")
.name("name")
.readOnly(false)
.subPath("subPath")
.build()))
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Batch;
var limits;
var requests;
var eksContainerProperty = new EksContainerProperty {
Image = "image",
// the properties below are optional
Args = new [] { "args" },
Command = new [] { "command" },
Env = new [] { new EksContainerEnvironmentVariableProperty {
Name = "name",
// the properties below are optional
Value = "value"
} },
ImagePullPolicy = "imagePullPolicy",
Name = "name",
Resources = new ResourcesProperty {
Limits = limits,
Requests = requests
},
SecurityContext = new SecurityContextProperty {
AllowPrivilegeEscalation = false,
Capabilities = new EksContainerLinuxCapabilitiesProperty {
Add = new [] { "add" },
Drop = new [] { "drop" }
},
Privileged = false,
ReadOnlyRootFilesystem = false,
RunAsGroup = 123,
RunAsNonRoot = false,
RunAsUser = 123,
SeccompProfile = new EksSeccompProfileProperty {
Type = "type",
// the properties below are optional
LocalhostProfile = "localhostProfile"
}
},
VolumeMounts = new [] { new EksContainerVolumeMountProperty {
MountPath = "mountPath",
Name = "name",
ReadOnly = false,
SubPath = "subPath"
} }
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
var limits interface{}
var requests interface{}
eksContainerProperty := &EksContainerProperty{
Image: jsii.String("image"),
// the properties below are optional
Args: []*string{
jsii.String("args"),
},
Command: []*string{
jsii.String("command"),
},
Env: []interface{}{
&EksContainerEnvironmentVariableProperty{
Name: jsii.String("name"),
// the properties below are optional
Value: jsii.String("value"),
},
},
ImagePullPolicy: jsii.String("imagePullPolicy"),
Name: jsii.String("name"),
Resources: &ResourcesProperty{
Limits: limits,
Requests: requests,
},
SecurityContext: &SecurityContextProperty{
AllowPrivilegeEscalation: jsii.Boolean(false),
Capabilities: &EksContainerLinuxCapabilitiesProperty{
Add: []*string{
jsii.String("add"),
},
Drop: []*string{
jsii.String("drop"),
},
},
Privileged: jsii.Boolean(false),
ReadOnlyRootFilesystem: jsii.Boolean(false),
RunAsGroup: jsii.Number(123),
RunAsNonRoot: jsii.Boolean(false),
RunAsUser: jsii.Number(123),
SeccompProfile: &EksSeccompProfileProperty{
Type: jsii.String("type"),
// the properties below are optional
LocalhostProfile: jsii.String("localhostProfile"),
},
},
VolumeMounts: []interface{}{
&EksContainerVolumeMountProperty{
MountPath: jsii.String("mountPath"),
Name: jsii.String("name"),
ReadOnly: jsii.Boolean(false),
SubPath: jsii.String("subPath"),
},
},
}
Properties
argsoptionalstring[]argsoptionaltyping.List[str]argsoptionalList<String>Argsoptionalstring[]Argsoptional*[]*string #notes
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 .
commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string #notes
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 .
envoptionalIResolvable | IResolvable | CfnJobDefinition.envoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, EksContainerEnvironmentVariableProperty]]]envoptionalIResolvableEnvoptionalIResolvableEnvoptionalinterface{} #Environment variables cannot start with "
AWS_BATCH". This naming convention is reserved for variables that AWS Batch sets.
imagePullPolicyoptionalstringimage_pull_policyoptionalstrimagePullPolicyoptionalStringImagePullPolicyoptionalstringImagePullPolicyoptional*string #notes
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 .
If the name isn't specified, the default name " Default " is used. Each container in a pod must have a unique name.
resourcesoptionalIResolvable | CfnJobDefinition.resourcesoptionaltyping.Union[IResolvable, ResourcesProperty]resourcesoptionalIResolvableResourcesoptionalIResolvableResourcesoptionalinterface{} #notes
The supported resources include memory , cpu , and nvidia.com/gpu . For more information, see Resource management for pods and containers in the Kubernetes documentation .
securityContextoptionalIResolvable | CfnJobDefinition.security_contextoptionaltyping.Union[IResolvable, SecurityContextProperty]securityContextoptionalIResolvableSecurityContextoptionalIResolvableSecurityContextoptionalinterface{} #For more information, see Configure a security context for a pod or container in the Kubernetes documentation .
volumeMountsoptionalIResolvable | IResolvable | CfnJobDefinition.volume_mountsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, EksContainerVolumeMountProperty]]]volumeMountsoptionalIResolvableVolumeMountsoptionalIResolvableVolumeMountsoptionalinterface{} #notes
AWS Batch supports emptyDir , hostPath , and secret volume types. For more information about volumes and volume mounts in Kubernetes, see Volumes in the Kubernetes documentation .