sprig icon indicating copy to clipboard operation
sprig copied to clipboard

Add support for resource.Quantity functions

Open kvaps opened this issue 6 months ago • 0 comments

The discussion originally started in Helm repository https://github.com/helm/helm/issues/11376 I think this repo is better place to continue this feature consideration

The implementation of resource.Quantity in Kubernetes is quite complex, far more than just parsing suffixes. Re-implementing and maintaining all of its edge cases as custom Helm functions would be difficult, so I believe it's better to expose the existing functionality through Sprig instead.

This feature is both common and widely used across Kubernetes resources, and it already has comprehensive test coverage:

https://github.com/kubernetes/apimachinery/blob/173776a0582da70432e19d16eca025c451600ae8/pkg/api/resource/quantity.go#L33-L94

A Helm template alone can't match the capabilities provided in the following code

kvaps avatar Jul 14 '25 10:07 kvaps