Skip to content

Commit

Permalink
Revert "Update Kafka PDB to use live Pods instead of the CR Spec"
Browse files Browse the repository at this point in the history
This reverts commit 2d3c087.
  • Loading branch information
alungu committed Mar 18, 2022
1 parent 2d3c087 commit 9488639
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions pkg/resources/kafka/poddisruptionbudget.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@
package kafka

import (
"context"
"fmt"
"math"
"strconv"
"strings"

"emperror.dev/errors"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/banzaicloud/koperator/pkg/resources/templates"
"github.com/banzaicloud/koperator/pkg/util"
"github.com/banzaicloud/koperator/pkg/util/kafka"
Expand Down Expand Up @@ -78,16 +73,8 @@ func (r *Reconciler) computeMinAvailable(log logr.Logger) (intstr.IntOrString, e
Max(1, brokers-brokers*percentage) - for a percentage budget
*/

podList := &corev1.PodList{}
matchingLabels := client.MatchingLabels(kafka.LabelsForKafka(r.KafkaCluster.Name))
err := r.Client.List(context.TODO(), podList, client.ListOption(client.InNamespace(r.KafkaCluster.Namespace)), client.ListOption(matchingLabels))
if err != nil {
return intstr.FromInt(-1), errors.WrapIf(err, "failed to reconcile resource")
}

// number of brokers in the KafkaCluster
brokers := len(podList.Items)
brokers := len(r.KafkaCluster.Spec.Brokers)

// configured budget in the KafkaCluster
disruptionBudget := r.KafkaCluster.Spec.DisruptionBudget.Budget
Expand Down

0 comments on commit 9488639

Please sign in to comment.