Skip to content

format_quantity function missing to convert Decimal values in to K8s quantity string #2205

Closed
@rkschamer

Description

@rkschamer

What is the feature and why do you need it:

There is parse_quantity to convert a canonical K8s quantity into a Decimal value. However, an opposite function, like format_quantity is missing, making it hard to transform a Decimal into a K8s quantity.

My use case was that I needed to load the resource requirements of serval pods, finding the maximum value and setting it for all pods. Due to potentially different SI suffixes, I've used parse_quantity, however setting the resource requirements for all other Pods, requires me to convert back from a Decimal into a canonical K8s quantity.

Describe the solution you'd like to see:

So far, I've implemented the function in my project, but I think that might be something also others could benefit. For this reason, I'd like to open a pull request to contribute this function.

### Tasks

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions