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

Restart collector pod when config is updated #215

Merged
merged 4 commits into from
Mar 4, 2021

Conversation

bhiravabhatla
Copy link
Contributor

Signed-off-by: santosh bsantosh@thoughtworks.com

Resolves #197

Change Description
Annotate deployment/daemonset with SHA256 of the config data. Publish an event for configmap, whenever config changes. On the reconcile loop triggered by configmap event - deployment/daemonset would be updated leading to rolling restart of the pod.

@bhiravabhatla bhiravabhatla requested review from a team February 28, 2021 14:05
@bhiravabhatla
Copy link
Contributor Author

@jpkrohling, Kindly share feedback

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Looks great! If you agree with the change to the test package, I'll merge this after you update the PR.

pkg/collector/annotations_test.go Outdated Show resolved Hide resolved
pkg/collector/reconcile/configmap.go Show resolved Hide resolved
@jpkrohling jpkrohling changed the title 197 - Restart collector pod when config is updated Restart collector pod when config is updated Mar 1, 2021
@bhiravabhatla
Copy link
Contributor Author

bhiravabhatla commented Mar 1, 2021

Also, had a question. I still have not yet figured out how sidecar deployment works. I am not sure if this change will support sidecar mode of deployment.

jpkrohling
jpkrohling previously approved these changes Mar 2, 2021
@jpkrohling
Copy link
Member

I still have not yet figured out how sidecar deployment works. I am not sure if this change will support sidecar mode of deployment.

How it works should be documented as part of #214. Once I check that, I'll let you know so that you can verify how this PR would influence that (it shouldn't).

@bhiravabhatla
Copy link
Contributor Author

@jpkrohling - I guess merge was blocked as branch diverged from main. Rebased with main. I guess you would need to approve again

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Sorry, found a small bug in the way precedence of the values. Other than that, looks good.

main.go Outdated
Log: ctrl.Log.WithName("controllers").WithName("OpenTelemetryCollector"),
Scheme: mgr.GetScheme(),
Config: cfg,
Recorder: mgr.GetEventRecorderFor("otel-controller"),
Copy link
Member

Choose a reason for hiding this comment

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

Can we use opentelemetry-operator, or do they recommend using the shortest possible name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. Agreed, we should be consistent - would change it to opentelemetry-operator.


// test
annotations := Annotations(otelcol)
assert.Equal(t, "true", annotations["prometheus.io/scrape"])
Copy link
Member

Choose a reason for hiding this comment

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

Could you also add a test for the case where the annotation exists in the CR? If a user has specified scrape as false, we should honor that. I think the code is currently doing the opposite.

Copy link
Contributor Author

@bhiravabhatla bhiravabhatla Mar 4, 2021

Choose a reason for hiding this comment

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

Yes. My bad, fixing it and adding a test for the same

@jpkrohling jpkrohling enabled auto-merge (squash) March 3, 2021 09:20
Signed-off-by: santosh <bsantosh@thoughtworks.com>
Signed-off-by: santosh <bsantosh@thoughtworks.com>
Signed-off-by: santosh <bsantosh@thoughtworks.com>
Annotations now allow user to override prometheus annotations. Add tests for the same.

Signed-off-by: santosh <bsantosh@thoughtworks.com>
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@jpkrohling jpkrohling merged commit 73db823 into open-telemetry:main Mar 4, 2021
shree007 pushed a commit to shree007/opentelemetry-operator that referenced this pull request Dec 12, 2021
Signed-off-by: santosh <bsantosh@thoughtworks.com>
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
Signed-off-by: santosh <bsantosh@thoughtworks.com>
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.

Pod isn't restarted when configmap is updated
2 participants