This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 4d02add0846f4009f0bcdbe9268c498d1db325cd
Author: Antonin Stefanutti <anto...@stefanutti.fr>
AuthorDate: Wed Jun 5 09:46:17 2019 +0200

    fix: Do not share labels map reference in integration deployment
---
 pkg/trait/deployment.go | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/pkg/trait/deployment.go b/pkg/trait/deployment.go
index a6cc1c4..c27a0b9 100644
--- a/pkg/trait/deployment.go
+++ b/pkg/trait/deployment.go
@@ -123,10 +123,6 @@ func (t *deploymentTrait) getDeploymentFor(e *Environment) 
*appsv1.Deployment {
                envvar.SetVar(&environment, envVar)
        }
 
-       labels := map[string]string{
-               "camel.apache.org/integration": e.Integration.Name,
-       }
-
        // create a copy to avoid sharing the underlying annotation map
        annotations := make(map[string]string)
        if e.Integration.Annotations != nil {
@@ -144,19 +140,25 @@ func (t *deploymentTrait) getDeploymentFor(e 
*Environment) *appsv1.Deployment {
                        APIVersion: appsv1.SchemeGroupVersion.String(),
                },
                ObjectMeta: metav1.ObjectMeta{
-                       Name:        e.Integration.Name,
-                       Namespace:   e.Integration.Namespace,
-                       Labels:      labels,
+                       Name:      e.Integration.Name,
+                       Namespace: e.Integration.Namespace,
+                       Labels: map[string]string{
+                               "camel.apache.org/integration": 
e.Integration.Name,
+                       },
                        Annotations: annotations,
                },
                Spec: appsv1.DeploymentSpec{
                        Replicas: e.Integration.Spec.Replicas,
                        Selector: &metav1.LabelSelector{
-                               MatchLabels: labels,
+                               MatchLabels: map[string]string{
+                                       "camel.apache.org/integration": 
e.Integration.Name,
+                               },
                        },
                        Template: corev1.PodTemplateSpec{
                                ObjectMeta: metav1.ObjectMeta{
-                                       Labels:      labels,
+                                       Labels: map[string]string{
+                                               "camel.apache.org/integration": 
e.Integration.Name,
+                                       },
                                        Annotations: annotations,
                                },
                                Spec: corev1.PodSpec{

Reply via email to