Skip to content

Commit

Permalink
Issue 630: Updating controller pdb policy (#631)
Browse files Browse the repository at this point in the history
* Issue 630: Updating controller pdb policy

Signed-off-by: anishakj <[email protected]>

* Addressing review comments

Signed-off-by: anishakj <[email protected]>
  • Loading branch information
anishakj authored May 27, 2022
1 parent 4092987 commit 323a35a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions controllers/pravega_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,13 @@ func MakeControllerService(p *api.PravegaCluster) *corev1.Service {
}

func MakeControllerPodDisruptionBudget(p *api.PravegaCluster) *policyv1beta1.PodDisruptionBudget {
minAvailable := intstr.FromInt(int(p.Spec.Pravega.MaxUnavailableControllerReplicas))
var maxUnavailable intstr.IntOrString

if p.Spec.Pravega.ControllerReplicas == int32(1) {
maxUnavailable = intstr.FromInt(0)
} else {
maxUnavailable = intstr.FromInt(int(p.Spec.Pravega.MaxUnavailableControllerReplicas))
}
return &policyv1beta1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
Expand All @@ -414,7 +420,7 @@ func MakeControllerPodDisruptionBudget(p *api.PravegaCluster) *policyv1beta1.Pod
Namespace: p.Namespace,
},
Spec: policyv1beta1.PodDisruptionBudgetSpec{
MinAvailable: &minAvailable,
MaxUnavailable: &maxUnavailable,
Selector: &metav1.LabelSelector{
MatchLabels: p.LabelsForController(),
},
Expand Down

0 comments on commit 323a35a

Please sign in to comment.