Skip to content

feat(job): add job inspect command for easy diagnostics#5925

Open
Neelabh94 wants to merge 10 commits into
GoogleCloudPlatform:developfrom
Neelabh94:gcluster_inspector
Open

feat(job): add job inspect command for easy diagnostics#5925
Neelabh94 wants to merge 10 commits into
GoogleCloudPlatform:developfrom
Neelabh94:gcluster_inspector

Conversation

@Neelabh94

@Neelabh94 Neelabh94 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a diagnostic tool for GKE clusters, allowing users to quickly capture cluster state, node health, and workload configurations. The new command, gcluster job inspect, generates a timestamped log file and provides optional console output, significantly simplifying the troubleshooting process for scheduling delays or resource exhaustion issues.

Changes

  • New 'inspect' command: Added a new gcluster job inspect command to perform comprehensive diagnostic sweeps of GKE clusters and workloads.
  • Diagnostic logging: Implemented automated log generation that captures cluster infrastructure, node status, Kueue/JobSet configurations, and relevant console links.
  • Orchestrator interface update: Updated the JobOrchestrator interface to include InspectCluster and added necessary InspectOptions.
  • Documentation: Updated the job guide to include instructions and examples for using the new inspection tool.

@Neelabh94 Neelabh94 self-assigned this Jul 9, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a diagnostic tool for GKE clusters, allowing users to quickly capture cluster state, node health, and workload configurations. The new command, gcluster job inspect, generates a timestamped log file and provides optional console output, significantly simplifying the troubleshooting process for scheduling delays or resource exhaustion issues.

Highlights

  • New 'inspect' command: Added a new gcluster job inspect command to perform comprehensive diagnostic sweeps of GKE clusters and workloads.
  • Diagnostic logging: Implemented automated log generation that captures cluster infrastructure, node status, Kueue/JobSet configurations, and relevant console links.
  • Orchestrator interface update: Updated the JobOrchestrator interface to include InspectCluster and added necessary InspectOptions.
  • Documentation: Updated the job guide to include instructions and examples for using the new inspection tool.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Neelabh94 Neelabh94 added the release-key-new-features Added to release notes under the "Key New Features" heading. label Jul 9, 2026

@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 introduces a new inspect command to the gcluster job CLI, enabling comprehensive diagnostic sweeps of GKE clusters and active workloads, with output saved to a timestamped log file. The reviewer's feedback focuses on improving robustness: first, by explicitly specifying the -c manager container when retrieving Kueue and JobSet controller manager logs to prevent potential BadRequest errors; and second, by utilizing t.Cleanup in unit tests to ensure reliable cleanup of generated log files and avoid test flakiness.

Comment thread pkg/orchestrator/gke/inspector.go Outdated
Comment thread pkg/orchestrator/gke/inspector_test.go
Comment thread pkg/orchestrator/gke/inspector_test.go Outdated
Comment thread pkg/orchestrator/gke/inspector_test.go
Comment thread pkg/orchestrator/gke/inspector_test.go Outdated
@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new inspect command to the gcluster job CLI, allowing users to perform diagnostic sweeps of GKE cluster health and workload status. It implements the backend logic in the GKE orchestrator to run various gcloud and kubectl commands, saving the results to a timestamped log file, and adds corresponding unit tests and documentation. The reviewer suggested explicitly specifying the default namespace when retrieving cluster metadata and resource ConfigMaps to prevent failures if the active kubeconfig context is set to a different namespace.

Comment thread pkg/orchestrator/gke/inspector.go Outdated
@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new inspect command (gcluster job inspect) to perform diagnostic sweeps of GKE clusters and active workloads, generating a comprehensive log file. It includes the command implementation, documentation, orchestrator logic, and unit tests. The review feedback highlights an issue where the dynamically resolved workload namespace is not passed to the console link generator, resulting in broken links for workloads deployed in non-default namespaces.

Comment thread pkg/orchestrator/gke/inspector.go Outdated
Comment thread pkg/orchestrator/gke/inspector.go Outdated
Comment thread pkg/orchestrator/gke/inspector.go
@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new 'inspect' command to the 'gcluster job' CLI, allowing users to perform diagnostic sweeps of GKE clusters and workload health. It adds the 'InspectCluster' method to the GKE orchestrator, which runs various 'gcloud' and 'kubectl' commands, logs the results to a file, analyzes node health, and provides links to the Google Cloud Console. The review feedback highlights an issue with the generated workload console link, which incorrectly uses the '/kubernetes/service/' path instead of '/kubernetes/workload/details/', potentially leading to a 404 error.

Comment thread pkg/orchestrator/gke/inspector.go
@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new inspect subcommand to gcluster job for performing diagnostic sweeps of GKE clusters and active workloads, writing the output to a timestamped log file. The changes include the CLI command implementation, orchestrator integration, comprehensive unit tests, and updated documentation. Feedback on the implementation highlights a bug where g.kubeClient is not initialized during cluster inspection, which causes namespace auto-discovery to always fail and default to 'default'; utilizing the existing g.getJobNamespace helper is recommended to resolve this.

Comment thread pkg/orchestrator/gke/inspector.go Outdated
@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new inspect command to the gcluster job CLI, enabling diagnostic sweeps of GKE clusters and workloads. The changes include the CLI command registration, documentation in gcluster_job_guide.md, the core inspection logic in pkg/orchestrator/gke/inspector.go (which collects gcloud/kubectl outputs, analyzes node counts, and generates console links), and corresponding unit tests. As there are no review comments provided, I have no feedback to address.

@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new gcluster job inspect command to perform diagnostic sweeps of GKE clusters and workloads, saving the results to a timestamped log file. The feedback points out that Kueue workload names generated by the JobSet controller include a random suffix, meaning a direct query for jobset-%s will fail with a NotFound error. It is recommended to use the existing findTargetWorkload helper to resolve the correct workload name.

Comment thread pkg/orchestrator/gke/inspector.go Outdated
@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new inspect command to the gcluster job CLI, allowing users to perform diagnostic sweeps of GKE clusters and workloads. It includes the CLI command definition, documentation, unit tests, and the core implementation that runs various gcloud and kubectl commands to output cluster state to a timestamped log file. The reviewer's feedback recommends using UTC instead of local time for the diagnostic log filename to ensure consistency with standard cloud logs.

Comment thread pkg/orchestrator/gke/inspector.go Outdated
@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini 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 introduces a new 'inspect' command to the 'gcluster job' CLI tool, allowing users to perform diagnostic sweeps of GKE clusters and active workloads. The changes include the implementation of the command-line interface, core diagnostic logic in the GKE orchestrator (such as collecting cluster details, node status, Kueue/JobSet configurations, and console links), comprehensive unit tests, and updated documentation in the job guide. There are no review comments, and I have no feedback to provide.

@Neelabh94

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@Neelabh94 Neelabh94 marked this pull request as ready for review July 9, 2026 12:36
@Neelabh94 Neelabh94 requested a review from a team as a code owner July 9, 2026 12:36
```

The tool will create a timestamped log file `gcluster-inspect-<cluster>-<timestamp>.log` in your current working directory containing:

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.

Shall we include a sample screenshot of the log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-key-new-features Added to release notes under the "Key New Features" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants