feat: support configurable PodDisruptionBudget#422
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
3d8de88 to
11adb58
Compare
ecordell
left a comment
There was a problem hiding this comment.
One small change, otherwise this looks good! Thanks for the contribution!
FYI full customization of the PDB is possible with the patches feature, but I can see why we'd want these to have shortcuts.
| // If PDB is disabled, delete any existing PDB and skip creation | ||
| if cfg.PDB.Disabled { | ||
| for _, pdb := range pdbComponent.List(ctx, CtxClusterNN.MustValue(ctx)) { | ||
| nn := types.NamespacedName{Name: pdb.Name, Namespace: pdb.Namespace} |
There was a problem hiding this comment.
Can we also verify a match on the component labels too? metadata.LabelsForComponent(clusterName, metadata.ComponentPDBLabel). This way we can be sure to only delete a PDB that was operator created, and not one that happened to have a name that matches
There was a problem hiding this comment.
yup, updated below
There was a problem hiding this comment.
could a test be written that covers this? i see in https://app.codecov.io/github/authzed/spicedb-operator/blob/main/pkg%2Fcontroller%2Fcontroller.go#L531 that ensurePdb has almost zero coverage
There was a problem hiding this comment.
I see ensurePdb() on main doesn't have any test coverage right now. So I tried to add coverage for at least my changes here.
I added TestEnsurePDB() in controller_test.go. The test logic isn't as nice as TestCredentialSecretsForCluster because ensurePDB()'s function signature isn't as testable as credentialSecretsForCluster()'s. But I don't want to increase the scope of this PR by changing ensurePDB()'s function signature.
How does it look? How can I get an updated coverage report?
11adb58 to
c4bd31a
Compare
|
Thanks, I didn't see the patches functionality. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #422 +/- ##
==========================================
+ Coverage 66.29% 67.92% +1.63%
==========================================
Files 30 30
Lines 2572 2619 +47
==========================================
+ Hits 1705 1779 +74
+ Misses 753 725 -28
- Partials 114 115 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Anything I can do to help move this along? |
Adds three new SpiceDBCluster config fields: - `pdbDisabled` (bool): disables PDB creation entirely; any existing PDB owned by the cluster is deleted on the next reconcile - `pdbMaxUnavailable` (int or percentage string, e.g. "2" or "50%"): sets the PDB's maxUnavailable field; defaults to 1 when neither field is set - `pdbMinAvailable` (int or percentage string): sets the PDB's minAvailable field; mutually exclusive with pdbMaxUnavailable Fixes authzed#414 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1da0e19 to
86ab60e
Compare
Signed-off-by: David Xia <david@davidxia.com>
Signed-off-by: David Xia <david@davidxia.com>
Head branch was pushed to by a user without write access
|
@miparnisari thanks, fixed a blocking golint violation |
ecordell
left a comment
There was a problem hiding this comment.
LGTM, thanks for the contribution!
Summary
Resolves #414.
Adds a new
pdbconfig object onSpiceDBClusterto give users control over the PodDisruptionBudget:pdb.disabled(bool, defaultfalse): whentrue, the operator deletes any existing PDB owned by the cluster and stops creating onepdb.maxUnavailable(integer or percentage string, e.g."2"or"50%"): sets the PDB'smaxUnavailablefield; defaults to1when neither field is set (preserving existing behavior)pdb.minAvailable(integer or percentage string): sets the PDB'sminAvailablefield; mutually exclusive withpdb.maxUnavailableExample usage
Test plan
maxUnavailable(integer and percentage), customminAvailable, and validation error when both are setgo test ./pkg/...passes🤖 Generated with Claude Code