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

Mount volumes from agent spec #1102

Merged
merged 3 commits into from
Jul 3, 2020

Conversation

Saad-Hussain1
Copy link
Contributor

@Saad-Hussain1 Saad-Hussain1 commented Jun 25, 2020

Context: #1097

This PR uses any volumes or volumeMounts under the agent node in a Jaeger instance when creating an agent as a sidecar. This still doesn't use the common spec for volumes/mounts, as it seems, "We don't want to mount all Jaeger internal volumes into user's deployments".

However, if someone were to specify a volume/mount under the agent node in the Jaeger instance, they would be mounted to the sidecar, since this would be very intentional.

This seems necessary if one needs to supply files to the agent (e.g. for TLS between the agent and collector with the arg --reporter.grpc.tls.ca).

@codecov
Copy link

codecov bot commented Jun 25, 2020

Codecov Report

Merging #1102 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1102   +/-   ##
=======================================
  Coverage   88.00%   88.00%           
=======================================
  Files          86       86           
  Lines        5254     5254           
=======================================
  Hits         4624     4624           
  Misses        466      466           
  Partials      164      164           
Impacted Files Coverage Δ
pkg/inject/sidecar.go 94.17% <100.00%> (ø)

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 fba067f...639f2bc. Read the comment docs.

… for sidecar

Signed-off-by: Saad Hussain <Saad.Hussain@ibm.com>
Signed-off-by: Saad Hussain <Saad.Hussain@ibm.com>
@jpkrohling jpkrohling self-requested a review June 29, 2020 09:00
// We don't want to mount all Jaeger internal volumes into user's deployments
volumesAndMountsSpec := &v1.JaegerCommonSpec{}
volumesAndMountsSpec := &jaeger.Spec.Agent.JaegerCommonSpec
otelConf, err := jaeger.Spec.Agent.Config.GetMap()
Copy link
Contributor

Choose a reason for hiding this comment

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

This would require users to always specify the volume under the agent node in order to be consumed here, right? Meaning, if I specified a volume and mount with the TLS at the root of the CR, it will be applied to every component except to the deployments where the sidecar has been injected.

I like this approach, perhaps @objectiser and/or @pavolloffay would also want to give their opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, only the volumes under spec.agent would be added to the deployment, not those under just spec.

This was done to satisfy the comment in the code:
// We don't want to mount all Jaeger internal volumes into user's deployments

So all the common spec volumes aren't added to the deployment still, but if someone specifically does want a volume & volumeMount added to the sidecar's deployment & sidecar container respectively, they can specify it under the agent node.

@@ -158,6 +158,36 @@ func TestInjectSidecarWithEnvVarsOverridePropagation(t *testing.T) {
assert.Contains(t, dep.Spec.Template.Spec.Containers[0].Env, corev1.EnvVar{Name: envVarServiceName, Value: "testapp.default"})
}

func TestInjectSidecarWithVolumeMounts(t *testing.T) {
// prepare
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add an explicit test for the condition I mentioned in the previous comment? Add a volume/mount at the root of the spec and make sure that it does not get mounted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

…s deployment

Signed-off-by: Saad Hussain <Saad.Hussain@ibm.com>
@jpkrohling
Copy link
Contributor

LGTM. If you think this is ready to be merged, change this from a Draft PR to a regular PR :)

@Saad-Hussain1 Saad-Hussain1 marked this pull request as ready for review July 2, 2020 21:59
@Saad-Hussain1
Copy link
Contributor Author

@jpkrohling Changed to regular PR

@jpkrohling jpkrohling merged commit c6afb94 into jaegertracing:master Jul 3, 2020
@jpkrohling
Copy link
Contributor

Thank you for your contribution, @Saad-Hussain1!

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.

2 participants