opentelemetry-operator icon indicating copy to clipboard operation
opentelemetry-operator copied to clipboard

Updating spec mutation logic of daemonset, statefulset, and deployment with mergeWithOverwriteWithEmptyValue

Open davidhaja opened this issue 4 months ago • 0 comments

Description: <Describe what has changed.> Previously the opentelemetry operator couldn't remove fields from the spec of deployments, statefulsets, and daemonsets because of the mergeWithOverride merging strategy. (except the nodeselector field due to #2941). After this PR, the operator will use the mergeWithOverwriteWithEmptyValue merging logic on the spec of the resources, which will allow to remove fields if they are also removed from the opentelemetrycollector CR.

Link to tracking Issue(s): #2947

  • Resolves: #2947

Testing: <Describe what testing was performed and which tests were added.>

  • e2e tests
    • additionalContainers (covering mutation of []Object field in spec)
    • affinity (covering mutation of Object field in spec)
    • args (covering mutation of map[string]string field in spec)
    • label change
    • annotation change
  • unit tests
    • additionalContainers
    • affinity
    • args
    • label change
    • annotation change
    • immutable label changed
    • immutable selector changed Documentation: <Describe the documentation added.> N/A

Limitation: The daemonset.metadata.annotations, statefulset.metadata.annotations, deployment.metadata.annotations is still being mutated with mergeWithOverride, therefore the operator cannot remove annotations from there. This isn't the case with daemonset.spec.template.metadata.annotations, statefulset.spec.template.metadata.annotations, deployment.spec.template.metadata.annotations since they are in the spec of the resources.

davidhaja avatar Oct 04 '24 09:10 davidhaja