aws-cdk: (aws-batch): Most JobDefinition.ContainerProperties.LinuxParameters are not rendered
JobDefinition.buildJobContainer() explicitly only renders devices from container.linuxParams, omitting all other parameters.
The implementation for JobDefinition makes it seem like this is intentional.
Reproduction Steps
new JobDefinition(this, 'jobDef', {
container: {
linuxParams: new LinuxParameters(this, 'linuxParams', {
sharedMemorySize: 24_000,
}),
...
},
jobDefinitionName: 'test',
})
What did you expect to happen?
The rendered stack should contain:
"LinuxParameters": {
"SharedMemorySize": 24000
},
What actually happened?
No parameters are rendered:
"LinuxParameters": {},
Environment
- CDK CLI Version: 1.89.0
- Framework Version: 1.89.0
- Node.js Version: v12.20.2
- OS : MacOS 11.2.1
- Language (Version): Typescript 4.1.5
Other
Here’s the relevant code in job-definition.js:
buildJobContainer(container) {
if (container === undefined) {
return undefined;
}
return {
...
linuxParameters: container.linuxParams
? { devices: container.linuxParams.renderLinuxParameters().devices }
: undefined,
...
This is 🐛 Bug Report
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 37 (26 by maintainers)
Yep, so I can confirm that I will try switching over to the ECS construct for Linux Params.
However, they are missing some newer params that are now supported (i.e. Swappiness). So I’ll look into adding these along with the change.
So - I can see that at the time of creation, this was built to support only devices and no other linux parameters. However, it should be an easy fix to have this extended. I will give it a shot 👌
https://docs.aws.amazon.com/batch/latest/APIReference/API_LinuxParameters.html
this has been fixed in the version that will be released this week
Bumping this issue.
In the meantime looks like we have to implement our own custom L2 construct since
buildJobContainer()is a private function and cannot be overridden.Any simpler workarounds?
This is on my court to finish up. I haven’t had much spare time but I need to setup a PR with the adjustments. On 25 Jun 2021, 19:12 +0200, Data Brezack @.***>, wrote:
It looks like this is also occurring for the addCapabilities option as well
Devices works perfectly but addCapabilities does not. Also as per the documentation our launch type is EC2 https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ecs.LinuxParameters.html#addwbrcapabilitiescap
Sure, no problem 😊👌