feat: GraphQL support for suspend/resume environment#362
Conversation
Reviewer's Guide by SourceryThis pull request adds GraphQL support for suspending and resuming environments in the Kloudlite console application. The changes include updates to the GraphQL schema, resolver implementations, and related domain logic. File-Level Changes
Tips
|
There was a problem hiding this comment.
Hey @nxtcoder17 - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
| return errors.Newf("no service binding found") | ||
| } | ||
|
|
||
| if svcb.Spec.Hostname == "" { |
There was a problem hiding this comment.
suggestion (bug_risk): Consider adding a nil check for svcb.Spec before accessing Hostname
To prevent potential nil pointer dereferences, it's advisable to check if svcb.Spec is not nil before accessing its fields.
| if svcb.Spec.Hostname == "" { | |
| if svcb.Spec == nil || svcb.Spec.Hostname == "" { | |
| return nil | |
| } |
| sp := strings.SplitN(strings.ToLower(question.Name), fmt.Sprintf(".%s", h.kloudliteDNSSuffix), 2) | ||
| if len(sp) < 2 { | ||
| return nil, fmt.Errorf("failed to split into 2 over .%s", h.kloudliteDNSSuffix) | ||
| return nil, errInvalidDNSQuery |
There was a problem hiding this comment.
suggestion: Consider including context in the error message for easier debugging
While using a predefined error is good, including some context (like the problematic domain) in the error message could aid in debugging complex issues.
| return nil, errInvalidDNSQuery | |
| return nil, fmt.Errorf("%w: invalid query for domain %q", errInvalidDNSQuery, question.Name) |
33b042b to
054e01f
Compare
Resolves kloudlite/kloudlite#280
Summary by Sourcery
Introduce GraphQL support for suspending and resuming environments by adding a 'suspend' field to the EnvironmentSpec. Improve error handling in the DNS server and enhance service binding message handling. Refactor gRPC server code to remove unnecessary logging.
New Features:
Bug Fixes:
Enhancements: