gtsystem / lightkube

Modern lightweight kubernetes module for python
https://lightkube.readthedocs.io
MIT License
96 stars 11 forks source link

Add function to parse quantity #37

Closed sed-i closed 1 year ago

sed-i commented 2 years ago

This PR add a utility function for parsing K8s "quantity" from string. The value is parsed into an absolute (unitless) decimal.Decimal instance, and not into the K8s "canonical representation". This way the code is simpler and values are readily comparable.

References:

  1. https://github.com/kubernetes-client/python/blob/master/kubernetes/utils/quantity.py
  2. https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go

Fixes #36.

sed-i commented 2 years ago

Thanks @gtsystem! Ready for re-review.

gtsystem commented 1 year ago

Approved and merged. We have another contribution in progress, once that is completed I will create a public release. Thanks again.