Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions operator/internal/manifests/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func configureDistributorGRPCServicePKI(deployment *appsv1.Deployment, opts Opti
// Distributor pods.
func newDistributorPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget {
l := ComponentLabels(LabelDistributorComponent, opts.Name)
mu := intstr.FromInt(1)
maxUnavailable := intstr.FromInt32(1)
return &policyv1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
Expand All @@ -251,7 +251,7 @@ func newDistributorPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudg
Selector: &metav1.LabelSelector{
MatchLabels: l,
},
MinAvailable: &mu,
MaxUnavailable: &maxUnavailable,
},
}
}
14 changes: 2 additions & 12 deletions operator/internal/manifests/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,7 @@ func configureIngesterGRPCServicePKI(sts *appsv1.StatefulSet, opts Options) erro
// Ingester pods.
func newIngesterPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget {
l := ComponentLabels(LabelIngesterComponent, opts.Name)
rf := DefaultLokiStackSpec(opts.Stack.Size).Replication.Factor
if opts.Stack.Replication != nil && opts.Stack.Replication.Factor != 0 {
rf = opts.Stack.Replication.Factor
}

pdbMinAvailable := rf
if pdbMinAvailable >= opts.Stack.Template.Ingester.Replicas {
pdbMinAvailable = max(1, opts.Stack.Template.Ingester.Replicas-1)
}
minAvailable := intstr.FromInt32(pdbMinAvailable)

maxUnavailable := intstr.FromInt32(1)
return &policyv1.PodDisruptionBudget{
TypeMeta: metav1.TypeMeta{
Kind: "PodDisruptionBudget",
Expand All @@ -315,7 +305,7 @@ func newIngesterPodDisruptionBudget(opts Options) *policyv1.PodDisruptionBudget
Selector: &metav1.LabelSelector{
MatchLabels: l,
},
MinAvailable: &minAvailable,
MaxUnavailable: &maxUnavailable,
},
}
}