Skip to content

Conversation

yuriolisa
Copy link
Contributor

Description:

Fixing a issue during the reconcile process for Labels and Annotations.
Link to tracking Issue(s):

Testing:

Documentation:

@yuriolisa yuriolisa requested a review from a team as a code owner August 5, 2025 14:29
Comment on lines -377 to -384
if err := mergeWithOverride(&existing.Labels, desired.Labels); err != nil {
return err
}

if err := mergeWithOverride(&existing.Annotations, desired.Annotations); err != nil {
return err
}

Copy link
Contributor

Choose a reason for hiding this comment

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

@yuriolisa there was a reason we did this that i'm trying to remember... AH! it was because if the user has an external controller like argocd, OPA, istio which adds labels/annotations we could inadvertently override them causing an infinite cycle. I think it's something in this pr where we talked about this. @davidhaja may remember better...

Copy link
Contributor Author

@yuriolisa yuriolisa Aug 5, 2025

Choose a reason for hiding this comment

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

@jaronoff97 , thank you for the heads-up. I'm just wondering why the PR says that would be changing to mergeWithOverwriteWithEmptyValue, but it remains mergeWithOverride. And also, how should we handle this situation because on one hand, we solve an issue related to the external controller, but if a user wants to set some annotations/labels, it won't be a good experience.

Copy link
Contributor

Choose a reason for hiding this comment

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

so they can set annotations and labels fine, the issue is the removal. I'm not sure there's a good way to balance this... going to think on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One idea would be creating a new field to set which labels and annotations prefixes should be preserved.

preservedAnnotationPrefixes:
  - argocd.argoproj.io
  - istio.io

Copy link
Contributor

github-actions bot commented Aug 5, 2025

E2E Test Results

 33 files  ±0  221 suites  ±0   4h 6m 38s ⏱️ + 16m 49s
 85 tests ±0   83 ✅  - 2  0 💤 ±0  2 ❌ +2 
225 runs  ±0  222 ✅  - 3  0 💤 ±0  3 ❌ +3 

For more details on these failures, see this check.

Results for commit 9f6815f. ± Comparison against base commit 5fd4c4b.

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.

spec.podAnnotations entries can not be deleted in reconcile
2 participants