fix(spawner): set fsGroupChangePolicy: OnRootMismatch on singleuser pods#83
Open
tylerpotts wants to merge 2 commits into
Open
fix(spawner): set fsGroupChangePolicy: OnRootMismatch on singleuser pods#83tylerpotts wants to merge 2 commits into
tylerpotts wants to merge 2 commits into
Conversation
The kubelet's default fsGroupChangePolicy: Always recursively chowns every file on the mounted home PVC to match fsGroup at every spawn. On home PVCs with large pixi envs and model caches (observed: 750k files), this takes 30-150s and times out the spawn at the JupyterHub 60s default. OnRootMismatch only performs the chown when the volume's root GID is wrong, so it runs at most once per PVC and subsequent spawns skip it entirely. Closes #56
The first attempt set securityContext.fsGroupChangePolicy via
extra_pod_config but left fs_gid as a separate KubeSpawner trait,
assuming kubespawner would deep-merge the two into the pod's
securityContext. It doesn't — extra_pod_config does a top-level
attribute overwrite, so the securityContext set here replaced the one
fs_gid produced and pod.spec.securityContext.fsGroup was dropped.
Kubespawner logged exactly this at spawn time:
'pod.spec.security_context' current value: '{'fsGroup': 100}' is
overridden with '{'fsGroupChangePolicy': 'OnRootMismatch'}'
Effect: users no longer had GID 100 as a supplemental group, breaking
shared-storage writes and failing 5 e2e tests on PR #83.
Fix: set fsGroup and fsGroupChangePolicy together in extra_pod_config,
remove the now-redundant fs_gid trait, and document the overwrite
behavior in the comment so this trap doesn't get re-set.
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.
Summary
securityContext.fsGroupChangePolicy: OnRootMismatchtoc.KubeSpawner.extra_pod_configinconfig/jupyterhub/01-spawner.py.chown(Alwayspolicy) from running on every spawn, which on populated home PVCs (large pixi envs, HuggingFace caches) takes 30–150s and times out the spawn at JupyterHub's 60s default.OnRootMismatchruns the chown at most once per PVC (when the root GID is wrong), so subsequent spawns skip it entirely.The new key is deep-merged into the pod spec alongside the existing
securityContext.fsGroup: 100set byc.KubeSpawner.fs_gid.Closes #56
Test plan
helm lint . --set nebariapp.enabled=falsepassesuvx ruff check config/passeshelm templaterenders bothfsGroup: 100andfsGroupChangePolicy: OnRootMismatchon the rendered hub ConfigMaptests/unit/passkubectl get pod jupyter-<user> -o jsonpath='{.spec.securityContext}'shows bothfsGroupandfsGroupChangePolicykubectl describe pod jupyter-<user>no longer emits the "Setting volume ownership ... is taking longer than expected" warning after the first post-deploy spawnOut of scope
The architectural issue called out in #56 and #54 — that
01-spawner.pydirectly assignsc.KubeSpawner.extra_pod_configand clobbers any operator-providedsingleuser.extraPodConfigfrom values — is not addressed here. That belongs in its own PR.