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

Trigger deployments reconciliation when jaeger instance is created #1334

Merged
merged 3 commits into from
Dec 9, 2020

Conversation

rubenvp8510
Copy link
Collaborator

@rubenvp8510 rubenvp8510 commented Dec 9, 2020

Signed-off-by: Ruben Vargas Palma ruben.vp8510@gmail.com

Fixes #1315

Signed-off-by: Ruben Vargas Palma <ruben.vp8510@gmail.com>
@rubenvp8510 rubenvp8510 changed the title Trigger deployment reconciliation when jaeger instance is created Trigger deployments reconciliation when jaeger instance is created Dec 9, 2020
@codecov
Copy link

codecov bot commented Dec 9, 2020

Codecov Report

Merging #1334 (db0cdad) into master (3160523) will decrease coverage by 1.38%.
The diff coverage is 68.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1334      +/-   ##
==========================================
- Coverage   87.41%   86.02%   -1.39%     
==========================================
  Files          89       90       +1     
  Lines        5021     5125     +104     
==========================================
+ Hits         4389     4409      +20     
- Misses        467      548      +81     
- Partials      165      168       +3     
Impacted Files Coverage Δ
pkg/controller/deployment/deployment_controller.go 19.04% <68.96%> (ø)
pkg/apis/jaegertracing/v1/logger.go 0.00% <0.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 3160523...db0cdad. Read the comment docs.

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
@rubenvp8510 rubenvp8510 marked this pull request as ready for review December 9, 2020 14:16
@rubenvp8510
Copy link
Collaborator Author

@jpkrohling @objectiser The changes looks really good.

Regarding of codecov errors, it seems those are due uncovered lines when the client returns errors and one with assert error. I think those are hard to cover/test.

Is this good enough to be merged as it is?

ObjectMeta: metav1.ObjectMeta{
Name: "dep-with-another-jaegers-label",
Namespace: "ns-without-annotation",
Labels: map[string]string{
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the inject annotation be included here, as in the deployment below - but as it is using a different Jaeger in the label it wouldn't be returned?

Copy link
Collaborator Author

@rubenvp8510 rubenvp8510 Dec 9, 2020

Choose a reason for hiding this comment

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

Well, may be yes to be consistent with the expected states of a deployment, as I cannot imagine an scenario where we have the label and not the annotation.

On the other side, for what I think this is testing, it doesn't matter.

https://github.com/jaegertracing/jaeger-operator/pull/1334/files#diff-c553184997fa4c9f63e697af2f39eb2e6fb43eeff64a0ef66c9e955f61347b02R205

Whether this has or not an annotation, the first thing the syncOnJaegerChanges checks, is for the label, so it doesn't matter if we don't have an annotation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, it was more to reflect a realistic deployment to avoid any failures later if the logic was to change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In that case. Yes , it should be added :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Should the inject annotation be included here, as in the deployment below - but as it is using a different Jaeger in the label it wouldn't be returned?

I left only the Label here as that's the only thing the code for this case will use. If we think we need to check both the annotation and the label, then both the test and the code need to be changed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think we need to check both, Is more that the case should reflect a real deployment.

I understand that this test is not using the annotation, for this particular case it only check for the label. But if in the future we change this logic it could help to have the deployment as close as real as possible.

}

deployments := appsv1.DeploymentList{}
err := r.client.List(context.Background(), &deployments)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Question

In the case of the operator watching one or a couple of namespaces (no cluster wide) Should we limit this to those namespaces?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we have a way to restrict the namespaces being observed for injection? the WATCH_NAMESPACE part is which namespaces to check for CRs, not deployments.
@jpkrohling is that also your understanding?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I thought WATCH_NAMESPACE restricts injection too. My bad.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd expect the client.List to return the deployments for all namespaces where the jaeger-agent service account has access to. Perhaps QE could confirm that.

@jpkrohling
Copy link
Contributor

Regarding of codecov errors, it seems those are due uncovered lines when the client returns errors and one with assert error

I think it's actually because there's a new test, which covers only one function, the new one. When there was 0% coverage, this package wasn't being counted at all.

Is this good enough to be merged as it is?

Was it confirmed already that this is indeed the fix for the original problem?

@objectiser
Copy link
Contributor

@jpkrohling It fixes one of the problems - and I believe the other PR (removing the persisted volume/mounts from the CR) addresses the other issue described, although we haven't been able to reproduce that.

Signed-off-by: Ruben Vargas Palma <ruben.vp8510@gmail.com>
@objectiser objectiser merged commit e48622a into jaegertracing:master Dec 9, 2020
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.

Existing apps with sidecar agent inject annotation not injected when first appropriate jaeger instance created
3 participants