Skip to content

Commit

Permalink
Disabled service links (#1161)
Browse files Browse the repository at this point in the history
Disabled information about services being injected into pod's environment variables.

Signed-off-by: Michael Lorant <[email protected]>

Co-authored-by: Michael Lorant <[email protected]>
  • Loading branch information
mikelorant and Michael Lorant authored Aug 19, 2020
1 parent 584df0b commit 2ea13b2
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/deployment/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (a *Agent) Get() *appsv1.DaemonSet {
adminPort := util.GetPort("--admin-http-port=", args, 14271)

trueVar := true
falseVar := false
labels := util.Labels(a.name(), "agent", *a.jaeger)

baseCommonSpec := v1.JaegerCommonSpec{
Expand Down Expand Up @@ -184,6 +185,7 @@ func (a *Agent) Get() *appsv1.DaemonSet {
Tolerations: commonSpec.Tolerations,
SecurityContext: commonSpec.SecurityContext,
ServiceAccountName: account.JaegerServiceAccountFor(a.jaeger, account.AgentComponent),
EnableServiceLinks: &falseVar,
},
},
},
Expand Down
9 changes: 9 additions & 0 deletions pkg/deployment/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,12 @@ func TestAgentOTELConfig(t *testing.T) {
assert.True(t, hasVolume("my-instance-agent-otel-config", d.Spec.Template.Spec.Volumes))
assert.True(t, hasVolumeMount("my-instance-agent-otel-config", d.Spec.Template.Spec.Containers[0].VolumeMounts))
}

func TestAgentServiceLinks(t *testing.T) {
jaeger := v1.NewJaeger(types.NamespacedName{Name: "my-instance"})
jaeger.Spec.Agent.Strategy = "daemonset"
a := NewAgent(jaeger)
dep := a.Get()
falseVar := false
assert.Equal(t, &falseVar, dep.Spec.Template.Spec.EnableServiceLinks)
}
2 changes: 2 additions & 0 deletions pkg/deployment/all_in_one.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func NewAllInOne(jaeger *v1.Jaeger) *AllInOne {
func (a *AllInOne) Get() *appsv1.Deployment {
a.jaeger.Logger().Debug("Assembling an all-in-one deployment")
trueVar := true
falseVar := false

args := append(a.jaeger.Spec.AllInOne.Options.ToArgs())

Expand Down Expand Up @@ -215,6 +216,7 @@ func (a *AllInOne) Get() *appsv1.Deployment {
Affinity: commonSpec.Affinity,
Tolerations: commonSpec.Tolerations,
SecurityContext: commonSpec.SecurityContext,
EnableServiceLinks: &falseVar,
},
},
},
Expand Down
7 changes: 7 additions & 0 deletions pkg/deployment/all_in_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,10 @@ func TestAllInOneOTELConfig_error(t *testing.T) {
assert.False(t, hasVolume("instance-all-in-one-otel-config", d.Spec.Template.Spec.Volumes))
assert.False(t, hasVolumeMount("instance-all-in-one-otel-config", d.Spec.Template.Spec.Containers[0].VolumeMounts))
}

func TestAllInOneServiceLinks(t *testing.T) {
a := NewAllInOne(v1.NewJaeger(types.NamespacedName{Name: "TestAllInOneServiceLinks"}))
dep := a.Get()
falseVar := false
assert.Equal(t, &falseVar, dep.Spec.Template.Spec.EnableServiceLinks)
}
2 changes: 2 additions & 0 deletions pkg/deployment/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (c *Collector) Get() *appsv1.Deployment {

labels := c.labels()
trueVar := true
falseVar := false

args := append(c.jaeger.Spec.Collector.Options.ToArgs())

Expand Down Expand Up @@ -187,6 +188,7 @@ func (c *Collector) Get() *appsv1.Deployment {
Affinity: commonSpec.Affinity,
Tolerations: commonSpec.Tolerations,
SecurityContext: commonSpec.SecurityContext,
EnableServiceLinks: &falseVar,
},
},
},
Expand Down
7 changes: 7 additions & 0 deletions pkg/deployment/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,13 @@ func TestCollectorOTELConfig(t *testing.T) {
assert.True(t, hasVolumeMount("instance-collector-otel-config", d.Spec.Template.Spec.Containers[0].VolumeMounts))
}

func TestCollectorServiceLinks(t *testing.T) {
c := NewCollector(v1.NewJaeger(types.NamespacedName{Name: "my-instance"}))
dep := c.Get()
falseVar := false
assert.Equal(t, &falseVar, dep.Spec.Template.Spec.EnableServiceLinks)
}

func hasVolume(name string, volumes []corev1.Volume) bool {
for _, v := range volumes {
if v.Name == name {
Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (i *Ingester) Get() *appsv1.Deployment {

labels := i.labels()
trueVar := true
falseVar := false

args := append(i.jaeger.Spec.Ingester.Options.ToArgs())

Expand Down Expand Up @@ -162,6 +163,7 @@ func (i *Ingester) Get() *appsv1.Deployment {
Affinity: commonSpec.Affinity,
Tolerations: commonSpec.Tolerations,
SecurityContext: commonSpec.SecurityContext,
EnableServiceLinks: &falseVar,
},
},
},
Expand Down
7 changes: 7 additions & 0 deletions pkg/deployment/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,3 +453,10 @@ func TestIngesterOTELConfig(t *testing.T) {
assert.True(t, hasVolume("instance-ingester-otel-config", d.Spec.Template.Spec.Volumes))
assert.True(t, hasVolumeMount("instance-ingester-otel-config", d.Spec.Template.Spec.Containers[0].VolumeMounts))
}

func TestIngesterServiceLinks(t *testing.T) {
ingester := NewIngester(newIngesterJaeger("TestIngesterServiceLinks"))
dep := ingester.Get()
falseVar := false
assert.Equal(t, &falseVar, dep.Spec.Template.Spec.EnableServiceLinks)
}
2 changes: 2 additions & 0 deletions pkg/deployment/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (q *Query) Get() *appsv1.Deployment {
q.jaeger.Logger().Debug("Assembling a query deployment")
labels := q.labels()
trueVar := true
falseVar := false

args := append(q.jaeger.Spec.Query.Options.ToArgs())

Expand Down Expand Up @@ -155,6 +156,7 @@ func (q *Query) Get() *appsv1.Deployment {
Affinity: commonSpec.Affinity,
Tolerations: commonSpec.Tolerations,
SecurityContext: commonSpec.SecurityContext,
EnableServiceLinks: &falseVar,
},
},
},
Expand Down
7 changes: 7 additions & 0 deletions pkg/deployment/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,10 @@ func TestQueryOrderOfArguments(t *testing.T) {
assert.True(t, strings.HasPrefix(dep.Spec.Template.Spec.Containers[0].Args[1], "--b-option"))
assert.True(t, strings.HasPrefix(dep.Spec.Template.Spec.Containers[0].Args[2], "--c-option"))
}

func TestQueryServiceLinks(t *testing.T) {
query := NewQuery(v1.NewJaeger(types.NamespacedName{Name: "TestQueryServiceLinks"}))
dep := query.Get()
falseVar := false
assert.Equal(t, &falseVar, dep.Spec.Template.Spec.EnableServiceLinks)
}

0 comments on commit 2ea13b2

Please sign in to comment.