Skip to content

feat: support configurable PodDisruptionBudget#422

Open
davidxia wants to merge 1 commit into
authzed:mainfrom
davidxia:feat/configurable-pdb
Open

feat: support configurable PodDisruptionBudget#422
davidxia wants to merge 1 commit into
authzed:mainfrom
davidxia:feat/configurable-pdb

Conversation

@davidxia
Copy link
Copy Markdown

@davidxia davidxia commented May 10, 2026

Summary

Resolves #414.

Adds a new pdb config object on SpiceDBCluster to give users control over the PodDisruptionBudget:

  • pdb.disabled (bool, default false): when true, the operator deletes any existing PDB owned by the cluster and stops creating one
  • pdb.maxUnavailable (integer or percentage string, e.g. "2" or "50%"): sets the PDB's maxUnavailable field; defaults to 1 when neither field is set (preserving existing behavior)
  • pdb.minAvailable (integer or percentage string): sets the PDB's minAvailable field; mutually exclusive with pdb.maxUnavailable

Example usage

# Disable PDB
spec:
  config:
    pdb:
      disabled: true

# Allow 50% of pods to be unavailable during disruptions
spec:
  config:
    pdb:
      maxUnavailable: "50%"

# Require at least 3 pods to always be available
spec:
  config:
    pdb:
      minAvailable: "3"

Test plan

  • All existing unit tests pass
  • New unit tests added for: disabled PDB, custom maxUnavailable (integer and percentage), custom minAvailable, and validation error when both are set
  • go test ./pkg/... passes

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 10, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@davidxia
Copy link
Copy Markdown
Author

davidxia commented May 10, 2026

I have read the CLA Document and I hereby sign the CLA

@davidxia
Copy link
Copy Markdown
Author

recheck

authzedbot added a commit to authzed/cla that referenced this pull request May 10, 2026
@davidxia davidxia force-pushed the feat/configurable-pdb branch 2 times, most recently from 3d8de88 to 11adb58 Compare May 10, 2026 23:30
Copy link
Copy Markdown
Contributor

@ecordell ecordell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, updated below

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>
@davidxia davidxia force-pushed the feat/configurable-pdb branch from 11adb58 to c4bd31a Compare May 13, 2026 12:39
@davidxia
Copy link
Copy Markdown
Author

Thanks, I didn't see the patches functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support configurable PodDisruptionBudget?

2 participants