-
Notifications
You must be signed in to change notification settings - Fork 10
support custom lease name request #198
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
Conversation
This could be useful for processes where the lease name across different components Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
📝 WalkthroughWalkthroughThe CreateLease implementation now uses the provided Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/service/client/v1/client_service.go (1)
177-185: Consider validating custom lease names upfront.The implementation correctly allows custom lease names via
req.LeaseId. However, Kubernetes resource names must follow DNS subdomain format (lowercase alphanumeric, '-', '.', max 253 chars). While Kubernetes will reject invalid names ats.Create(), validating upfront would provide clearer, earlier feedback to clients.Example validation
// Use provided lease_id if specified, otherwise generate a UUIDv7 name := req.LeaseId if name == "" { id, err := uuid.NewV7() if err != nil { return nil, err } name = id.String() + } else { + // Validate custom lease name format + if err := validation.IsDNS1123Subdomain(name); len(err) > 0 { + return nil, fmt.Errorf("invalid lease name: %v", err) + } }Import required:
"k8s.io/apimachinery/pkg/util/validation"
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
internal/service/client/v1/client_service.go
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-03-12T13:58:24.065Z
Learnt from: NickCao
Repo: jumpstarter-dev/jumpstarter-controller PR: 115
File: internal/service/controller_service.go:740-775
Timestamp: 2025-03-12T13:58:24.065Z
Learning: Clients are allowed to see each other's leases in the Jumpstarter controller. The ListLeases function intentionally does not filter by client ownership.
Applied to files:
internal/service/client/v1/client_service.go
🧬 Code graph analysis (1)
internal/service/client/v1/client_service.go (2)
api/v1alpha1/lease_helpers.go (1)
LeaseFromProtobuf(76-115)api/v1alpha1/lease_types.go (1)
Lease(80-86)
🔇 Additional comments (1)
internal/service/client/v1/client_service.go (1)
189-189: LGTM! Correct use of the name variable.The name variable (whether custom or generated) is correctly passed to
LeaseFromProtobufto construct the lease object.
This could be useful for processes where the lease name across different components
needs supports in jumpstarter
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.