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

Issue 630: Updating controller pdb policy #631

Merged
merged 2 commits into from
May 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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