Commit Graph

48 Commits (52b3ef6f9c0326b5df19fa041cea920a59e7c2f3)

Author SHA1 Message Date
Timothy St. Clair 24993b0343 Update generated files due to dependency shift.
Also minor bug fix in federation api.
2016-08-09 10:41:09 -05:00
Tim Hockin 57c3196914 Add support for manually defined DeepCopy methods
In bringing back Clayton's PR piece-by-piece this was almost as easy to
implement as his version, and is much more like what I think we should be
doing.

Specifically, any time which defines a .DeepCopy() method will have that method
called preferentially.  Otherwise we generate our own functions for
deep-copying.  This affected exactly one type - resource.Quantity.  In applying
this heuristic, several places in the generated code were simplified.

To achieve this I had to convert types.Type.Methods from a slice to a map,
which seems correct anyway (to do by-name lookups).
2016-07-07 16:49:46 -07:00
Tim Hockin e18b2f3a2e Revert Clayton's #26179 so I can recreate it
His PR cam during the middle of this development cycle, and it was easier to
burn it down and recreate it than try to patch it into an existing series and
re-test every assumption.  This behavior will be re-introduced in subsequent
commits.
2016-07-07 16:49:46 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
goltermann 218645b346 Fix several spelling errors in comments. 2016-06-17 10:41:18 -07:00
k8s-merge-robot 54b352ae3a Merge pull request #26907 from smarterclayton/tolerate_quantity
Automatic merge from submit-queue

Resource quantity must support leading and trailing whitespace in JSON for back-compat

For backwards compatibility reasons, we must continue to support leading or trailing whitespace on Quantity values when deserialized from JSON.  We must also support numbers serialized into yaml (`cpu: 1`) and JSON (`"cpu": 1`)

Fixes #26898
2016-06-08 16:16:41 -07:00
Clayton Coleman e1dc3ef933
Remove unused deep_copies 2016-06-06 17:18:22 -04:00
Clayton Coleman 0181ac61da
DeepCopy should only generate types in k8s.io/kubernetes
Also make generation more selective (require opt in) to prevent lots of
unnecessary generated deep copies.
2016-06-06 17:18:22 -04:00
Clayton Coleman 653ddbb01e
Tolerate YAML and JSON numbers
Both YAML and JSON can contain numbers
2016-06-06 17:14:50 -04:00
Clayton Coleman 2ed3246631
Resource quantity must support leading and trailing whitespace
For backwards compatibility reasons, we must continue to support leading
or trailing whitespace on Quantity values when deserialized from JSON.
2016-06-06 16:53:42 -04:00
k8s-merge-robot e6a02ac511 Merge pull request #26060 from jonboulle/asdf
Automatic merge from submit-queue

Fix quantity.CanonicalizeBytes docstring name
2016-05-29 03:07:03 -07:00
Clayton Coleman b1310216bf
Round should avoid clearing s, save a string
Instead of saving bytes, save a string, which makes String() faster
and does not unduly penalize marshal. During parse, save the string
if it is in canonical form.
2016-05-24 22:32:45 -04:00
Jonathan Boulle f05b5cf2c5 Fix quantity.CanonicalizeBytes docstring name 2016-05-23 12:17:06 +02:00
Clayton Coleman b2a01d4d94
Add an int64 quantity implementation
Provides fast transformations of int64 scaled values with overflow to
inf.Dec as needed. Attempts to reduce allocations and expensive
operations in the critical path.

Alters the public signature of Quantity to encourage more efficient use
2016-05-19 08:41:39 -04:00
saadali 666da0ccdc Run codegen and codecgen 2016-05-11 17:15:55 -07:00
saadali b83af3d481 Change "speter.net/go/exp/math/dec/inf" dependency
to "https://gopkg.in/inf.v0"
2016-05-11 17:01:28 -07:00
Clayton Coleman cb3a479ed7
Add quantity benchmarks 2016-05-05 18:06:19 -04:00
Clayton Coleman 99430cf5de
Strip side-effect imports from generated protobuf 2016-05-02 18:12:20 -04:00
Clayton Coleman 86fb71aba7 Generated deep copies for new proto types 2016-04-20 12:13:09 -04:00
Clayton Coleman e16a7f2421 Initial protobuf generated files 2016-04-20 12:13:05 -04:00
Clayton Coleman cea4c010a6 Strip the proto build guard 2016-04-20 12:12:29 -04:00
Wojciech Tyczynski e610c137c0 Regenerate auto-generated files 2016-03-17 09:30:02 +01:00
derekwaynecarr 2ad322f295 Add or subtract from zero should not lose format 2016-02-04 13:16:47 -05:00
Tim St. Clair 40e90886e6 Add micro- and nano- suffixes 2016-01-04 14:08:24 -08:00
Tim St. Clair b4116eb718 Handle `nil` Amount in resource.Quantity.{Add,Sub}
Treat `nil` Amount as 0 in `resource.Quantity.Add` and
`resource.Quantity.Sub`. Also, allow adding/subtracting resources with
different Formats (since Format has no effect on the underlying value).
2015-12-10 19:24:23 -08:00
Wojciech Tyczynski 029d906074 Merge pull request #18170 from xiang90/scale
api/resource: optimize scale function
2015-12-09 16:18:28 +01:00
Clayton Coleman 9fea762917 Add protobuf preparation objects, guarded by proto tag 2015-12-05 18:15:48 -05:00
Xiang Li cf82d6b004 resource: optimize scale function
The original scale function takes around 800ns/op with more
than 10 allocations. It significantly slow down scheduler
and other components that heavily relys on resource pkg.
For more information see #18126.

This pull request tries to optimize scale function. It takes
two approach:

1. when the value is small, only use normal math ops.
2. when the value is large, use math.Big with buffer pool.

The final result is:

BenchmarkScaledValueSmall-4	20000000	        66.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkScaledValueLarge-4	 2000000	       711 ns/op	      48 B/op	       1 allocs/op

I also run the scheduler benchmark again. It doubles the throughput of
scheduler for 1000 nodes case.
2015-12-03 17:00:13 -08:00
hurf 5cc909afe7 Remove type validation in resource.Quantity.Add
The type validation is unnecessary for add and will cause problem.
Type will always keep unchanged after new amount is added.
2015-09-22 21:07:31 +08:00
derekwaynecarr ea919f6d1e Fix precision handling in validating LimitRange 2015-09-09 15:52:29 -04:00
derekwaynecarr 2e76842eb7 Update resource quota for requests 2015-09-03 14:24:59 -04:00
Jian Huang c350d325e9 Solve Static Check Error 2015-08-19 13:38:56 +08:00
Janet Kuo 0ac6dba3f4 Make kubectl describe node include allocated resource 2015-08-10 13:25:59 -07:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
derekwaynecarr 6968a4e0df Improve quota describe output 2015-06-03 15:16:24 -04:00
Eric Paris 6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Joe Beda bbb4479166 Convert controller-manager to hyperkube. 2015-02-02 10:01:36 -08:00
Joe Beda dcd00c936e Move all kubernetes to posix flags 2015-01-15 09:12:19 -08:00
Daniel Smith 5767b41b28 make quantity flag work with pflag package 2015-01-14 15:16:53 -08:00
Daniel Smith cc04db13d6 fix overeager find-and-replace 2015-01-07 16:38:27 -08:00
Daniel Smith 2050131b9a ParseOrDie -> MustParse; stop returning pointer 2015-01-07 15:21:35 -08:00
Daniel Smith 35f54addca Update more packages, tests, binaries for quantity
make etcd registry pass test
fix kubelet config for quantity
fix openstack for quantity
fix controller for quantity
fix last tests for quantity
wire into binaries
fix controller manager
fix build for 32 bit systems
2015-01-07 15:21:35 -08:00
Daniel Smith cd58e49c78 remove 'i' and nasty rounding; test 2015-01-06 16:13:17 -08:00
Daniel Smith 2d2df5593c Add examples & clarify comments further 2015-01-06 15:18:22 -08:00
Daniel Smith b7b2ee34de add flag helper func 2015-01-05 17:35:41 -08:00
Daniel Smith 6c6cdac0e9 Add accessor functions; round-trip test 2015-01-05 17:35:41 -08:00
Daniel Smith 18b896645c Saturation + test, also test negative numbers 2015-01-05 17:20:38 -08:00
Daniel Smith 394c9452e7 Start numeric type for resources 2015-01-05 17:20:38 -08:00