Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sidecar injection for query pod from other Jaeger instances #1569

Merged
merged 2 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/controller/deployment/deployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (r *ReconcileDeployment) Reconcile(request reconcile.Request) (reconcile.Re
return reconcile.Result{}, tracing.HandleError(err, span)
}

if dep.Labels["app"] == "jaeger" {
if dep.Labels["app"] == "jaeger" && dep.Labels["app.kubernetes.io/component"] != "query" {
// Don't touch jaeger deployments
return reconcile.Result{}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/inject/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func Needed(dep *appsv1.Deployment, ns *corev1.Namespace) bool {

// do not inject jaeger due to port collision
// do not inject if deployment's Annotation value is false
if dep.Labels["app"] == "jaeger" {
if dep.Labels["app"] == "jaeger" && dep.Labels["app.kubernetes.io/component"] != "query" {
return false
}

Expand Down
3 changes: 0 additions & 3 deletions pkg/strategy/production.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ func newProductionStrategy(ctx context.Context, jaeger *v1.Jaeger) S {
// prepare the deployments, which may get changed by the elasticsearch routine
cDep := collector.Get()
queryDep := inject.OAuthProxy(jaeger, query.Get())
if jaeger.Spec.Query.TracingEnabled == nil || *jaeger.Spec.Query.TracingEnabled == true {
rubenvp8510 marked this conversation as resolved.
Show resolved Hide resolved
queryDep = inject.Sidecar(jaeger, queryDep)
}
c.dependencies = storage.Dependencies(jaeger)

// assembles the pieces for an elasticsearch self-provisioned deployment via the elasticsearch operator
Expand Down
5 changes: 3 additions & 2 deletions pkg/strategy/production_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ func TestAgentSidecarIsInjectedIntoQueryForStreamingForProduction(t *testing.T)
c := newProductionStrategy(context.Background(), j)
for _, dep := range c.Deployments() {
if strings.HasSuffix(dep.Name, "-query") {
assert.Equal(t, 2, len(dep.Spec.Template.Spec.Containers))
assert.Equal(t, "jaeger-agent", dep.Spec.Template.Spec.Containers[1].Name)
assert.Equal(t, "TestAgentSidecarIsInjectedIntoQueryForStreamingForProduction", dep.Annotations["sidecar.jaegertracing.io/inject"])
assert.Equal(t, 1, len(dep.Spec.Template.Spec.Containers))
assert.Equal(t, "jaeger-query", dep.Spec.Template.Spec.Containers[0].Name)
}
}
}
Expand Down