Skip to content
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

feat(sdk): add qos limits capability to cloudian sdk #122

Closed
wants to merge 2 commits into from

Conversation

mariatsji
Copy link
Contributor

Create QoS limits for a User

Feature-completeness (GET and DELETE) is TODO

@mariatsji mariatsji requested a review from tenstad January 20, 2025 14:23
Comment on lines +438 to +441
"hlStorageQuotaCount": fmt.Sprintf("%d", qos.StorageQuotaCount),
"wlStorageQuotaCount": fmt.Sprintf("%d", qos.StorageQuotaCountWarning),
"hlRequestRate": fmt.Sprintf("%d", qos.RequestRatePrMin),
"wlRequestRate": fmt.Sprintf("%d", qos.RequestRatePrMinWarning),
Copy link
Member

@tenstad tenstad Jan 20, 2025

Choose a reason for hiding this comment

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

More readable to just use strconv.Itoa for these?

)

// Construct by e.g. 3 * TB
type ByteSize uint64
Copy link
Member

@erikgb erikgb Jan 20, 2025

Choose a reason for hiding this comment

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

I don't think we need this custom type in the SDK. To provide better usability, we could use https://pkg.go.dev/k8s.io/apimachinery/pkg/util/intstr#IntOrString in the provider API (Crossplane).

Or https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity

DataRatePrMinOutbound ByteSize
// Warning limit outbound datarate in ByteSize per minute
DataRatePrMinOutboundWarning ByteSize
}
Copy link
Member

Choose a reason for hiding this comment

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

Can't you use the same approach as Kubernetes uses - with a map?

image

image

// Warning limit storage quota
StorageQuotaWarning ByteSize
// Max storage quota in number of objects
StorageQuotaCount uint64
Copy link
Member

Choose a reason for hiding this comment

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

To disable the limits, we need to support -1

Suggested change
StorageQuotaCount uint64
StorageQuotaCount int64

Copy link
Member

Choose a reason for hiding this comment

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

Could also make them pointer and transform nil to -1 and positive values to strings. Zero value would then be "unlimited", which is kinda nice

// Max outbound datarate in ByteSize per minute
DataRatePrMinOutbound ByteSize
// Warning limit outbound datarate in ByteSize per minute
DataRatePrMinOutboundWarning ByteSize
Copy link
Member

@tenstad tenstad Jan 20, 2025

Choose a reason for hiding this comment

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

It's long already, I think we can allow the e in Per

Suggested change
DataRatePrMinOutboundWarning ByteSize
DataRatePerMinOutboundWarning ByteSize

And maybe start with Outbound to make it more readable sentence rather than a postfix?

Suggested change
DataRatePrMinOutboundWarning ByteSize
OutboundDataRatePerMinWarning ByteSize

@tenstad
Copy link
Member

tenstad commented Jan 30, 2025

The starting point of what was finished in #124

@tenstad tenstad closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants