-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(ecs): ContainerDefinition.addDockerLabel #29728
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-ecsRelated to Amazon Elastic ContainerRelated to Amazon Elastic Containereffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdRelated to contributions. See CONTRIBUTING.mdp2
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-ecsRelated to Amazon Elastic ContainerRelated to Amazon Elastic Containereffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdRelated to contributions. See CONTRIBUTING.mdp2
Type
Fields
Give feedbackNo fields configured for issues without a type.
Describe the feature
It would be nice to be able to add docker labels after the container has been constructed.
For example, I can call
addEnvironmentto add an environment variable after the fact: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ContainerDefinition.html#addwbrenvironmentname-valueHowever, I can't do the same with docker labels.
Use Case
I have a construct that automatically applies Datadog monitoring information to a TaskDefinition with an application container. Datadog requires that I set some information as Docker Labels for observability:
However, I want to add these labels after the user already created their default container.
Proposed Solution
Add a
.addDockerLabelmethod similar to.addEnvironmentto theContainerDefinitonconstruct. It'd be similar to #2559 / #17889Other Information
You can hack this like so:
But it's not ideal
Acknowledgements
CDK version used
2.135.0
Environment details (OS name and version, etc.)
MacOS Sonoma