Skip to content

[improvement](build) Run FE, BE and Meta Service runtime images as non-root - #70821

Open
Al-assad wants to merge 4 commits into
apache:masterfrom
Al-assad:fix/non-root-runtime
Open

Al-assad wants to merge 4 commits into
apache:masterfrom
Al-assad:fix/non-root-runtime

Conversation

@Al-assad

@Al-assad Al-assad commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Background

The standalone Doris runtime images package FE, BE, and Meta Service/Recycler for container deployments on Ubuntu and UBI 9. The entrypoints install mounted configuration before running the engine.

What problem does this PR solve?

Issue Number: None
Related PR: #70770 (shared Ubuntu and UBI runtime build)
PR Type: Enhancement

Problem Summary:

The standalone images require root without these changes. Run the three components under a dedicated numeric identity and prepare their writable configuration at startup. The shared build validates custom identity values before fetching an archive and uses the mirror published on the Apache Doris download page.

Details

  • Change map: 323 lines of production code, 199 lines of tests, and 89 lines of documentation changed, with no generated files. Dockerfiles and build scripts cover identity and artifact selection. Entrypoints cover projected configs, cloud settings, and Meta Service startup.
  • Before and after: Standalone FE, BE, and MS run as 10001:10001 by default. The entrypoints copy projected primary config before changing it. Disaggregated FE retains its default FQDN setting when the mounted file omits it, and FE/BE replace generated cloud settings on restart. MS preserves a configured FDB endpoint when the environment override is absent.
  • Configs and defaults: DORIS_UID and DORIS_GID accept unused positive decimal IDs and default to 10001. Existing download overrides still apply. The runtime base retains the pinned Operator tools. Use the matching standalone dorisctl package for Preflight.
  • Impact on existing users: Prepare existing mounted volumes for the target identity before changing images. Keep the released root image digest for the baseline rollout.

Testing

  • Reproduced the invalid identity handoff, obsolete default checksum URL, and missing cloud FE FQDN default on the prior PR head. The matching tests pass on the final candidate.
  • Ran 12 build tests and checked changed Bash lines with ShellCheck. Built 24 Docker fixture images in the Ubuntu and UBI 9 matrix, then checked the configured and effective account and ran non-root projection, Kerberos-link, and FDB config tests.
  • The earlier PR run used verified Doris 4.1.4 binaries and fresh local-path PVCs in amd64 K3s. Full builds with the same 4.1.5 binaries and Kubernetes upgrade tests remain in release verification.

Earlier author validation with 4.1.4 binaries

  • Built linux/amd64 FE, BE and MS images using the official Apache Doris 4.1.4 binary package, whose checksum was verified. The current branch's engine was not rebuilt.
  • Validated fresh DorisCluster and DorisDisaggregatedCluster deployments on native x86_64 K3s with unmodified Doris Operator 26.0.1 and fresh local-path PVCs.
  • All Doris processes ran as UID/GID 10001 with CapEff=0, NoNewPrivs=1 and seccomp enabled. No privileged or init containers were used for Doris; Workload Group cgroup setup was disabled.
  • Both deployments passed SQL INSERT, Stream Load and exact five-row query checks. CR-driven recreation changed every Doris Pod UID while retaining PVC identities and all five rows. MS and Recycler both started successfully.
  • Observed transient duplicate BE registration retries and DNS/gRPC recovery delays after recreation; final query checks passed. These observations were not established to be caused by non-root execution, and their code paths are unchanged.

Release note

Standalone FE, BE, and Meta Service/Recycler runtime images use a dedicated non-root user. Prepare storage ownership before upgrading mounted data and use the matching standalone Operator CLI for deployment Preflight. Keep the already published 4.1.5 image digests as the upgrade baseline and use separate tags for the non-root images.

Check List (For Author)

  • Behavior changed: Yes (see Details).
  • Does this need documentation: Yes. The runtime README describes identity, configuration, and storage preparation.
  • Pre-submission status: Partially verified: full 4.1.5 image payload, real Kubernetes upgrade, and production storage matrix are scheduled for release verification.

AI Disclosure

  • Tool: Codex (GPT-6).
  • Generated: T07 code updates, tests, and description draft.
  • Human review: The T07 follow-up awaits maintainer review.

### What problem does this PR solve?

Issue Number: N/A

Problem Summary: FE and BE runtime images default to root, and operator
entrypoints modify configuration projected from read-only ConfigMaps.
Create a configurable doris UID/GID (10001 by default), assign runtime
files and directories to that user, and switch the runtime images to it.
Copy writable FE/BE configuration before startup updates it. Route the
default Kerberos configuration link through the writable Doris conf
directory, including when the entrypoint runs repeatedly.

### Release note

FE and BE images run as UID/GID 10001 by default. Kubernetes deployments
can supply fsGroup and disable the Operator's system init and cgroup
setup. No host cgroup delegation is provisioned. Host kernel tuning and
volume-driver support remain platform constraints.

### Check List (For Author)

- Test: ShellCheck and bash syntax; projected-config tests for four entrypoints;
  Kerberos config and repeated-start tests as the image's non-root user;
  Docker builds; existing Operator 26.0.1 on K3s 1.34.12 with fresh PVCs,
  no init containers, UID 10001 and all capabilities dropped; SQL, Stream
  Load, WG queue timeout, fixed-slot memory limit, CPU limit behavior,
  and persisted data after recreating both Pods. Runtime validation uses
  packaged Doris 4.1.4 binaries; the master engine was not rebuilt.
- Behavior changed: Yes, default image user and writable configuration handling.
- Does this need documentation: Yes, included in docker/runtime/README.md.
### Background

Standalone FE and BE images already use a configurable non-root Doris user.
Meta Service shares the runtime packaging workflow and loads configuration
projected by the Kubernetes Operator before starting Meta Service and Recycler.

### What problem does this PR solve?

Issue Number: None
Related PR: None
PR Type: Enhancement

Problem Summary:
Meta Service still defaults to root, and its startup configuration handling does
not consistently prepare a writable configuration or preserve an existing FDB
endpoint when the environment override is absent. Run MS and Recycler as the
same default UID/GID as FE and BE, prepare writable configuration, and forward
custom IDs through the shared image build helper.

### Details

- Before and after: MS changes from root to UID/GID 10001. Image-owned runtime
  directories are writable; ConfigMap-backed primary configuration is copied
  and made writable before the FDB endpoint is applied. Repeated starts replace
  the endpoint instead of accumulating assignments. Role arguments are forwarded.
- Configs and defaults: DORIS_UID and DORIS_GID default to 10001 for all component
  builds. An absent FDB_ENDPOINT preserves the configured endpoint.
- Impact on existing users: Existing root-owned volumes require a separate
  permission migration. No migration or privileged helper is introduced.
- Behavior change: MS and Recycler now run without root by default; startup
  preparation errors fail immediately and the entrypoint execs the start script.

### Testing

- Bash syntax, targeted ShellCheck, and git diff --check pass.
- Projected read-only configuration and repeated-start tests pass under UID 10001
  with all capabilities dropped. Removing the writable-mode correction causes
  the MS test to fail with Permission denied.
- Built standalone linux/amd64 FE, BE and MS images with official, SHA-512-verified
  Doris 4.1.4 packaged binaries. Verified image IDs after K3s containerd import.
- Unmodified Operator 26.0.1 on native x86_64 K3s v1.34.13: DorisCluster and
  DorisDisaggregatedCluster both start in restricted namespaces with fresh
  local-path PVCs, no init containers, UID/GID 10001, zero effective capabilities,
  no privilege escalation and RuntimeDefault seccomp.
- SQL insert, Stream Load and queries pass in both deployment modes. Recreated
  all Doris pods through CR annotations and verified unchanged PVC identities
  and all five expected rows after service recovery. MS and Recycler both start.
- Observed duplicate backend-registration retries and transient DNS/gRPC query
  recovery after cloud backend replacement; eventual checks pass. These existing
  startup/reconnection paths are unchanged by this patch.

### Release note

Meta Service and Recycler runtime images now use UID/GID 10001 by default,
matching FE and BE. Configure writable volumes and matching Kubernetes security
contexts; existing root-owned volumes need their permissions prepared separately.

### Check List (For Author)

- Behavior changed: Yes (see Details).
- Does this need documentation: Yes, included in docker/runtime/README.md.
- Pre-submission status: Partially verified: native amd64 with packaged 4.1.4;
  arm64, the current master engine and existing-PVC migration were not tested.

### AI Disclosure

- Tool: Codex.
- Generated: Runtime changes, tests, documentation and this description.
- Human review: Pending author review.
### Background

The standalone runtime build uses verified Doris release archives for FE, BE, and Meta Service on Ubuntu and UBI 9. The entrypoints install projected configuration before they start Doris.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70821 (non-root runtime update), apache#70770 (shared runtime builder), apache#39093 (disaggregated entrypoint)
PR Type: Bugfix

Problem Summary:

The shared builder forwards invalid runtime IDs before downloading the archive or starting the base build. Its previous default mirror returned HTTP 403 when requesting the 4.1.5 checksums. A projected FE config also discards the FQDN setting that disaggregated startup applies before installing the file. Validate the IDs early, use the Apache download mirror, and apply cloud settings to the installed config.

### Details

- **Change map:** 200 production, 81 test, and 24 documentation lines changed. No generated files. Build changes validate IDs and select the download mirror. Entrypoint changes install the projected config before applying startup settings.
- **Frequency:** Reproduced when building with UID 0 or starting disaggregated FE with a projected fe.conf that omits enable_fqdn_mode. The legacy mirror returned 403 in the verification environment.
- **Root cause:** The builder forwards IDs without checking them, and the FE entrypoint applies FQDN settings to the image config before replacing it with the projected config.
- **Why existing tests missed it:** Build tests checked valid identity forwarding and mock checksums. The entrypoint test exercised the copy helper outside the disaggregated FE startup sequence. Kernel regression tests start packaged services and do not exercise these runtime build scripts.
- **Fix:** Validate decimal IDs before fetching artifacts and before creating Docker users. Point the builder at the current Apache download mirror. Install writable primary configs before applying cloud settings, preserve explicit FQDN mode, and replace generated cloud assignments on restart.
- **Other paths and branches:** Both distro launchers use the shared builder. Integrated FE and BE share the projected file handling, and disaggregated BE reapplies its cloud mode. Meta Service retains its existing FDB handling. The shared builder is outside branch-4.0 and branch-4.1 at the inspected refs. Their FE entrypoints retain the old ordering. This change targets master.
- **Behavior change:** Invalid build-time IDs fail earlier, and disaggregated FE defaults to FQDN mode when its effective config omits the setting.

### Testing

- Confirmed red and green results for invalid IDs, the download URL, and disaggregated FE with a read-only projected config.
- Passed the runtime build unit tests, targeted ShellCheck, and Bash syntax checks.
- Built 24 Docker fixture images for Ubuntu and UBI 9 on amd64 and arm64. Checked default and custom IDs for FE, BE, and MS, then ran the non-root configuration tests on both distributions and architectures.
- Retrieved the official 4.1.5 checksums for the comparison inputs and verified the current operator tool source pin.

### Release note

Validate non-root runtime IDs before image builds, use the current Apache release download mirror, and preserve the FQDN default and cloud configuration across projected-config startup and restart.

### Check List (For Author)

- Behavior changed: Yes (see Details).
- Does this need documentation: Yes. The runtime README documents the IDs, startup behavior, and matching standalone Operator CLI.
- Pre-submission status: Partially verified: full Doris binary image builds and Kubernetes upgrade tests are tracked in the release verification stage.

### AI Disclosure

- Tool: Codex (GPT-6).
- Generated: Implementation, tests, and draft.
- Human review: Pending maintainer review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant