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

Label Data Typing #19081

Closed
cameronbrunner opened this issue Dec 24, 2015 · 11 comments
Closed

Label Data Typing #19081

cameronbrunner opened this issue Dec 24, 2015 · 11 comments
Labels
area/api Indicates an issue on api area. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@cameronbrunner
Copy link
Contributor

@davidopp

There needs to be a method to specify the data type of a label when it is something other than a string. In #18261 strings can be interpreted as integers but there is no way to represent a values that are natively numbers as numbers throughout Kubernetes. Kubernetes should additionally support float, boolean, and integer labels. The additional datatypes are most useful when integrating with third party schedulers, reporting, and monitoring solutions allowing for a consistent and accurate representation of the values in all systems.

@davidopp davidopp added team/control-plane priority/backlog Higher priority than priority/awaiting-more-evidence. labels Dec 24, 2015
@resouer
Copy link
Contributor

resouer commented Dec 25, 2015

This is interesting. Is it possible for you to give some explicit examples of this use case here?

@davidopp
Copy link
Member

In the worst case we can encode the type in the label name (for example, num_cores implies an integer, is_foo implies a boolean, etc.), in addition to using the operator to imply the type. I agree this requires some kind of schema (though perhaps it could be hardcoded), unlike if you had explicit types. As for float, do we want to encourage people to use it? So far we've been using things like millicores to represent as integers. Floats are always a mess to deal with and life is simpler if we can avoid them.

@cameronbrunner
Copy link
Contributor Author

With well defined built in resources we could probably avoid the need for floats like you did for cores by defining a minimum increment and then scaling appropriately. I imagine that this could get cumbersome when kubernetes adds full support for custom resources where things could have many significant digits and scaling to an integer value could yield an awkward value. Once again this would be seen in something like a reporting interface that has to potentially display these values in a user friendly way. An example here would be standard system load... we would have to say that we round to 100ths and then multiply by 100 and call it centiload. If someone wants more resolution, lets say to the 1000ths then we would have milliload.

Thinking a bit more about it perhaps the encoding for numerical fields should include the scale factor... so instead of just 'num_' we could additionally have 'centi_', 'milli_', 'micro_', etc. when encoding numbers that have been scaled. This could significantly reduce the need for a floating point data type.

@davidopp
Copy link
Member

davidopp commented Jan 9, 2016

Thinking a bit more about it perhaps the encoding for numerical fields should include the scale factor... so instead of just 'num_' we could additionally have 'centi_', 'milli_', 'micro_', etc. when encoding numbers that have been scaled. This could significantly reduce the need for a floating point data type.

Label keys are namespaced and can be set by users. I guess a namespace could by convention choose keys with the syntax you're describing. We could say the labels published by kubernetes.io/ follow the convention, and the labels published using the mechanism in #19082 would be in kubernetes.io/

@bgrant0607 bgrant0607 added team/api area/api Indicates an issue on api area. labels Feb 3, 2016
@bgrant0607
Copy link
Member

@bgrant0607 bgrant0607 added priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. and removed priority/backlog Higher priority than priority/awaiting-more-evidence. labels Feb 11, 2016
@bgrant0607
Copy link
Member

Why is this important?

@cameronbrunner
Copy link
Contributor Author

The primary reason for having a method of data typing is to allow for third party tools reporting and monitoring tools to better insight into the meaning of the data that is made available. Currently in Kubernetes CPU and Memory are typed and have their own suffix's for managing scale. Since everyone know the types its very easy to make tools that consume these metrics.

In the near term we will be adding domain scoped labels to pods that have special meaning to our add-on scheduler and eventually we will have a reporting tool that consumes these labels. It would be great if other tools could see and the labels and it would be great if our reporting tool could work with labels other system components might set.

I am definitely agree with no floats as long we can provide a general scaling suffix scheme for encoding numbers into strings.

@davidopp
Copy link
Member

As we've discussed a workaround is just to adopt a convention of having a portion of the key name specify the type.

@k8s-github-robot k8s-github-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label May 31, 2017
@0xmichalis
Copy link
Contributor

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jun 11, 2017
@k8s-github-robot k8s-github-robot removed the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jun 11, 2017
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 27, 2017
@bgrant0607
Copy link
Member

I think this is addressed by resource extension:
kubernetes/community#782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

8 participants