Repository navigation
Conversation
Add spec.podDisruptionBudget (minAvailable or maxUnavailable) to Fluentd. In collector mode, the operator creates and updates a PodDisruptionBudget selecting the StatefulSet's pods, and removes it when the field is unset or in agent mode. Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
…uentd PodDisruptionBudget Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Adds
spec.podDisruptionBudgetto theFluentdresource, so the operator can manage a PodDisruptionBudget for the Fluentd StatefulSet. Without one, a node drain can take all Fluentd collectors down at once, and the only workaround today is a hand-written PDB next to the operator (#1825).How it works:
policy/v1PodDisruptionBudget named like the Fluentd resource. It reuses the StatefulSet's own selector, so it always matches the same pods, including extra labels from the Fluentd metadata. The PDB is owned by the Fluentd resource, and the controller now watches PDBs (Owns).replicasis "applicable when the mode is collector".minAvailableandmaxUnavailable. Each accepts a number or a percentage.poddisruptionbudgetspermissions in thepolicygroup. I added the kubebuilder RBAC marker, which regeneratesconfig/rbac/role.yamlandmanifests/setup/setup.yaml, and the same rule in the chart'sfluent-operator-clusterRole.yaml.Which issue(s) this PR fixes:
Fixes #1825
Does this PR introduced a user-facing change?
Notes
Generated files come from
make generate manifests docs-update, run in WSL with controller-gen v0.18.0: the Fluentd deepcopy and CRDs (config, both charts,manifests/setup/setup.yaml), the RBAC role, anddocs/fluentd.md. The chart's ClusterRole template isn't generated, so I edited it by hand.Tested locally:
make testpasses. It runs the whole suite with the race detector, including thecontrollersenvtest tests.TestMakeFluentdPodDisruptionBudgetcovers no budget,minAvailable(and that the selector matches the StatefulSet's) and amaxUnavailablepercentage.go build ./...succeeds andmake lintreports0 issues.I haven't run it against a real cluster, so the create, update and delete path in the controller is only exercised through the build and the envtest suite, not with a live StatefulSet.