Skip to content

add support for overriding name of PDB#5090

Merged
Skarlso merged 8 commits intoexternal-secrets:mainfrom
megashby:feat-override-pdb-naming
Aug 8, 2025
Merged

add support for overriding name of PDB#5090
Skarlso merged 8 commits intoexternal-secrets:mainfrom
megashby:feat-override-pdb-naming

Conversation

@megashby
Copy link
Copy Markdown
Contributor

@megashby megashby commented Aug 1, 2025

Problem Statement

Reporter wanted a way to have more control over the naming convention of the PDB, and the previous logic of suffixing with -pdb was not sufficient

Related Issue

Fixes #5042

Proposed Changes

Allow overriding the name of the PodDisruptionValue , webhook PodDisruption Budget, and Cert controller pod disruption budgets by first checking for .podDisruptionBudget.nameOverride before defaulting to original values

Checklist

  • I have read the contribution guidelines
  • All commits are signed with git commit --signoff
  • My changes have reasonable test coverage
  • All tests pass with make test
  • I ensured my PR is ready for review with make reviewable
Screenshot 2025-08-03 at 10 38 50 AM

@megashby megashby requested a review from a team as a code owner August 1, 2025 02:52
@megashby megashby requested a review from Skarlso August 1, 2025 02:52
@Skarlso
Copy link
Copy Markdown
Contributor

Skarlso commented Aug 1, 2025

Yes, please move it into the _helpers.tpl file. 🙇

And then apply to all three pod distribution budget templates.

Signed-off-by: Meg Ashby <meg@alloy.com>
…Controller pdbs

Signed-off-by: Meg Ashby <meg@alloy.com>
@megashby megashby force-pushed the feat-override-pdb-naming branch from c38d2f4 to e1f5c51 Compare August 2, 2025 21:47
{{- end -}}

{{- define "external-secrets.pdbName" -}}
{{- .Values.podDisruptionBudget.nameOverride | default (printf "%s-pdb" (include "external-secrets.fullname" .)) }}
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.

This does not exist yet. nameOverride is not a thing in the values.yaml file. Make sure you create that first. :)

Then add a little test like this:

suite: test pod distribution budget deployment
templates:
  - poddisruptionbudget.yaml
tests:
  - it: should set podDisruptionBudget to set value if given
    set:
      podDisruptionBudget.nameOverride: MyCustomName
    asserts:
      - equal:
          path: metadata.name
          value: MyCustomName

Or something like that into a new file under deploy/charts/external-secrets/tests. And once you run make helm.test you should see your new test there. And then make it fail by setting something different for MyCustonName and that should give you some confidence as to what you wrote is actually working. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks so much for the guidance, makes total sense. I will attach screenshots of local test output to the main thread of this PR to show they've passed.

megashby and others added 3 commits August 3, 2025 10:23
Signed-off-by: Meg Ashby <meg@alloy.com>
Signed-off-by: Meg Ashby <megashby@comcast.net>
@megashby megashby requested a review from Skarlso August 6, 2025 14:20
Copy link
Copy Markdown
Contributor

@Skarlso Skarlso left a comment

Choose a reason for hiding this comment

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

Just one comment. This looks fantastic already. :) Thank you!

{{/*
Create the name of the pod disruption budget to use in the webhook
*/}}
{{- define "external-secrets.webookPdbName" -}}
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.

Type in the name. webook.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

omg, shame. 🙈

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

resolved 👍

Signed-off-by: Meg Ashby <megashby@comcast.net>
Signed-off-by: Meg Ashby <megashby@comcast.net>
@Skarlso
Copy link
Copy Markdown
Contributor

Skarlso commented Aug 8, 2025

/ok-to-test sha=2f6a1de3b8b6a6106307c6fb66d6bbeb99bbaefd

@eso-service-account-app
Copy link
Copy Markdown
Contributor

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Aug 8, 2025

@Skarlso Skarlso merged commit b798d6d into external-secrets:main Aug 8, 2025
22 checks passed
alliseeisgold pushed a commit to alliseeisgold/external-secrets that referenced this pull request Aug 25, 2025
* add support for overriding name of PDB

Signed-off-by: Meg Ashby <meg@alloy.com>

* moving logic to _helpers.tpl, also making changes to webhook and certController pdbs

Signed-off-by: Meg Ashby <meg@alloy.com>

* add test cases for each pdb type, add in defaults to values.aml

Signed-off-by: Meg Ashby <meg@alloy.com>

* add docs

Signed-off-by: Meg Ashby <meg@alloy.com>

* Update _helpers.tpl

Signed-off-by: Meg Ashby <megashby@comcast.net>

* Update webhook-poddisruptionbudget.yaml

Signed-off-by: Meg Ashby <megashby@comcast.net>

---------

Signed-off-by: Meg Ashby <meg@alloy.com>
Signed-off-by: Meg Ashby <megashby@comcast.net>
Co-authored-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
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.

PDB naming convention

2 participants