Skip to content

Commit ad2bcb3

Browse files
committed
Refactor Otel Collector Googlecloud ConfigMap Generation to Use Go Struct and YAML Marshaling
Refactor the generation of the otel-collector Googlecloud ConfigMap to construct the configuration using a Go map and marshal it to YAML, replacing the previous approach of using a static YAML string. This change improves maintainability and reduces the risk of formatting errors in the generated config. Add GooglecloudCollectorConfigYAML() in pkg/metrics/otel.go to build the config as a Go map and marshal it to YAML. Update OtelReconciler in pkg/reconcilermanager/controllers/otel_controller.go to use the new function when creating/updating the ConfigMap. Update related tests to use the new function for expected config values. Deprecate the old CollectorConfigGooglecloud string constant. This refactor makes the config generation more robust and easier to extend or validate in the future.
1 parent 4aa3bcc commit ad2bcb3

File tree

3 files changed

+221
-324
lines changed

3 files changed

+221
-324
lines changed

0 commit comments

Comments
 (0)