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

Inject sidecar in properly annotated pods #58

Merged
merged 2 commits into from
Oct 12, 2018

Conversation

jpkrohling
Copy link
Contributor

This PR adds support for auto-injection of Jaeger agents into target Deployment objects. Technically, this can be done for all objects containing Pod objects, like StatefulSet or DaemonSet, but this PR limits the first implementation to Deployment, to get it tested first. If there's demand, it's relatively easy to add support for other constructs.

Signed-off-by: Juraci Paixão Kröhling [email protected]

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
@jpkrohling
Copy link
Contributor Author

This change is Reviewable

@codecov
Copy link

codecov bot commented Oct 11, 2018

Codecov Report

Merging #58 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   99.26%   99.29%   +0.02%     
==========================================
  Files          16       17       +1     
  Lines         684      706      +22     
==========================================
+ Hits          679      701      +22     
  Misses          5        5
Impacted Files Coverage Δ
pkg/deployment/query.go 100% <100%> (ø) ⬆️
pkg/controller/production.go 100% <100%> (ø) ⬆️
pkg/inject/sidecar.go 100% <100%> (ø)
pkg/deployment/agent.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d5f8144...2dbd8b6. Read the comment docs.

@pavolloffay
Copy link
Member

Does it auto inject to all deployments in cluster or in namespace?

Copy link
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 15 files reviewed, 1 unresolved discussion (waiting on @jpkrohling, @objectiser, and @pavolloffay)


README.adoc, line 172 at r1 (raw file):

== Auto injection of Jaeger Agent sidecars

The operator can also inject Jaeger Agent sidecars in `Deployment` workloads, provided that the deployment has the annotation `inject-jaeger-agent` with a suitable value. The values can be either `"true"` (as string), or the Jaeger instance name, as returned by `kubectl get jaegers`. When `"true"` is used, there should be exactly *one* Jaeger instance for the same namespace as the deployment, otherwise, the operator can't figure out automatically which Jaeger instance to use.

I think the Jaeger instance name needs to support namespace scoping - it is very likely that the jaeger instance will be deployed into a different namespace - e.g. in the case of istio, where Jaeger is deployed to the istio-system namespace. This makes me wonder whether the "true" option should be supported? unless it is possible for the operator running in one namespace to process deployments in another, and point their agent to the namespace hosting the Jaeger instance?

README.adoc Show resolved Hide resolved
pkg/deployment/query.go Show resolved Hide resolved
pkg/inject/sidecar.go Show resolved Hide resolved
pkg/inject/sidecar.go Show resolved Hide resolved
pkg/inject/sidecar.go Outdated Show resolved Hide resolved
pkg/inject/sidecar.go Outdated Show resolved Hide resolved
pkg/inject/sidecar.go Show resolved Hide resolved
// this has two reasons:
// 1) as it is, it would cause a circular dependency, so, we'd have to extract that constant to somewhere else
// 2) this specific string is part of the "public API" of the operator: we should not change
// it at will. So, we leave this configured just like any other application would
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always prefer using a constant. Even we don't change it it's easier from the maintenance point of view.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A local constant, instead of the same constant as the one used in the inject package? Could be, in that case, I'll consider it for #59.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean a single constant unique for the project if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then no, I'll keep it as string following the reasoning on the comment

@pavolloffay
Copy link
Member

btw. I find that "=true" option useful for simple deployments. Or we can default to the default name used by the operator.

@jpkrohling
Copy link
Contributor Author

I think the Jaeger instance name needs to support namespace scoping - it is very likely that the jaeger instance will be deployed into a different namespace

I actually thought about it when implementing, but I got some practical questions that I didn't want to figure out right now. I recorded #60 with the questions and I'd add support for inter-namespace injection in a follow up PR (as this here is already complex enough, IMO).

Copy link
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 14 of 15 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @pavolloffay and @jpkrohling)

@jpkrohling jpkrohling merged commit fb56b31 into jaegertracing:master Oct 12, 2018
@cfontes
Copy link
Contributor

cfontes commented Oct 15, 2018

Just pointing out that I would like to have it in Statefulsets!

@jpkrohling
Copy link
Contributor Author

@cfontes that's great to hear! Could you please open an issue with the request? Bonus points if you could describe your use case.

andream16 pushed a commit to andream16/jaeger-operator that referenced this pull request Oct 17, 2018
* Inject sidecar in properly annotated pods

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants