Skip to content

Conversation

@kommendorkapten
Copy link
Member

This PR improves the pod lifecycle management.

The main improvement is that we tie in the deployment metadata into the pod processing to avoid sending create/delete events when a pod's replica set is changed. This is done by correlating the deployment status' with the pod events.

@kommendorkapten kommendorkapten requested a review from a team as a code owner January 29, 2026 15:32
Copilot AI review requested due to automatic review settings January 29, 2026 15:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances pod lifecycle management by preventing redundant deployment events during replica set changes. The implementation correlates deployment metadata with pod events to avoid sending create/delete notifications when pods are simply being scaled rather than truly deployed or decommissioned.

Changes:

  • Added deployment existence checks to differentiate between pod deletions from scaling vs. actual deployment removal
  • Implemented a best-effort cache to prevent duplicate deployment notifications
  • Updated RBAC permissions to allow querying deployment resources

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
internal/controller/controller.go Adds deployment existence validation, caching mechanism, and enhanced pod event filtering to distinguish scaling from deployment lifecycle events
deploy/manifest.yaml Extends RBAC permissions to enable deployment resource queries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Check if the parent deployment still exists
// If it does, this is just a scale-down event, skip it
deploymentName := getDeploymentName(pod)
if deploymentName != "" && c.deploymentExists(ctx, pod.Namespace, deploymentName) {
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

Making an API call to check deployment existence for every pod deletion could be expensive at scale. Consider using a deployment informer with a local cache instead of direct API calls, especially since the controller already uses informers for pods.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is a good idea. I will do this as a follow up PR.

@github github deleted a comment from piceri Feb 2, 2026
@github github deleted a comment from malancas Feb 2, 2026
@github github deleted a comment from philpalmieri Feb 2, 2026
@github github deleted a comment from malancas Feb 2, 2026
@github github deleted a comment from kommendorkapten Feb 2, 2026
@kommendorkapten kommendorkapten merged commit 38cdb32 into main Feb 2, 2026
7 checks passed
@kommendorkapten kommendorkapten deleted the delete-event branch February 2, 2026 14:23
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.

1 participant