Skip to content
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

Ensure podAnnotations are removed from pods if reset in the config #2826

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hughcapet
Copy link
Member

fix use case when an annotation is removed from the podAnnotations setting (should be reflected for the running Pods and Pod templates)

@hughcapet hughcapet force-pushed the fix/pod-annotations-removal branch from 799c015 to 93d718e Compare December 23, 2024 19:17
@hughcapet hughcapet marked this pull request as ready for review December 30, 2024 08:34
@hughcapet hughcapet force-pushed the fix/pod-annotations-removal branch from 93d718e to 2c9ceed Compare January 3, 2025 16:35
@idanovinda
Copy link
Member

👍

}
}
annotationToRemove = strings.TrimSuffix(annotationToRemove, ",") + `}}}`
annotationToRemoveTemplate = strings.TrimSuffix(annotationToRemoveTemplate, ",") + `}}}}}`
Copy link
Member

Choose a reason for hiding this comment

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

can we not use json marshalling here? This concatenating {{{ + }}} looks a bit "ugly".

@@ -1060,7 +1097,6 @@ func (c *Cluster) syncConnectionPoolerWorker(oldSpec, newSpec *acidv1.Postgresql
if err != nil {
return syncReason, err
}
c.ConnectionPooler[role].Deployment = deployment
Copy link
Member

Choose a reason for hiding this comment

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

so we change to update internal deployment only if every sync step works, right? Have to think about consequences it might have

listOptions := metav1.ListOptions{
LabelSelector: labels.Set(c.connectionPoolerLabels(role, true).MatchLabels).String(),
}
pods, err = c.listPoolerPods(listOptions)
Copy link
Member

Choose a reason for hiding this comment

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

ToDo for me: Check if we can go with a version of pods we now fetch before changing annotations? Or do we need to fetch them again for the following steps?

return err
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, another thinking out loud comment: We already introduced patch code for annotations. Could it not be reused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants