-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16015 from deads2k/controller-07-move-scheduler
Automatic merge from submit-queue run scheduler by wiring up to a command Wires the scheduler into the controllers by running the command with flags. This prevents nearly all of our rebase pain in the wiring area with scheduler.
- Loading branch information
Showing
6 changed files
with
84 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package start | ||
|
||
import ( | ||
"github.com/golang/glog" | ||
|
||
kerrors "k8s.io/apimachinery/pkg/util/errors" | ||
schedulerapp "k8s.io/kubernetes/plugin/cmd/kube-scheduler/app" | ||
scheduleroptions "k8s.io/kubernetes/plugin/cmd/kube-scheduler/app/options" | ||
_ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider" | ||
|
||
cmdflags "github.com/openshift/origin/pkg/cmd/util/flags" | ||
) | ||
|
||
func newScheduler(kubeconfigFile, schedulerConfigFile string, cmdLineArgs map[string][]string) (*scheduleroptions.SchedulerServer, error) { | ||
if cmdLineArgs == nil { | ||
cmdLineArgs = map[string][]string{} | ||
} | ||
if len(cmdLineArgs["kubeconfig"]) == 0 { | ||
cmdLineArgs["kubeconfig"] = []string{kubeconfigFile} | ||
} | ||
if len(cmdLineArgs["policy-config-file"]) == 0 { | ||
cmdLineArgs["policy-config-file"] = []string{schedulerConfigFile} | ||
} | ||
// disable serving http since we didn't used to expose it | ||
if len(cmdLineArgs["port"]) == 0 { | ||
cmdLineArgs["port"] = []string{"-1"} | ||
} | ||
|
||
// resolve arguments | ||
schedulerServer := scheduleroptions.NewSchedulerServer() | ||
if err := cmdflags.Resolve(cmdLineArgs, schedulerServer.AddFlags); len(err) > 0 { | ||
return nil, kerrors.NewAggregate(err) | ||
} | ||
|
||
return schedulerServer, nil | ||
} | ||
|
||
func runEmbeddedScheduler(kubeconfigFile, schedulerConfigFile string, cmdLineArgs map[string][]string) { | ||
for { | ||
// TODO we need a real identity for this. Right now it's just using the loopback connection like it used to. | ||
scheduler, err := newScheduler(kubeconfigFile, schedulerConfigFile, cmdLineArgs) | ||
if err != nil { | ||
glog.Error(err) | ||
continue | ||
} | ||
// this does a second leader election, but doing the second leader election will allow us to move out process in | ||
// 3.8 if we so choose. | ||
if err := schedulerapp.Run(scheduler); err != nil { | ||
glog.Error(err) | ||
continue | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
45 changes: 27 additions & 18 deletions
45
vendor/k8s.io/kubernetes/plugin/cmd/kube-scheduler/app/server.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.