Skip to content

fix: remove hardcoded Asia/Shanghai timezone from container images#6126

Merged
RongGu merged 2 commits into
fluid-cloudnative:masterfrom
cheyang:fix/remove-hardcoded-shanghai-timezone
Jul 16, 2026
Merged

fix: remove hardcoded Asia/Shanghai timezone from container images#6126
RongGu merged 2 commits into
fluid-cloudnative:masterfrom
cheyang:fix/remove-hardcoded-shanghai-timezone

Conversation

@cheyang

@cheyang cheyang commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Container images currently force the Asia/Shanghai timezone in every Dockerfile:

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone

This makes all container logs and timestamps default to CST (UTC+8) regardless of where the cluster actually runs, which is surprising for operators outside China and diverges from the container convention of defaulting to UTC.

This PR removes the hardcoded timezone binding from all 12 Dockerfiles so images default to UTC. The tzdata package remains installed, so operators who want a specific timezone can still set it via the TZ environment variable (e.g. TZ=Asia/Shanghai) on the container/pod.

Files changed

All docker/Dockerfile.* images:

  • alluxioruntime, application, cacheruntime, crds, csi, dataset, efcruntime, jindoruntime, juicefsruntime, thinruntime, vineyardruntime, webhook

Downstream behavior impact

This is a behavior change for anyone who currently relies on the implicit CST timezone baked into the images. After this PR, the container-local time shifts from CST (UTC+8) to UTC unless TZ is set. Concretely:

  • Log timestamps — Any log lines that render wall-clock time inside the container (controllers, CSI plugin, webhook, and the runtime/dataset images) will print UTC instead of CST. Log lines already emitted in UTC (Go's klog defaults to UTC) are unaffected; only components that read /etc/localtime shift by 8 hours.
  • Timestamps in files / toolingdate output, shell scripts, and any tzdata-consuming tool inside the containers (e.g. the crd-upgrade script, entrypoint/mount scripts in the CSI image) now report UTC.
  • Time-derived filenames or paths — If any downstream process names files/directories by local date, the rollover moment moves 8 hours earlier (a file that previously rolled at CST midnight now rolls at UTC midnight).
  • No API / CRD / scheduling impact — Kubernetes metav1.Time and event timestamps are already UTC and are unchanged. CronDataload / cache scheduling semantics are unaffected, since those are evaluated by the Kubernetes control plane, not by the container's local clock.

Migration for users who need CST

No image rebuild required — set TZ on the pod/container:

env:
  - name: TZ
    value: Asia/Shanghai

For Helm-deployed components this can be added via the chart's env/extraEnv values (or a pod mutation), so existing CST behavior is fully recoverable without code changes.

How to set a timezone now (optional)

env:
  - name: TZ
    value: Asia/Shanghai

Test

No functional code change; only removes region-specific timezone configuration from image build. tzdata is still present so TZ overrides continue to work.

Container images should not force a region-specific timezone. Hardcoding
Asia/Shanghai makes all logs and timestamps default to CST regardless of
where the cluster runs, which is surprising for operators outside China
and diverges from the container convention of UTC.

Drop the localtime/timezone binding from all Dockerfiles so images default
to UTC. The tzdata package is still installed, so operators can set their
own timezone via the TZ environment variable when needed.

Signed-off-by: cheyang <cheyang.cy@alibaba-inc.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the hardcoded timezone configuration (setting the timezone to 'Asia/Shanghai') from multiple Dockerfiles, including those for various runtimes, CSI, CRDs, and webhooks. This allows the container images to use the default system timezone or be configured dynamically. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the hardcoded Asia/Shanghai timezone configuration from all container image Dockerfiles so the images follow the common convention of defaulting to UTC, while still installing tzdata for optional TZ overrides at runtime.

Changes:

  • Removed cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime and echo "Asia/Shanghai" > /etc/timezone from all image Dockerfiles.
  • Kept tzdata installation so operators can set TZ via container/pod environment.
  • Simplified each affected RUN apk add ... block to only clear the apk cache after install.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docker/Dockerfile.alluxioruntime Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.application Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.cacheruntime Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.crds Removes hardcoded Asia/Shanghai timezone setup so job defaults to UTC.
docker/Dockerfile.csi Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.dataset Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.efcruntime Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.jindoruntime Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.juicefsruntime Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.thinruntime Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.vineyardruntime Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC.
docker/Dockerfile.webhook Removes hardcoded Asia/Shanghai timezone setup so webhook image defaults to UTC.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker/Dockerfile.webhook
Comment on lines 16 to +17
RUN apk add --update bash curl iproute2 libc6-compat tzdata vim && \
rm -rf /var/cache/apk/* && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
rm -rf /var/cache/apk/*

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — on the flagged line (RUN apk add ... && \), the two spaces sit between && and \, and the backslash is still the last character on the line, so the continuation is valid (these images have always built fine).

That said, the check pointed me at a real latent issue a few lines down: chmod -R u+w /etc/k8s-webhook-server/certs && \ had a trailing space after the backslash, which escapes the space instead of the newline. Fixed that in 1b55b1e.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.08%. Comparing base (5404a94) to head (1b55b1e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6126   +/-   ##
=======================================
  Coverage   65.08%   65.08%           
=======================================
  Files         485      485           
  Lines       33989    33989           
=======================================
  Hits        22122    22122           
  Misses      10126    10126           
  Partials     1741     1741           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

….webhook

The backslash on the chmod line had a trailing space, so it escaped the
space instead of the newline. Strip it so the line continuation is
unambiguous.

Signed-off-by: cheyang <cheyang.cy@alibaba-inc.com>
@sonarqubecloud

Copy link
Copy Markdown

@cheyang

cheyang commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

/copilot review

@cheyang

cheyang commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

@gemini-code-assist /review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the timezone configuration that set the local time to 'Asia/Shanghai' across multiple Dockerfiles, including various runtime, application, CSI, CRD, and webhook Dockerfiles. It also cleans up a trailing whitespace in Dockerfile.webhook. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@RongGu RongGu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@fluid-e2e-bot

fluid-e2e-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RongGu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@RongGu
RongGu merged commit c5a5e09 into fluid-cloudnative:master Jul 16, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants