-
Notifications
You must be signed in to change notification settings - Fork 31
add readinessProbe #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary of ChangesHello @LeslieKuo, 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 significantly enhances the reliability and operational readiness of sandboxes by integrating Kubernetes-style readiness probes. It allows for flexible definition of custom readiness checks and ensures that sandboxes are not considered available until their underlying Pods and Services are fully functional. This change directly addresses an existing issue related to sandbox initialization and readiness, improving the overall stability of the system. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 introduces support for readinessProbe in sandbox creation, which is a valuable addition for ensuring services are ready to accept traffic. The implementation looks mostly correct, but I've found a couple of critical compilation errors due to an undefined variable and a missing import. I've also suggested an improvement to logging consistency and adding validation for the new probe configuration. Additionally, there's a minor formatting issue to address.
pkg/workloadmanager/handlers.go
Outdated
| sandbox, externalInfo, err = buildSandboxByAgentRuntime(createAgentRequest.Namespace, createAgentRequest.Name, s.informers, createAgentRequest.ReadinessProbe) | ||
| case types.CodeInterpreterKind: | ||
| sandbox, sandboxClaim, externalInfo, err = buildSandboxByCodeInterpreter(sandboxReq.Namespace, sandboxReq.Name, s.informers) | ||
| sandbox, sandboxClaim, externalInfo, err = buildSandboxByCodeInterpreter(createAgentRequest.Namespace, createAgentRequest.Name, s.informers, createAgentRequest.ReadinessProbe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable createAgentRequest is used here but it's not defined in this scope. This seems to be a copy-paste error and will cause a compilation failure. You should use sandboxReq instead.
| sandbox, externalInfo, err = buildSandboxByAgentRuntime(createAgentRequest.Namespace, createAgentRequest.Name, s.informers, createAgentRequest.ReadinessProbe) | |
| case types.CodeInterpreterKind: | |
| sandbox, sandboxClaim, externalInfo, err = buildSandboxByCodeInterpreter(sandboxReq.Namespace, sandboxReq.Name, s.informers) | |
| sandbox, sandboxClaim, externalInfo, err = buildSandboxByCodeInterpreter(createAgentRequest.Namespace, createAgentRequest.Name, s.informers, createAgentRequest.ReadinessProbe) | |
| sandbox, externalInfo, err = buildSandboxByAgentRuntime(sandboxReq.Namespace, sandboxReq.Name, s.informers, sandboxReq.ReadinessProbe) | |
| case types.CodeInterpreterKind: | |
| sandbox, sandboxClaim, externalInfo, err = buildSandboxByCodeInterpreter(sandboxReq.Namespace, sandboxReq.Name, s.informers, sandboxReq.ReadinessProbe) |
pkg/workloadmanager/handlers.go
Outdated
| } | ||
|
|
||
| if err := s.k8sClient.WaitForSandboxDependenciesReady(c.Request.Context(), namespace, sandboxName, sandboxReadinessTimeout); err != nil { | ||
| log.Printf("sandbox %s/%s dependencies not ready: %v", namespace, sandboxName, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log package is not imported, and this call to log.Printf will cause a compilation error. To maintain consistency with the logging framework used in this file, please use klog.Errorf instead.
| log.Printf("sandbox %s/%s dependencies not ready: %v", namespace, sandboxName, err) | |
| klog.Errorf("sandbox %s/%s dependencies not ready: %v", namespace, sandboxName, err) |
| @@ -61,4 +90,4 @@ func (car *CreateSandboxRequest) Validate() error { | |||
| return fmt.Errorf("name is required") | |||
| } | |||
| return nil | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/workloadmanager/handlers.go
Outdated
| sandboxReq.Kind = types.CodeInterpreterKind | ||
| default: | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Metadata map[string]string `json:"metadata"` | ||
| PublicKey string `json:"publicKey,omitempty"` | ||
| InitTimeoutSeconds int `json:"initTimeoutSeconds,omitempty"` | ||
| ReadinessProbe *ReadinessProbe `json:"readinessProbe,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we donot need to pass thie probe config in the request body, the probe config is already in the pod spec.
For code interpreter, i think we may need to add a new api field in the spec to indicate the probe
| return | ||
| } | ||
|
|
||
| if err := s.k8sClient.WaitForSandboxDependenciesReady(c.Request.Context(), namespace, sandboxName, sandboxReadinessTimeout); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just check IsSandboxReady, and return after ready
fix issue #64