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

Fix kafka broker pod label selector used when reconciling broker pod deletion #793

Merged
merged 1 commit into from
Apr 14, 2022

Conversation

stoader
Copy link
Member

@stoader stoader commented Apr 13, 2022

Q A
Bug fix? yes
New feature? no
API breaks? no
Deprecations? no
Related tickets fixes #792
License Apache 2.0

What's in this PR?

Remove the client.HasLabels from the used label selector to find kafka broker pods that belong to cluster during broker pod deletion reconciliation.
The client.MatchingLabels(kafka.LabelsForKafka(r.KafkaCluster.Name)) label selector is enough to match broker pods that belong to a cluster in a given namespace.

Why?

controller-runtime doesn't support multiple label selector option to be specified for selecting pods. When multiple label selector option is used it doesn't return an error but rather silently uses only the last label selector option from the list. This resulted to select pods in the given namespace that have brokerId label regardless what Kafka cluster the pods belong to as the first option client.MatchingLabels(kafka.LabelsForKafka(r.KafkaCluster.Name)) was ignored.

Checklist

  • Implementation tested
  • Error handling code meets the guideline
  • Logging code meets the guideline

@stoader stoader requested a review from a team as a code owner April 13, 2022 17:32
Copy link
Contributor

@bartam1 bartam1 left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@panyuenlau panyuenlau left a comment

Choose a reason for hiding this comment

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

thanks for catching && fixing this

@stoader stoader merged commit 406d3bc into master Apr 14, 2022
@stoader stoader deleted the fix_792 branch April 14, 2022 05:26
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.

Downscale impacts other cluster's brokers
3 participants