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
Keep multiple versions of Collector Config #2946
base: main
Are you sure you want to change the base?
Keep multiple versions of Collector Config #2946
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good to me, and is pleasantly much simpler than I expected. Left some comments mostly around the CRD field.
@@ -86,6 +87,10 @@ service: | |||
goodConfig := v1beta1.Config{} | |||
err := go_yaml.Unmarshal([]byte(goodConfigYaml), &goodConfig) | |||
require.NoError(t, err) | |||
|
|||
goodConfigHash, _ := manifestutils.GetConfigMapSHA(goodConfig) | |||
goodConfigHash = goodConfigHash[:8] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. These tests were always a pain to update because of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few minor thoughts, otherwise this looks awesome!
62af5bf
to
5787dd6
Compare
@swiatekm-sumo @pavolloffay any other thoughts on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Description:
From the issue:
This PR resolves the issue by keeping 1 or more previous versions of the Collector ConfigMap. The ConfigMap name is suffixed with an 8-character hash of the Config object. The full hash is truncated to 8 characters to leave room in the 63-character name limit for the collector name.
The number of config versions to keep can be specified using the new ConfigVersions field on the CRD. The operator will keep the current version +
ConfigVersions
previous versions. Cleanup of old versions is handled using the reconciliation code path.This solution was preferred to support for externally managed ConfigMaps based on conversations at the SIG meeting. External ConfigMaps would break some functionality of the operator which requires the collector config to be known by the operator.
Link to tracking Issue(s):
Testing:
local manual testing, unit tests, e2e tests
Documentation:
New configuration value on OpenTelemetryCollector CRD for setting the number of versions to keep.