Repository navigation
feat(docker): run PD, Store and Server images as a non-root user #3381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
imbajin
merged 7 commits into
apache:master
from
byteayan:claude/docker-non-root-images
Oct 25, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
39e26a6
feat(docker): run PD, Store and Server images as a non-root user
byteayan 969738e
docs(docker): cover bind mounts and Helm upgrades for the non-root im…
byteayan 61f06a4
fix(helm): keep the PD and Store fsGroup under --reuse-values
byteayan 8647451
docs(helm): switch to the non-root images in the fsGroup rollout
byteayan 69c9afc
docs(helm): pin the image in the one-time Always rollout and switch back
byteayan 9ff9a0b
fix(helm): handle digest-pinned images in the fsGroup rollout docs
byteayan f431893
Merge apache master into docker-non-root-images
byteayan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| suite: PD and Store pod securityContext keeps fsGroup for the non-root images | ||
| templates: | ||
| - pd-statefulset.yaml | ||
| - store-statefulset.yaml | ||
| tests: | ||
| - it: defaults fsGroup to the image user | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.securityContext | ||
| value: | ||
| fsGroup: 10001 | ||
| fsGroupChangePolicy: OnRootMismatch | ||
| - it: still sets fsGroup when a reused release has no podSecurityContext | ||
| set: | ||
| pd.podSecurityContext: null | ||
| store.podSecurityContext: null | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.securityContext | ||
| value: | ||
| fsGroup: 10001 | ||
| fsGroupChangePolicy: OnRootMismatch | ||
| - it: keeps an explicit fsGroup and other settings | ||
| set: | ||
| pd.podSecurityContext: | ||
| fsGroup: 2000 | ||
| runAsNonRoot: true | ||
| store.podSecurityContext: | ||
| fsGroup: 2000 | ||
| runAsNonRoot: true | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.securityContext.fsGroup | ||
| value: 2000 | ||
| - equal: | ||
| path: spec.template.spec.securityContext.runAsNonRoot | ||
| value: true | ||
| - it: keeps an explicit fsGroupChangePolicy | ||
| set: | ||
| pd.podSecurityContext: | ||
| fsGroupChangePolicy: Always | ||
| store.podSecurityContext: | ||
| fsGroupChangePolicy: Always | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.securityContext | ||
| value: | ||
| fsGroup: 10001 | ||
| fsGroupChangePolicy: Always |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: The one-time recursive rollout can miss its target, and the README does not say how to go back afterwards. Blocking: no. Summary: The command sets only
fsGroupChangePolicy=Always, under--reuse-values. That has two effects.Alwaysrollout on root images, and the later upgrade that brings the10001image runs underOnRootMismatchagain. The paragraph above asks operators to "Pinpd.imageandstore.image", so pinned releases are the expected case.OnRootMismatchon the next upgrade" does not happen by itself. A--setvalue is saved in the release values, and the main upgrade command in this section (helm upgrade ... --reuse-values --wait --timeout 15m, line 240) keeps it. SoAlwaysstays on, and its whole-volume walk runs on every Pod start, until someone sets the policy back.Evidence: line 245 says
--reuse-valuespreserves existing settings. The new unittest "keeps an explicit fsGroupChangePolicy" shows that the helper keeps an explicitAlways, so nothing in the chart resets it.Requested change: add the image pins to the one-time command, for example
--set pd.image.tag=<this version> --set store.image.tag=<this version>. Also show the follow-up upgrade:--reuse-values --set pd.podSecurityContext.fsGroupChangePolicy=OnRootMismatch --set store.podSecurityContext.fsGroupChangePolicy=OnRootMismatch.