gitserver: make PVC access modes configurable via storageAccessModes - #921
Open
marcleblanc2 wants to merge 1 commit into
Open
gitserver: make PVC access modes configurable via storageAccessModes#921marcleblanc2 wants to merge 1 commit into
marcleblanc2 wants to merge 1 commit into
Conversation
The gitserver StatefulSet volumeClaimTemplate hardcoded accessModes: [ReadWriteOnce]. On SELinux-enforcing nodes (Bottlerocket, EKS Auto Mode), every gitserver pod (re)start makes containerd recursively relabel every file on the repos volume with the new container's MCS categories, because the volume cannot use the -o context mount option. On a volume with millions of git objects this holds the pod in ContainerCreating for 15-30+ minutes. Since Kubernetes 1.36, SELinuxMountReadWriteOncePod is GA: a ReadWriteOncePod PVC (plus a pinned seLinuxOptions.level and a CSI driver with seLinuxMount: true) is mounted with -o context and skips the relabel walk entirely. Adds gitserver.storageAccessModes, defaulting to the previous hardcoded [ReadWriteOnce], so existing deployments are unchanged. Amp-Thread-ID: https://ampcode.com/threads/T-019fdaa3-9594-762b-8593-8de01deb566e Co-authored-by: Amp <amp@ampcode.com>
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.
Problem
The gitserver StatefulSet volumeClaimTemplate hardcodes
accessModes: [ReadWriteOnce].On SELinux-enforcing nodes (Bottlerocket, EKS Auto Mode), every gitserver pod (re)start makes containerd recursively relabel every file on the repos volume with the new container's random MCS categories, because an RWO volume cannot use the
-o contextmount option (theSELinuxMountfeature gate is off by default in Kubernetes <= 1.36, and managed offerings like EKS Auto Mode do not allow enabling it). On a repos volume with millions of git objects, this holds gitserver inContainerCreatingfor 15-30+ minutes, with kubelet loggingfailed to reserve container name ... another CreateContainer request is in progressas its CRI calls time out and retry behind the still-running relabel walk.Fix
Add
gitserver.storageAccessModes, defaulting to the previous hardcoded["ReadWriteOnce"]so existing deployments render identically.Setting it to
["ReadWriteOncePod"]enables the mount-option labeling path (SELinuxMountReadWriteOncePod, GA in Kubernetes 1.36): kubelet mounts the volume with-o context=<label>and the relabel walk is skipped entirely. Requires the pod to pingitserver.podSecurityContext.seLinuxOptions.leveland a CSI driver withseLinuxMount: true(the EBS CSI driver qualifies).Notes
helm template; all 103 unit tests and 12 snapshots pass).volumeClaimTemplatesare immutable on StatefulSets, so switching an existing deployment requires deleting the StatefulSet (--cascade=orphan) and recreating the PVC. Noted in the CHANGELOG.Test plan
helm unittest charts/sourcegraph: 24 suites, 103 tests, 12 snapshots passhelm templatewith defaults rendersReadWriteOnce(unchanged)helm template --set 'gitserver.storageAccessModes={ReadWriteOncePod}'rendersReadWriteOncePod