Skip to content

feat(helm): add podSecurityContext - #175

Merged
cilindrox merged 1 commit into
plexinc:masterfrom
matlaj:fix/pod-security-context
Aug 27, 2026
Merged

feat(helm): add podSecurityContext#175
cilindrox merged 1 commit into
plexinc:masterfrom
matlaj:fix/pod-security-context

Conversation

@matlaj

@matlaj matlaj commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

pms.securityContext is documented as "Security context for PMS pods", but it renders into the container's securityContext, and the chart has no pod-level securityContext hook at all.

That mismatch silently discards pod-only fields. Setting fsGroup -- the documented way to make the config volume group-writable -- produces a manifest where fsGroup sits in a container securityContext, which the API server drops. The chart installs cleanly and the setting simply never takes effect.

Add pms.podSecurityContext, rendered on the pod spec, and correct both doc strings to say which level they apply to.

Backward compatible: pms.securityContext keeps rendering exactly where it did, and the new value defaults to {}, which emits nothing.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

@matlaj
matlaj requested a review from a team as a code owner August 23, 2026 21:00
@matlaj
matlaj requested review from MarshallAsch and cookandy and removed request for a team August 23, 2026 21:00
…curityContext

`pms.securityContext` is documented as "Security context for PMS pods", but it
renders into the container's securityContext, and the chart has no pod-level
securityContext hook at all.

That mismatch silently discards pod-only fields. Setting `fsGroup` -- the
documented way to make the config volume group-writable -- produces a manifest
where `fsGroup` sits in a container securityContext, which the API server drops.
The chart installs cleanly and the setting simply never takes effect.

Add `pms.podSecurityContext`, rendered on the pod spec, and correct both doc
strings to say which level they apply to.

Backward compatible: `pms.securityContext` keeps rendering exactly where it did,
and the new value defaults to `{}`, which emits nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@matlaj
matlaj force-pushed the fix/pod-security-context branch from 3316a65 to 07fadf4 Compare August 23, 2026 21:07
@cilindrox cilindrox self-assigned this Aug 24, 2026

@cilindrox cilindrox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍 - thanks @matlaj

Going to cherrypick this into the upcoming v1.7 of the chart.

@cilindrox cilindrox changed the title fix: render pms.securityContext at the container level, add pms.podSecurityContext feat(helm): add pod securityContext Aug 24, 2026
@cilindrox cilindrox changed the title feat(helm): add pod securityContext feat(helm): add podSecurityContext Aug 24, 2026
@cilindrox
cilindrox merged commit f588ac3 into plexinc:master Aug 27, 2026
3 checks passed
cilindrox added a commit that referenced this pull request Sep 7, 2026
* feat(chart): add startupProbe support to the pms container

The chart supports livenessProbe and readinessProbe (#117) but not
startupProbe, which forces a bad trade-off for anyone using probes.

PMS answers 503 on /identity in two very different situations:

  1. while it runs database migrations at startup — transient, can take
     many minutes on a large library, and restarting makes it worse
     because the migration starts over;
  2. when the server is wedged and will never recover on its own.

Only a liveness probe catches (2), because the process stays alive. But
with no startupProbe available, the liveness budget has to be stretched
to cover the worst case of (1), or it turns a slow migration into a
restart loop — the exact risk raised in the review of #117:

  "if it's a particularly long db migration, the restart will just
   result in it being run again from the beginning and will
   indefinitely until the migration is allowed enough time to
   complete."

startupProbe is the primitive that separates the two: it holds the
liveness probe off until the container answers once, then hands over.
With it, the same deployment can tolerate a long migration and still
keep a tight liveness probe afterwards.

Changes, with no behaviour change unless the new value is set:

  - templates/statefulset.yaml: one {{- with }} block mirroring the
    existing two, placed before livenessProbe.
  - values.yaml: startupProbe: {} with a commented-out example, in the
    same style as its neighbours.
  - README.md: helm-docs row.
  - Chart.yaml: 1.7.1 -> 1.8.0, matching how #168, #170 and #175 each
    bumped the minor version for an additive feature.

Verified: `helm template` with no values renders byte-identically to
before apart from the helm.sh/chart label; with startupProbe and
livenessProbe both set, both render correctly nested and readinessProbe
stays absent; the rendered manifest passes kubectl apply
--dry-run=server against a live cluster.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Update charts/plex-media-server/values.yaml

Co-authored-by: Gaston Festari <cilindrox@gmail.com>

* docs(chart): regenerate README with helm-docs

Chart.yaml was bumped to 1.8.0 and the pms.startupProbe comment in
values.yaml was reworded, but README.md was never regenerated, so the
lint job's `helm-docs --chart-search-root charts` + `git diff
--exit-code` check failed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VqVXMTaVmKbkeF3XevLMoJ

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gaston Festari <cilindrox@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants