imbajin commented on code in PR #574:
URL: https://github.com/apache/hugegraph-doc/pull/574#discussion_r4655854616
##########
content/en/docs/quickstart/hugegraph/hugegraph-helm.md:
##########
@@ -339,62 +325,81 @@ helm test hugegraph -n hugegraph --logs --timeout 5m
Existing explicit helper images also remain under `--reuse-values`;
add `--set-string store.waitImage= --set-string server.waitImage=` to reuse
component images.
Adopt new defaults deliberately with `--reset-values` and a reviewed file
retaining your image, credential, storage and topology settings.
+
Do not treat PD membership, storage or credential changes as ordinary
independent overrides; consult the lifecycle reference.
-PD, Store and Server images built from current master run as UID/GID `10001`.
The chart gives the PD and Store pods `fsGroup: 10001` (with
-`fsGroupChangePolicy: OnRootMismatch`) unless their `podSecurityContext` sets
`fsGroup`, also when `--reuse-values` keeps an older release's empty value,
-so they can write PVCs created by older images, which ran as root.
+### Migrate root-owned volumes {#root-owned-volume-upgrade}
-Switch PD and Store to images built from this version in the same rollout that
first applies `fsGroup`, so the kubelet changes the volume ownership right
-before the `10001` image starts. Do not run images that still run as root with
this chart first, for example a `latest` that has not moved to this version:
-files they create stay owned by root, and `OnRootMismatch` checks only the
volume root, so it does not fix them later. Pin `pd.image` and `store.image` to
a
-build from this version rather than relying on `latest`. A non-empty
`image.digest` wins over `image.tag`, and `--reuse-values` keeps an existing
digest,
-so a release pinned by digest must change the digest, not only the tag.
+Current PD, Store and Server images run as UID/GID `10001`. Unless explicitly
overridden, PD/Store Pods use `fsGroup: 10001`
+and `fsGroupChangePolicy: OnRootMismatch`, including upgrades that reuse an
older empty security context.
+Apply this volume ownership setting together with the first non-root image.
-If a release already ran root images with `fsGroup` set, roll out the first
`10001` image together with a one-time recursive ownership change. Set the
-images in the same command, so the recursive change runs for the `10001` image
rather than for a pinned root image. The example clears any reused digest so
-the tag applies; a release pinned by digest sets `pd.image.digest` and
`store.image.digest` to the digests of this version's images instead:
+A root image started in between can create files that
+`OnRootMismatch` will not repair later, because that policy checks only the
volume root.
-```bash
-helm upgrade hugegraph "$CHART" --devel -n hugegraph --reuse-values \
- --set pd.image.tag=<this-version> \
- --set store.image.tag=<this-version> \
- --set-string pd.image.digest= \
- --set-string store.image.digest= \
- --set pd.podSecurityContext.fsGroupChangePolicy=Always \
- --set store.podSecurityContext.fsGroupChangePolicy=Always \
- --wait --timeout 15m
-```
+Pin the actual non-root image tag or digest for the same rollout. A retained
digest wins over the tag.
+For a release that already ran root images after `fsGroup` was set, use this
one-time repair sequence:
-Before switching the policy back, check that every PD and Store Pod runs the
`10001` image you set, not an older root image:
+1. **Roll out the non-root images with recursive ownership repair.**
-```bash
-kubectl get pods -n hugegraph \
- -o jsonpath='{range
.items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}'
-```
+ Replace `<this-version>` with your reviewed non-root build. The example
clears reused digests so the tags apply;
+ a digest-pinned deployment sets the matching new digests instead.
-`--reuse-values` keeps `Always`, which walks the whole volume on every Pod
start, so set the policy back once those Pods are running:
+ ```bash
+ helm upgrade hugegraph "$CHART" --devel -n hugegraph --reuse-values \
+ --set pd.image.tag=<this-version> \
+ --set store.image.tag=<this-version> \
+ --set-string pd.image.digest= \
+ --set-string store.image.digest= \
+ --set pd.podSecurityContext.fsGroupChangePolicy=Always \
+ --set store.podSecurityContext.fsGroupChangePolicy=Always \
+ --wait --timeout 15m
+ ```
-```bash
-helm upgrade hugegraph "$CHART" --devel -n hugegraph --reuse-values \
- --set pd.podSecurityContext.fsGroupChangePolicy=OnRootMismatch \
- --set store.podSecurityContext.fsGroupChangePolicy=OnRootMismatch \
- --wait --timeout 15m
-```
+1. **Recreate Store Pods and verify `Always` was applied on every
replacement.**
+
+ Run the `kubectl get pods` command below first to inspect current policy
status.
+ Under unpartitioned `RollingUpdate`, `helm upgrade` in step 1 has already
recreated Store Pods one by one with `Always` applied.
+ Under `values-cluster.yaml` (`store.updateStrategy.type=OnDelete`), `helm
upgrade` does not automatically recreate Store Pods,
+ so existing Pods have not mounted their volumes under `Always`. In that
case, recreate only the Store Pods that do not yet have `Always` applied,
+ one at a time using the [controlled rollout
procedure](./hugegraph-helm-operations.md#6-rolling-store-images-safely).
+ Confirm each replacement Pod runs the selected image, mounts its PVC with
`fsGroupChangePolicy: Always`, and passes shard recovery before restoring the
policy.
+
+ ```bash
+ kubectl get pods -n hugegraph \
+ -o jsonpath='{range
.items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\t"}{.spec.securityContext.fsGroupChangePolicy}{"\n"}{end}'
+ ```
+
+1. **Restore `OnRootMismatch` after verification.**
+
+ `--reuse-values` retains `Always`, which otherwise walks the whole volume
on every Pod start.
+ Only restore `OnRootMismatch` after all Store replacements have mounted
under `Always`.
Review Comment:
**⚠️ Verify PD volume repair before restoring the policy**
This check covers only Store, but the next command also restores PD to
`OnRootMismatch`. The chart supports `pd.updateStrategy.type=OnDelete` and
partitioned rolling updates, so the first upgrade can leave PD Pods on the old
template without mounting their PVCs under `Always`. Restoring the policy then
can leave root-owned files unrepaired and prevent a later non-root PD startup.
Please verify every PD replacement used the selected image and `Always`, and
replace any stale Pods one at a time while preserving Raft quorum before
restoring the policy. The Chinese procedure needs the same correction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]