Commit Graph

94 Commits

Author SHA1 Message Date
Andy Goldstein
71ec5ed81d
resourcequota: use contexual logging (#113315)
Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>
2023-02-14 07:19:31 -08:00
Andy Goldstein
a899441484
quota: add an update filter
Fix a TODO to plumb an update filter from above in the resource quota
monitor code that was handling update events for quota-able objects,
instead of hard-coding the logic in the resource quota monitor.

Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>
2022-07-08 18:39:55 -04:00
Wojciech Tyczyński
8a87681a39 Clean shutdown of resourcequota integration tests 2022-06-14 13:55:31 +02:00
Patrick Ohly
9eaa2dc554 avoid klog Info calls without verbosity
In the following code pattern, the log message will get logged with v=0 in JSON
output although conceptually it has a higher verbosity:

   if klog.V(5).Enabled() {
       klog.Info("hello world")
   }

Having the actual verbosity in the JSON output is relevant, for example for
filtering out only the important info messages. The solution is to use
klog.V(5).Info or something similar.

Whether the outer if is necessary at all depends on how complex the parameters
are. The return value of klog.V can be captured in a variable and be used
multiple times to avoid the overhead for that function call and to avoid
repeating the verbosity level.
2022-01-12 07:48:36 +01:00
Mike Dame
4960d0976a Wire contexts to Core controllers 2021-11-01 10:29:00 -04:00
Jordan Liggitt
81fa9855c1 Fix quota controller hotloop in integration tests 2021-10-06 11:34:32 -04:00
cici37
a91a2cdad6 Move informer_factory to staging 2020-10-29 12:20:33 -07:00
Tim Usner
70d440bc7e Move ResourceQuota admission to k8s.io/apiserver 2020-09-04 14:53:52 +02:00
Alexander Zimmermann
86dc0364f4
Refactored pkg/controllers/resourcequota
* Fixed golint issues
* Removed redundant package import names
* Improved some variables and names

Co-authored-by: Mike Danese <mikedanese@gmail.com>
2020-08-20 14:37:27 +02:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
mengyang02
b116585b22 remove redundant quota.V1Equals 2019-10-02 01:02:09 +08:00
Yassine TIJANI
7e4c3096fe move WaitForCacheSync to the sharedInformer package
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-08-22 16:13:41 +01:00
zhouhaibing089
f58c2ae62d resourcequota: use dynamic informer
The resource quota controller should use a dynamic informer so it
can create informer for custom resources.
2019-03-27 11:08:24 -07:00
Jordan Liggitt
27cd2be49f Update quota status with limits even when calculating errors 2019-03-26 23:15:40 -04:00
Jordan Liggitt
739df5452a Avoid deadlock in resource quota resync 2019-03-26 23:15:40 -04:00
Jordan Liggitt
e5f7af7058 Improve quota sync log messages 2019-03-26 23:15:40 -04:00
k8s-ci-robot
a44c2b9eeb
Merge pull request #70035 from liggitt/retain-quota-metadata
Avoid dropping resourcequota metadata in controller
2018-11-14 01:29:53 -08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Jordan Liggitt
fdd87a8872 Avoid dropping resourcequota metadata in controller 2018-10-19 14:52:53 -04:00
yue9944882
d11ee913a1 prune flipping int/ext conversion for quota controller 2018-08-27 21:49:26 +08:00
David Eads
4c8e9de293 allow failed discovery on initial quota controller start 2018-08-17 11:42:54 -04:00
vikaschoudhary16
ea2192f043 Fix quota sync 2018-06-05 04:50:37 -04:00
Wang Guoliang
89669283fe should use time.Since instead of time.Now().Sub 2018-04-10 12:05:51 +08:00
Kubernetes Submit Queue
2b0c7e2372
Merge pull request #57149 from deads2k/rebase-02-quota
Automatic merge from submit-queue (batch tested with PRs 58144, 57149). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

make quota reusable

Quota is logically a re-useable component so that replenishment and admission can be done in constituent servers.  This makes it possible to embed.  More cleanup is probably required, but this is the minimum.
2018-01-22 19:02:29 -08:00
Kubernetes Submit Queue
c24faeddcc
Merge pull request #57595 from CaoShuFeng/quota_queue_add
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

[quota controller] remove extra queue.Add()

requeue immediately after an error may end-up with hot-loop


**Release note**:

```release-note
NONE
```
2018-01-16 11:19:00 -08:00
Dan Mace
010a127314 Fix quota controller worker deadlock
The resource quota controller worker pool can deadlock when:

* Worker goroutines are idle waiting for work from queues
* The Sync() method detects discovery updates to apply

The problem is workers acquire a read lock while idle, making write lock
acquisition dependent upon the presence of work in the queues.

The Sync() method blocks on a pending write lock acquisition and won't unblock
until every existing worker processes one item from their queue and releases
their read lock. While the Sync() method's lock is pending, all new read lock
acquisitions will block; if a worker does process work and release its lock, it
will then become blocked on a read lock acquisition; they become blocked on
Sync(). This can easily deadlock all the workers processing from one queue while
any workers on the other queue remain blocked waiting for work.

Fix the deadlock by refactoring workers to acquire a read lock *after* work is
popped from the queue. This allows writers to get locks while workers are idle,
while preserving the worker pause semantics necessary to allow safe sync.
2018-01-10 16:36:01 -05:00
Cao Shufeng
5800c32fb6 [quota controller] remove extra queue.Add()
requeue immediately after an error may end-up with hot-loop
2017-12-23 17:17:35 +08:00
David Eads
541a9b42b1 add watch to requirements for quota-able resources 2017-12-18 14:50:09 -05:00
David Eads
7dc7693e86 make quota reusable 2017-12-13 08:39:55 -05:00
Dr. Stefan Schimanski
012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
Dr. Stefan Schimanski
d13b936a2a pkg/apis/core: fixup conversion func names in dependencies 2017-11-09 12:14:07 +01:00
Derek Carr
7f88e91892 Update quota controller to monitor all types 2017-10-27 11:07:53 -04:00
Malcolm Lee
efdf99d09a Since replenishmentControllers was generated by ctx.InformerFactory, remove "replenishmentControllers []cache.Controller" which is never used. 2017-10-17 14:05:55 +08:00
deads2k
62157572cf tighten quota controller interface 2017-07-19 15:36:45 -04:00
Jacob Simpson
29c1b81d4c Scripted migration from clientset_generated to client-go. 2017-07-17 15:05:37 -07:00
Chao Xu
f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Derek Carr
430f078f93 resource quota full resync was removed in error 2017-05-11 15:58:55 -04:00
Andy Goldstein
e63fcf708d Make controller Run methods consistent
- startup/shutdown logging
- wait for cache sync logging
- defer utilruntime.HandleCrash()
- wait for stop channel before exiting
2017-04-14 07:27:45 -04:00
Andy Goldstein
d820e3928c Switch resourcequota controller to shared informers 2017-02-14 12:20:27 -05:00
deads2k
2c1c0f3f72 move workqueue to client-go 2017-01-30 09:08:21 -05:00
Dr. Stefan Schimanski
79adb99a13 pkg/api: move Semantic equality to k8s.io/apimachinery/pkg/api/equality 2017-01-29 21:41:45 +01:00
deads2k
b0b156b381 make tools/cache authoritative 2017-01-25 08:29:45 -05:00
Clayton Coleman
469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
Clayton Coleman
9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
Kubernetes Submit Queue
0ca72d110d Merge pull request #39655 from xychu/typo-in-quota-ctr
Automatic merge from submit-queue

Fix typo in resource quota controller comments
2017-01-15 01:14:38 -08:00
Klaus Ma
25fe1e0d82 Made cache.Controller to be interface. 2017-01-13 13:33:23 +08:00
deads2k
6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Ethan Chu
4602d4fcfc Fix typo in resource quota controller comment 2017-01-10 15:27:23 +08:00