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

Add image pull secrets to Jaeger resources #1103

Closed

Conversation

Saad-Hussain1
Copy link
Contributor

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

Context: #1018

Adds support for k8s imagePullSecrets to Jaeger resources.

Associated PR to update documentation: jaegertracing/documentation#416

Saad Hussain added 2 commits June 25, 2020 16:03
@Saad-Hussain1 Saad-Hussain1 marked this pull request as draft June 25, 2020 20:13
@Saad-Hussain1 Saad-Hussain1 force-pushed the add-imagePullSecrets branch from 526ca5d to a425353 Compare June 26, 2020 02:13
Signed-off-by: Saad Hussain <[email protected]>
@Saad-Hussain1 Saad-Hussain1 force-pushed the add-imagePullSecrets branch from a9db5be to cbe0254 Compare June 26, 2020 12:23
@codecov
Copy link

codecov bot commented Jun 26, 2020

Codecov Report

Merging #1103 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1103      +/-   ##
==========================================
+ Coverage   88.05%   88.10%   +0.05%     
==========================================
  Files          86       86              
  Lines        5274     5297      +23     
==========================================
+ Hits         4644     4667      +23     
  Misses        466      466              
  Partials      164      164              
Impacted Files Coverage Δ
pkg/apis/jaegertracing/v1/jaeger_types.go 100.00% <ø> (ø)
pkg/cronjob/es_index_cleaner.go 100.00% <100.00%> (ø)
pkg/cronjob/es_rollover.go 95.93% <100.00%> (+0.03%) ⬆️
pkg/cronjob/spark_dependencies.go 92.38% <100.00%> (+0.07%) ⬆️
pkg/deployment/agent.go 96.24% <100.00%> (+0.02%) ⬆️
pkg/deployment/all_in_one.go 100.00% <100.00%> (ø)
pkg/deployment/collector.go 96.81% <100.00%> (+0.02%) ⬆️
pkg/deployment/ingester.go 96.29% <100.00%> (+0.02%) ⬆️
pkg/deployment/query.go 100.00% <100.00%> (ø)
pkg/inject/sidecar.go 94.41% <100.00%> (+0.02%) ⬆️
... and 3 more

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 9cde42a...36bd00c. Read the comment docs.

@jpkrohling jpkrohling self-requested a review June 29, 2020 08:28
@@ -211,6 +211,7 @@ func container(jaeger *v1.Jaeger, dep *appsv1.Deployment) corev1.Container {
// see https://github.com/jaegertracing/jaeger-operator/issues/334
sort.Strings(args)

dep.Spec.Template.Spec.ImagePullSecrets = util.RemoveDuplicatedImagePullSecrets(append(dep.Spec.Template.Spec.ImagePullSecrets, commonSpec.ImagePullSecrets...))
Copy link
Contributor

Choose a reason for hiding this comment

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

We really should document this, as we are changing a deployment that isn't being managed by us.

Copy link
Contributor Author

@Saad-Hussain1 Saad-Hussain1 Jun 29, 2020

Choose a reason for hiding this comment

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

Hm now that you mention that, I wonder if we should change
dep.Spec.Template.Spec.ImagePullSecrets = util.RemoveDuplicatedImagePullSecrets(append(dep.Spec.Template.Spec.ImagePullSecrets, commonSpec.ImagePullSecrets...))
to
dep.Spec.Template.Spec.ImagePullSecrets = util.RemoveDuplicatedImagePullSecrets(append(dep.Spec.Template.Spec.ImagePullSecrets, jaeger.Spec.Agent.JaegerCommonSpec.ImagePullSecrets...))

i.e., don't use the imagePullSecrets from the commonSpec, but rather only the ones under the agent spec, so that we don't add all the imagePullSecrets for the rest of the jaeger components to a deployment which isn't managed by the jaeger-operator. We would only add an imagePullSecret to the deployment if someone specifically adds it to the agent spec, which would then be more justified since it would seem to be a more intentional decision.


If we do make that ^ change, do you think we should still document this?
If we should still document, do you mean adding a comment, adding a log message, or updating documentation?

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be a user documentation, probably under the sidecar part: https://www.jaegertracing.io/docs/1.18/operator/#auto-injecting-jaeger-agent-sidecars

@jpkrohling
Copy link
Contributor

Looks good to me! The only missing bits seems to be around the auto-provisioned ES and Kafka. Do you know whether their CRs also support customizing the image pull secret?

@Saad-Hussain1
Copy link
Contributor Author

Saad-Hussain1 commented Jun 30, 2020

@jpkrohling ahmm I'm not too sure actually... I'm admittedly not too familiar with them since I've only really used the agent, collector, and query.

@jpkrohling
Copy link
Contributor

@Saad-Hussain1 would you be able to check that? This PR looks good to me, but it would be good to know in advance if we need to extend this feature to include ES/Kafka, or if this feature is complete.

One more thing I'd like to ask: could you please open an issue to document this new field?

@Saad-Hussain1
Copy link
Contributor Author

@jpkrohling Alright I'll try to look into it.

Is something missing from this issue: #1018?
If I do need to open another issue, what would I need to include in it which that one ^ lacks?

@jpkrohling
Copy link
Contributor

If I do need to open another issue, what would I need to include in it which that one ^ lacks?

Sorry, I meant an issue on https://github.com/jaegertracing/documentation, so that we don't forget to let users know about this behavior.

@jpkrohling
Copy link
Contributor

jpkrohling commented Jul 3, 2020

I just realized that we might not need this after all... Given that we already support overriding the service account, and service accounts might contain image pull secrets, one could achieve the goal of this PR by just setting the appropriate service account to the component/spec. Like:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-sa
imagePullSecrets:
- name: my-pull-secret
apiVersion: jaegertracing.io/v1
kind: "Jaeger"
metadata:
  name: "my-jaeger"
spec:
  serviceAccount: my-sa

Or am I missing something?

@Saad-Hussain1 Saad-Hussain1 force-pushed the add-imagePullSecrets branch from bd3597d to 98a61b4 Compare July 3, 2020 20:31
@Saad-Hussain1
Copy link
Contributor Author

Saad-Hussain1 commented Jul 3, 2020

@jpkrohling :O I actually did not know about that, but it does seem that that works! The original response to the git issue also made me think that this wasn't supported in any way, but I didn't know that imagePullSecrets could be added to serviceAccounts. I guess majority of this PR is actually unnecessary then.

The only issue I have remaining is with the agent sidecar. It doesn't seem like serviceAccounts are supported for it, probably because the original deployment might already be using its own serviceAccount? Perhaps I can make a new PR to add imagePullSecrets to the sidecar's Deployment? Like this: #1115

@jpkrohling
Copy link
Contributor

I'm closing this PR in favor of #1115. Hope you did have fun while working on this, though!

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