From c676e739ec87ca001489f7469934045953111b12 Mon Sep 17 00:00:00 2001 From: Gary Brown Date: Tue, 16 Oct 2018 15:56:10 +0100 Subject: [PATCH] =?UTF-8?q?Add=20sidecar.istio.io/inject=3Dfalse=20annotat?= =?UTF-8?q?ion=20to=20all-in-one,=20agent=20(da=E2=80=A6=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add sidecar.istio.io/inject=false annotation to all-in-one, agent (daemonset), query and collector Signed-off-by: Gary Brown --- pkg/deployment/agent.go | 1 + pkg/deployment/agent_test.go | 6 +++++- pkg/deployment/all-in-one.go | 1 + pkg/deployment/all-in-one_test.go | 2 ++ pkg/deployment/collector.go | 1 + pkg/deployment/collector_test.go | 2 ++ pkg/deployment/query.go | 1 + pkg/deployment/query_test.go | 2 ++ 8 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/deployment/agent.go b/pkg/deployment/agent.go index b0a8d4766..a9a22a503 100644 --- a/pkg/deployment/agent.go +++ b/pkg/deployment/agent.go @@ -62,6 +62,7 @@ func (a *Agent) Get() *appsv1.DaemonSet { annotations := map[string]string{ prometheusScrapeKey: prometheusScrapeValue, prometheusPortKey: "5778", + "sidecar.istio.io/inject": "false", } return &appsv1.DaemonSet{ diff --git a/pkg/deployment/agent_test.go b/pkg/deployment/agent_test.go index 41adb3657..119ede9da 100644 --- a/pkg/deployment/agent_test.go +++ b/pkg/deployment/agent_test.go @@ -56,5 +56,9 @@ func TestGetDaemonSetDeployment(t *testing.T) { jaeger := v1alpha1.NewJaeger("TestGetDaemonSetDeployment") jaeger.Spec.Agent.Strategy = daemonSetStrategy agent := NewAgent(jaeger) - assert.NotNil(t, agent.Get()) + + ds := agent.Get() + assert.NotNil(t, ds) + + assert.Equal(t, "false", ds.Spec.Template.Annotations["sidecar.istio.io/inject"]) } diff --git a/pkg/deployment/all-in-one.go b/pkg/deployment/all-in-one.go index 27d6b1a0d..0a5d1f31d 100644 --- a/pkg/deployment/all-in-one.go +++ b/pkg/deployment/all-in-one.go @@ -40,6 +40,7 @@ func (a *AllInOne) Get() *appsv1.Deployment { annotations := map[string]string{ prometheusScrapeKey: prometheusScrapeValue, prometheusPortKey: "16686", + "sidecar.istio.io/inject": "false", } return &appsv1.Deployment{ diff --git a/pkg/deployment/all-in-one_test.go b/pkg/deployment/all-in-one_test.go index 4c68da73e..a16bd3359 100644 --- a/pkg/deployment/all-in-one_test.go +++ b/pkg/deployment/all-in-one_test.go @@ -36,6 +36,8 @@ func TestDefaultAllInOneImage(t *testing.T) { }, } assert.Equal(t, envvars, d.Spec.Template.Spec.Containers[0].Env) + + assert.Equal(t, "false", d.Spec.Template.ObjectMeta.Annotations["sidecar.istio.io/inject"]) } func TestAllInOneHasOwner(t *testing.T) { diff --git a/pkg/deployment/collector.go b/pkg/deployment/collector.go index b490244ba..afbb86210 100644 --- a/pkg/deployment/collector.go +++ b/pkg/deployment/collector.go @@ -42,6 +42,7 @@ func (c *Collector) Get() *appsv1.Deployment { annotations := map[string]string{ prometheusScrapeKey: prometheusScrapeValue, prometheusPortKey: "14268", + "sidecar.istio.io/inject": "false", } return &appsv1.Deployment{ diff --git a/pkg/deployment/collector_test.go b/pkg/deployment/collector_test.go index 79d2c58ce..37e5b7571 100644 --- a/pkg/deployment/collector_test.go +++ b/pkg/deployment/collector_test.go @@ -68,4 +68,6 @@ func TestDefaultCollectorImage(t *testing.T) { }, } assert.Equal(t, envvars, containers[0].Env) + + assert.Equal(t, "false", dep.Spec.Template.ObjectMeta.Annotations["sidecar.istio.io/inject"]) } diff --git a/pkg/deployment/query.go b/pkg/deployment/query.go index 8b146bf3a..05d213b6f 100644 --- a/pkg/deployment/query.go +++ b/pkg/deployment/query.go @@ -45,6 +45,7 @@ func (q *Query) Get() *appsv1.Deployment { annotations := map[string]string{ prometheusScrapeKey: prometheusScrapeValue, prometheusPortKey: "16686", + "sidecar.istio.io/inject": "false", // note that we are explicitly using a string here, not the value from `inject.Annotation` // this has two reasons: diff --git a/pkg/deployment/query_test.go b/pkg/deployment/query_test.go index f32dab357..fd315dde8 100644 --- a/pkg/deployment/query_test.go +++ b/pkg/deployment/query_test.go @@ -44,6 +44,8 @@ func TestDefaultQueryImage(t *testing.T) { assert.Len(t, containers, 1) assert.Equal(t, "org/custom-query-image:123", containers[0].Image) + + assert.Equal(t, "false", dep.Spec.Template.ObjectMeta.Annotations["sidecar.istio.io/inject"]) } func TestQueryPodName(t *testing.T) {