Skip to content

Commit

Permalink
Add sidecar.istio.io/inject=false annotation to all-in-one, agent (da… (
Browse files Browse the repository at this point in the history
#67)

* Add sidecar.istio.io/inject=false annotation to all-in-one, agent (daemonset), query and collector

Signed-off-by: Gary Brown <gary@brownuk.com>
  • Loading branch information
objectiser authored and jpkrohling committed Oct 16, 2018
1 parent 2f458c1 commit 70b543b
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 9 deletions.
5 changes: 3 additions & 2 deletions pkg/deployment/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ func (a *Agent) Get() *appsv1.DaemonSet {
trueVar := true
selector := a.selector()
annotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": "5778",
"prometheus.io/scrape": "true",
"prometheus.io/port": "5778",
"sidecar.istio.io/inject": "false",
}

return &appsv1.DaemonSet{
Expand Down
6 changes: 5 additions & 1 deletion pkg/deployment/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@ func TestGetDaemonSetDeployment(t *testing.T) {
jaeger := v1alpha1.NewJaeger("TestNewAgent")
jaeger.Spec.Agent.Strategy = "daemonset"
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"])
}
5 changes: 3 additions & 2 deletions pkg/deployment/all-in-one.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ func (a *AllInOne) Get() *appsv1.Deployment {
selector := a.selector()
trueVar := true
annotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": "16686",
"prometheus.io/scrape": "true",
"prometheus.io/port": "16686",
"sidecar.istio.io/inject": "false",
}

return &appsv1.Deployment{
Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/all-in-one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/deployment/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ func (c *Collector) Get() *appsv1.Deployment {
trueVar := true
replicas := int32(c.jaeger.Spec.Collector.Size)
annotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": "14268",
"prometheus.io/scrape": "true",
"prometheus.io/port": "14268",
"sidecar.istio.io/inject": "false",
}

return &appsv1.Deployment{
Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
}
5 changes: 3 additions & 2 deletions pkg/deployment/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ func (q *Query) Get() *appsv1.Deployment {
trueVar := true
replicas := int32(q.jaeger.Spec.Query.Size)
annotations := map[string]string{
"prometheus.io/scrape": "true",
"prometheus.io/port": "16686",
"prometheus.io/scrape": "true",
"prometheus.io/port": "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:
Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 70b543b

Please sign in to comment.