Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/cmd/server/kubernetes/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
minionControllerPkg "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/controller"
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
"github.com/GoogleCloudPlatform/kubernetes/pkg/resourcequota"
"github.com/GoogleCloudPlatform/kubernetes/pkg/service"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
kubeutil "github.com/GoogleCloudPlatform/kubernetes/pkg/util"
Expand Down Expand Up @@ -126,6 +127,11 @@ func (c *MasterConfig) RunScheduler() {
glog.Infof("Started Kubernetes Scheduler")
}

func (c *MasterConfig) RunResourceQuotaManager() {
resourceQuotaManager := resourcequota.NewResourceQuotaManager(c.KubeClient)
resourceQuotaManager.Run(10 * time.Second)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is slower, is that an issue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In current code, it affects two things at this time:

  1. If you add a ResourceQuota to a project, you will not be able to add resources in that project until the synch has been run.
  2. If you delete a resource, we only capture the delete until a synch has been run. If you are running at the edge of your quota, you will need to wait.

Right now, upstream it runs at 10s, but it is configurable in kube-controller-manager.

I have a card in the future to make the delete case less time-sensitive, basic idea would be to watch for delete events on pods, and update the related pod.Namespace quota to release that memory/cpu since that is probably most important.

}

func (c *MasterConfig) RunMinionController() {
nodeResources := &kapi.NodeResources{
Capacity: kapi.ResourceList{
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ func start(cfg *config, args []string) error {
kmaster.RunReplicationController()
kmaster.RunEndpointController()
kmaster.RunMinionController()
kmaster.RunResourceQuotaManager()

} else {
proxy := &kubernetes.ProxyConfig{
Expand Down