astefanutti commented on a change in pull request #835: Stable container name
URL: https://github.com/apache/camel-k/pull/835#discussion_r304951112
##########
File path: pkg/trait/container.go
##########
@@ -74,19 +81,23 @@ func (t *containerTrait) Configure(e *Environment) (bool,
error) {
func (t *containerTrait) Apply(e *Environment) error {
- if e.Resources != nil {
- //
- // Add mounted volumes as resources
- //
- e.Resources.VisitDeployment(func(deployment *appsv1.Deployment)
{
- for i := 0; i <
len(deployment.Spec.Template.Spec.Containers); i++ {
- t.configureResources(e,
&deployment.Spec.Template.Spec.Containers[i])
- }
- })
- e.Resources.VisitKnativeService(func(service *serving.Service) {
- t.configureResources(e,
&service.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Container)
- })
- }
+ //
+ // Add mounted volumes as resources
+ //
+ e.Resources.VisitDeployment(func(deployment *appsv1.Deployment) {
+ for i := 0; i < len(deployment.Spec.Template.Spec.Containers);
i++ {
+ container :=
&deployment.Spec.Template.Spec.Containers[i]
+ container.Name = t.Name
Review comment:
It is likely that there is one container, stills I find it confusing that
the code iterate over all the containers and sets the same name for all of them.
It seems the container trait should be responsible for building the
container object, that then should be added to the deployment template by the
deployment trait.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services