Skip to content

Normalize GKE workload createTime to RFC 3339 before sending to control plane#1

Open
lokic233 wants to merge 1 commit into
AI-Hypercomputer:mainfrom
lokic233:fix/libtpu-reimport-abort-and-createtime
Open

Normalize GKE workload createTime to RFC 3339 before sending to control plane#1
lokic233 wants to merge 1 commit into
AI-Hypercomputer:mainfrom
lokic233:fix/libtpu-reimport-abort-and-createtime

Conversation

@lokic233

Copy link
Copy Markdown

Problem

machinelearning_run() forwards workload_details["creation-timestamp"] verbatim into gke_workload_details["createTime"] (clients/control_plane_client.py), which the control plane validates as a google.protobuf.Timestamp. When the injected GKE_DIAGON_METADATA creation-timestamp is not strict RFC 3339, the create request fails:

HTTP 400 INVALID_ARGUMENT
field: machine_learning_run.workload_details.gke.create_time
description: "Illegal timestamp format; timestamps must end with 'Z' or have a valid timezone offset."

This blocks MLRun creation entirely.

Notably, the SDK's own host_utils.get_identifier formats timestamps as "%Y%m%d-%H%M%S" (no Z), so the verbatim pass-through is a latent issue even for the SDK's intended inputs — not only custom injectors.

Fix

Add a best-effort _normalize_rfc3339() helper and apply it at the createTime assignment. Timestamps lacking a Z/offset are normalized to UTC RFC 3339; unparseable values pass through unchanged (the control plane still validates).

Verification

Reproduced on google-cloud-mldiagnostics 1.0.2/1.0.3, GKE TPU (tpu7x), single-controller Pathways: the 400 cleared once createTime was RFC 3339, and the MLRun was created (ACTIVE). Helper unit-checked across inputs:

input output
20260619-174719 (the SDK's own %Y%m%d-%H%M%S) 2026-06-19T17:47:19.000Z
2026-06-20T01:31:33Z 2026-06-20T01:31:33.000Z
2026-06-20T01:31:33+00:00 2026-06-20T01:31:33.000Z
2026-06-20 01:31:33 2026-06-20T01:31:33.000Z
"" ""

Note: I see CONTRIBUTING.md states external code contributions aren't currently accepted — opening this anyway as a concrete, ready-to-cherry-pick fix to accompany the issue. Happy to close if you'd prefer to land it internally.

— Reported and authored via Navi on behalf of @lokic233 (Meta MRS-CE).

…ol plane

machinelearning_run() forwards workload_details["creation-timestamp"] verbatim
into gke_workload_details["createTime"], which the control plane validates as a
google.protobuf.Timestamp. If the injected GKE_DIAGON_METADATA creation-timestamp
is not strict RFC 3339, the create request fails with HTTP 400 INVALID_ARGUMENT:
"Illegal timestamp format; timestamps must end with 'Z' or have a valid timezone
offset." This blocks MLRun creation.

Add a best-effort _normalize_rfc3339() helper and apply it at the createTime
assignment, so timestamps lacking a 'Z'/offset are normalized to UTC RFC 3339.
Unparseable values pass through unchanged (the control plane still validates).

Reproduced on google-cloud-mldiagnostics 1.0.2/1.0.3, GKE TPU, single-controller
Pathways: the 400 cleared once createTime was RFC 3339, and the MLRun was created.

Note: the SDK's own host_utils.get_identifier formats timestamps as
"%Y%m%d-%H%M%S" (no 'Z'), so the verbatim pass-through is a latent issue even for
the SDK's intended inputs.

Reported and authored via Navi on behalf of @lokic233 (dengcchi, Meta MRS-CE).
@google-cla

google-cla Bot commented Jun 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@lokic233

Copy link
Copy Markdown
Author

Addresses #2. — via Navi on behalf of @lokic233

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