Skip to content

Commit

Permalink
fix PDB maxUnavailable equal to 0 when executing backup jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
yoheinbb committed Nov 30, 2023
1 parent 9798c7f commit 4479fcc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/mysqlcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ func (r *MySQLClusterReconciler) reconcileV1PDB(ctx context.Context, req ctrl.Re

var maxUnavailable intstr.IntOrString
if backupCronJobIsRnning {
maxUnavailable = intstr.FromInt(int(cluster.Spec.Replicas))
maxUnavailable = intstr.FromInt(0)
} else {
maxUnavailable = intstr.FromInt(int(cluster.Spec.Replicas / 2))
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/mysqlcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ var _ = Describe("MySQLCluster reconciler", func() {
if err != nil {
return err
}
if pdb.Spec.MaxUnavailable.IntVal != cluster.Spec.Replicas {
if pdb.Spec.MaxUnavailable.IntVal != 0 {
return fmt.Errorf("PodDisruptionBudget MaxUnavailable is no equal Replica Count.")
}
return nil
Expand Down

0 comments on commit 4479fcc

Please sign in to comment.