Skip to content

[Bug]fix openai api violation for accelerator crd#242

Merged
slin1237 merged 1 commit into
mainfrom
yifeliu/accelerator_crd_update
Aug 15, 2025
Merged

[Bug]fix openai api violation for accelerator crd#242
slin1237 merged 1 commit into
mainfrom
yifeliu/accelerator_crd_update

Conversation

@pallasathena92
Copy link
Copy Markdown
Collaborator

What type of PR is this?

/kind bug

What this PR does / why we need it:

  1. Fix "omitempty doesn’t work for non-pointer nested structs like Spec, Status, resource.Quantity, and metav1.Time", modifies some files
  2. Fix openai api rule violation

Does this PR introduce a user-facing change?

None

@github-actions github-actions Bot added the bug Something isn't working label Aug 15, 2025
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Summary of Changes

Hello @pallasathena92, 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 addresses critical bug fixes and improvements related to Kubernetes Custom Resource Definitions (CRDs). The primary goal is to resolve issues where certain fields within CRDs were not being correctly handled by the Kubernetes API server due to misconfigurations with 'omitempty' JSON tags and list type definitions. By explicitly marking required fields and specifying list behaviors, the changes ensure proper API validation and resource management. Additionally, the PR includes code style refinements and significant dependency updates, contributing to overall system stability and compliance.

Highlights

  • CRD OmitEmpty Bug Fix: Resolved a bug where 'omitempty' JSON tags were causing issues with non-pointer nested structs (like Spec and Status) in Custom Resource Definitions (CRDs), ensuring these fields are always correctly marshaled and validated.
  • Kubernetes List Type Validation: Introduced 'x-kubernetes-list-type: atomic' to various array definitions within CRD YAMLs, which is crucial for the Kubernetes API server to correctly handle and validate lists, preventing unexpected behavior.
  • Accelerator Resource Definition Enhancement: Updated the AcceleratorResource definition to explicitly require the 'quantity' field and removed its 'omitempty' tag, ensuring that accelerator resource quantities are always specified.
  • Code Style and Naming Consistency: Refactored performance-related fields within the AcceleratorPerformance struct to adhere to standard camelCase naming conventions, improving code readability and consistency.
  • Dependency Updates and API Compliance: Performed a comprehensive update of Go module dependencies, which likely contributes to resolving the reported OpenAI API rule violation and generally improves the project's dependency health.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link
Copy Markdown
Contributor

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

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 addresses two main issues: fixing omitempty behavior for non-pointer nested structs in CRDs and correcting an 'OpenAI API rule violation', which appears to be related to Go struct field naming conventions. The changes to the CRD YAML files and Go type definitions are consistent and correct, making fields required where omitempty was not working as expected and improving code style. However, the update to go.sum introduces a very large number of new dependencies from various cloud providers and other sources. This significantly expands the project's dependency tree and attack surface, and it's not clear from the pull request description why these are necessary. This should be addressed before merging.

Comment thread go.sum Outdated
Comment thread pkg/apis/ome/v1beta1/accelerator_class.go
slin1237
slin1237 previously approved these changes Aug 15, 2025
@YouNeedCryDear
Copy link
Copy Markdown
Collaborator

@pallasathena92 Why are we removing those "omitempty" from inference service and benchmark job?

@pallasathena92
Copy link
Copy Markdown
Collaborator Author

pallasathena92 commented Aug 15, 2025

@pallasathena92 Why are we removing those "omitempty" from inference service and benchmark job?

Fix "omitempty doesn’t work for non-pointer nested structs like Spec, Status, resource.Quantity, and metav1.Time", modifies some files
Any concern for this?

@pallasathena92 pallasathena92 force-pushed the yifeliu/accelerator_crd_update branch from 4d77815 to e440912 Compare August 15, 2025 06:40
@slin1237 slin1237 merged commit 5273007 into main Aug 15, 2025
24 checks passed
@slin1237 slin1237 deleted the yifeliu/accelerator_crd_update branch September 6, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants