feat: add optional PodDisruptionBudget for vector aggregators - #229
Conversation
|
Hi, and thanks for the contribution! The HPA autoscaling work (#230) just merged, so this PR now conflicts with main and needs a rebase. Most of it is mechanical (shared RBAC and the aggregator controller wiring). One real change beyond the textual conflicts: spec.replicas is now a *int32 (it was int32), so the replicas <= 1 check in pdb.go needs a small update for the pointer. One more thing worth handling: when autoscaling is on, the replica count is set by the HPA, not by spec.replicas, so that same check can skip the PDB for an aggregator that is actually running several replicas. Happy to help with that part if useful. What do you think? |
The operator now creates a PodDisruptionBudget for VectorAggregator and ClusterVectorAggregator deployments when more than one replica is expected. The budget keeps at most one pod unavailable during voluntary disruptions such as node drains. When an aggregator runs a single replica or is scaled back down, the operator removes any budget it previously created. When autoscaling is enabled the effective replica count comes from the HPA, so the decision uses spec.autoscaling.maxReplicas; otherwise it uses the static spec.replicas (now a *int32), treating an unset value as one replica. Both aggregator types share the same controller, so one reconcile step covers them. Operator RBAC gains permission to manage poddisruptionbudgets in the policy API group, applied in the kubebuilder markers, the generated role, and the helm clusterrole. Closes kaasops#228
af287d0 to
0b6a2fc
Compare
Cool, thanks for the info. I've fixed up the PR regarding those points you mentioned. Lmk if the HPA check is as you expected. |
|
The autoscaling check is as I expected: One thing before merge. With The #228 use case is fine; I'd make it safe by default:
|
Thanks, that's a fair concern. Making it default-on was the wrong call for exactly the drain scenario you describe. I'd like to fold all three points into a single podDisruptionBudget:
enabled: false
maxUnavailable: 1
unhealthyPodEvictionPolicy: AlwaysAllow
Agreed that none of this fully removes the blocked-drain case, since that's really what a PDB is for. This just makes it opt-in and gives an escape hatch. Happy to go with a |
|
Let's go with the block over a flag, that's the cleaner fit. |
Move the budget behind spec.podDisruptionBudget so upgrades leave existing aggregators untouched. The budget is created only when enabled and the effective replica count is above one, and is removed otherwise. Make minAvailable and maxUnavailable configurable, defaulting to maxUnavailable of 1, and default unhealthyPodEvictionPolicy to AlwaysAllow so not-Ready pods stay evictable and cannot block a node drain.
Adds an opt-in PodDisruptionBudget for VectorAggregator and ClusterVectorAggregator, configured per aggregator via spec.podDisruptionBudget.
Disabled by default, so upgrades leave existing aggregators untouched.
unhealthyPodEvictionPolicydefaults toAlwaysAllowso unhealthy pods cannot block a node drain. The budget is removed when disabled or scaled to one replica.Closes #228