Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e2ebc506
Commit
e2ebc506
authored
Mar 07, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't sync all objects for replenishment as often as ResourceQuota.
parent
13c17ddc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+6
-5
resource_quota_controller.go
pkg/controller/resourcequota/resource_quota_controller.go
+3
-1
resource_quota_controller_test.go
...ontroller/resourcequota/resource_quota_controller_test.go
+6
-3
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
e2ebc506
...
@@ -240,11 +240,12 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
...
@@ -240,11 +240,12 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
api
.
Kind
(
"ConfigMap"
),
api
.
Kind
(
"ConfigMap"
),
}
}
resourceQuotaControllerOptions
:=
&
resourcequotacontroller
.
ResourceQuotaControllerOptions
{
resourceQuotaControllerOptions
:=
&
resourcequotacontroller
.
ResourceQuotaControllerOptions
{
KubeClient
:
resourceQuotaControllerClient
,
KubeClient
:
resourceQuotaControllerClient
,
ResyncPeriod
:
controller
.
StaticResyncPeriodFunc
(
s
.
ResourceQuotaSyncPeriod
.
Duration
),
ResyncPeriod
:
controller
.
StaticResyncPeriodFunc
(
s
.
ResourceQuotaSyncPeriod
.
Duration
),
Registry
:
resourceQuotaRegistry
,
Registry
:
resourceQuotaRegistry
,
GroupKindsToReplenish
:
groupKindsToReplenish
,
ControllerFactory
:
resourcequotacontroller
.
NewReplenishmentControllerFactory
(
resourceQuotaControllerClient
),
ControllerFactory
:
resourcequotacontroller
.
NewReplenishmentControllerFactory
(
resourceQuotaControllerClient
),
ReplenishmentResyncPeriod
:
ResyncPeriod
(
s
),
GroupKindsToReplenish
:
groupKindsToReplenish
,
}
}
go
resourcequotacontroller
.
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
.
Run
(
s
.
ConcurrentResourceQuotaSyncs
,
wait
.
NeverStop
)
go
resourcequotacontroller
.
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
.
Run
(
s
.
ConcurrentResourceQuotaSyncs
,
wait
.
NeverStop
)
...
...
pkg/controller/resourcequota/resource_quota_controller.go
View file @
e2ebc506
...
@@ -45,6 +45,8 @@ type ResourceQuotaControllerOptions struct {
...
@@ -45,6 +45,8 @@ type ResourceQuotaControllerOptions struct {
Registry
quota
.
Registry
Registry
quota
.
Registry
// Knows how to build controllers that notify replenishment events
// Knows how to build controllers that notify replenishment events
ControllerFactory
ReplenishmentControllerFactory
ControllerFactory
ReplenishmentControllerFactory
// Controls full resync of objects monitored for replenihsment.
ReplenishmentResyncPeriod
controller
.
ResyncPeriodFunc
// List of GroupKind objects that should be monitored for replenishment at
// List of GroupKind objects that should be monitored for replenishment at
// a faster frequency than the quota controller recalculation interval
// a faster frequency than the quota controller recalculation interval
GroupKindsToReplenish
[]
unversioned
.
GroupKind
GroupKindsToReplenish
[]
unversioned
.
GroupKind
...
@@ -124,7 +126,7 @@ func NewResourceQuotaController(options *ResourceQuotaControllerOptions) *Resour
...
@@ -124,7 +126,7 @@ func NewResourceQuotaController(options *ResourceQuotaControllerOptions) *Resour
for
_
,
groupKindToReplenish
:=
range
options
.
GroupKindsToReplenish
{
for
_
,
groupKindToReplenish
:=
range
options
.
GroupKindsToReplenish
{
controllerOptions
:=
&
ReplenishmentControllerOptions
{
controllerOptions
:=
&
ReplenishmentControllerOptions
{
GroupKind
:
groupKindToReplenish
,
GroupKind
:
groupKindToReplenish
,
ResyncPeriod
:
options
.
ResyncPeriod
,
ResyncPeriod
:
options
.
Re
plenishmentRe
syncPeriod
,
ReplenishmentFunc
:
rq
.
replenishQuota
,
ReplenishmentFunc
:
rq
.
replenishQuota
,
}
}
replenishmentController
,
err
:=
options
.
ControllerFactory
.
NewController
(
controllerOptions
)
replenishmentController
,
err
:=
options
.
ControllerFactory
.
NewController
(
controllerOptions
)
...
...
pkg/controller/resourcequota/resource_quota_controller_test.go
View file @
e2ebc506
...
@@ -113,7 +113,8 @@ func TestSyncResourceQuota(t *testing.T) {
...
@@ -113,7 +113,8 @@ func TestSyncResourceQuota(t *testing.T) {
api
.
Kind
(
"ReplicationController"
),
api
.
Kind
(
"ReplicationController"
),
api
.
Kind
(
"PersistentVolumeClaim"
),
api
.
Kind
(
"PersistentVolumeClaim"
),
},
},
ControllerFactory
:
NewReplenishmentControllerFactory
(
kubeClient
),
ControllerFactory
:
NewReplenishmentControllerFactory
(
kubeClient
),
ReplenishmentResyncPeriod
:
controller
.
NoResyncPeriodFunc
,
}
}
quotaController
:=
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
quotaController
:=
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
err
:=
quotaController
.
syncResourceQuota
(
resourceQuota
)
err
:=
quotaController
.
syncResourceQuota
(
resourceQuota
)
...
@@ -198,7 +199,8 @@ func TestSyncResourceQuotaSpecChange(t *testing.T) {
...
@@ -198,7 +199,8 @@ func TestSyncResourceQuotaSpecChange(t *testing.T) {
api
.
Kind
(
"ReplicationController"
),
api
.
Kind
(
"ReplicationController"
),
api
.
Kind
(
"PersistentVolumeClaim"
),
api
.
Kind
(
"PersistentVolumeClaim"
),
},
},
ControllerFactory
:
NewReplenishmentControllerFactory
(
kubeClient
),
ControllerFactory
:
NewReplenishmentControllerFactory
(
kubeClient
),
ReplenishmentResyncPeriod
:
controller
.
NoResyncPeriodFunc
,
}
}
quotaController
:=
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
quotaController
:=
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
err
:=
quotaController
.
syncResourceQuota
(
resourceQuota
)
err
:=
quotaController
.
syncResourceQuota
(
resourceQuota
)
...
@@ -274,7 +276,8 @@ func TestSyncResourceQuotaNoChange(t *testing.T) {
...
@@ -274,7 +276,8 @@ func TestSyncResourceQuotaNoChange(t *testing.T) {
api
.
Kind
(
"ReplicationController"
),
api
.
Kind
(
"ReplicationController"
),
api
.
Kind
(
"PersistentVolumeClaim"
),
api
.
Kind
(
"PersistentVolumeClaim"
),
},
},
ControllerFactory
:
NewReplenishmentControllerFactory
(
kubeClient
),
ControllerFactory
:
NewReplenishmentControllerFactory
(
kubeClient
),
ReplenishmentResyncPeriod
:
controller
.
NoResyncPeriodFunc
,
}
}
quotaController
:=
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
quotaController
:=
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
err
:=
quotaController
.
syncResourceQuota
(
resourceQuota
)
err
:=
quotaController
.
syncResourceQuota
(
resourceQuota
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment