argoproj-labs / argo-rollouts-manager

Kubernetes Operator for Argo Rollouts controller.
https://argo-rollouts-manager.readthedocs.io/en/latest/
Apache License 2.0
84 stars 255 forks source link

Updating '.spec.additionalMetadata' field does not cause labels/annotations to be applied to existing resources #63

Open jgwest opened 3 weeks ago

jgwest commented 3 weeks ago

The .spec.additionalMetadata field of RolloutManager CR can be used to set labels/annotations on the resources that are created by the Argo Rollouts operator.

However, at present, when you change the labels/annotations in that field, OR if you add labels/annotations (in that field) on a RolloutManager that already exists, the appropriate labels/annotations will NOT be correctly set on the rollout resources.

This appears to be because in the reconcile* functions in resources.go, we are first calling setAdditionalRolloutsLabelsAndAnnotationsToObject(obj, cr), then immediately calling fetchObject(...), which causes those set labels/annotations to be discarded (in the case where the resource already exists).

This means the labels will only be applied in the resource creation case, not the update case. This might be intended behaviour, but IMHO it makes sense to always keep labels/annotations in sync with resources.

For an example of this, see reconcileRolloutsClusterRole.

Fix criteria: