Skip to content

Conversation

@otrosien
Copy link
Member

@otrosien otrosien commented Jun 20, 2025

One-line summary

Implements pod labeling optimization for Kubernetes Elasticsearch operator to avoid querying all pods.

Issues

Key Changes:

  • Added migration logic in setupInformers() to ensure all existing EDS pods have the es-operator-dataset label
  • Modified collectResources() to use label selectors when fetching pods for each EDS
  • Updated templateInjectLabels() to always set labels (removed conditional check)
  • Added comprehensive logging and annotation-based migration tracking
  • Created E2E test to verify pod label migration functionality
  • Introduced new annotation es-operator.zalando.org/pod-label-migration-complete to track migration status

Impact:

  • Core change to pod discovery mechanism that could affect all EDS resources
  • Migration runs on every operator startup (with annotation-based skip logic)
  • Performance improvement expected from targeted pod queries vs. listing all pods

Types of Changes

  • New feature (non-breaking change which adds functionality)

Review

List of tasks the reviewer must do to review the PR

  • Tests
  • Documentation
  • CHANGELOG

Deployment Notes

  • Document migration steps

@zalando-compr-opensource
Copy link

invalid team ID

The team ID in your .zappr.yaml file does not appear to be valid. Please, fix
this before team ID checks will be added back into ComPR's specification check.

You can follow this guideline for help.

@otrosien otrosien added the major Major feature changes or updates, e.g. feature rollout to a new country, new API calls. label Nov 2, 2025
Signed-off-by: Oliver Trosien <[email protected]>
In `isPodOwnedByEDS()`, a new `context.Background()` is created instead of using the passed context. This bypasses cancellation propagation and could lead to hanging operations if the operator is shutting down during migration. Use the parent context throughout the call chain.

Signed-off-by: Oliver Trosien <[email protected]>
Signed-off-by: Oliver Trosien <[email protected]>
Signed-off-by: Oliver Trosien <[email protected]>
Signed-off-by: Oliver Trosien <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Major feature changes or updates, e.g. feature rollout to a new country, new API calls.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add and use pod labels to avoid having to query all pods from kubernetes

2 participants