mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
move pkg/scheduler/server to cmd/kube-scheduler/app
This commit is contained in:
parent
0b17c0f225
commit
5f021cfc3e
@ -22,7 +22,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/hyperkube"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/hyperkube"
|
||||||
sched "github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/server"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -33,7 +32,7 @@ func main() {
|
|||||||
|
|
||||||
hk.AddServer(NewKubeAPIServer())
|
hk.AddServer(NewKubeAPIServer())
|
||||||
hk.AddServer(NewKubeControllerManager())
|
hk.AddServer(NewKubeControllerManager())
|
||||||
hk.AddServer(sched.NewHyperkubeServer())
|
hk.AddServer(NewScheduler())
|
||||||
hk.AddServer(NewKubelet())
|
hk.AddServer(NewKubelet())
|
||||||
hk.AddServer(NewKubeProxy())
|
hk.AddServer(NewKubeProxy())
|
||||||
|
|
||||||
|
38
cmd/hyperkube/kube-scheduler.go
Normal file
38
cmd/hyperkube/kube-scheduler.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 Google Inc. All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/hyperkube"
|
||||||
|
scheduler "github.com/GoogleCloudPlatform/kubernetes/plugin/cmd/kube-scheduler/app"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewScheduler creates a new hyperkube Server object that includes the
|
||||||
|
// description and flags.
|
||||||
|
func NewScheduler() *hyperkube.Server {
|
||||||
|
s := scheduler.NewSchedulerServer()
|
||||||
|
|
||||||
|
hks := hyperkube.Server{
|
||||||
|
SimpleUsage: "scheduler",
|
||||||
|
Long: "Implements a Kubernetes scheduler. This will assign pods to kubelets based on capacity and constraints.",
|
||||||
|
Run: func(_ *hyperkube.Server, args []string) error {
|
||||||
|
return s.Run(args)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
s.AddFlags(hks.Flags())
|
||||||
|
return &hks
|
||||||
|
}
|
@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package server implements a Server object for running the scheduler.
|
// Package app implements a Server object for running the scheduler.
|
||||||
package server
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
@ -26,7 +26,6 @@ import (
|
|||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/hyperkube"
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler"
|
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler"
|
||||||
@ -55,22 +54,6 @@ func NewSchedulerServer() *SchedulerServer {
|
|||||||
return &s
|
return &s
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHyperkubeServer creates a new hyperkube Server object that includes the
|
|
||||||
// description and flags.
|
|
||||||
func NewHyperkubeServer() *hyperkube.Server {
|
|
||||||
s := NewSchedulerServer()
|
|
||||||
|
|
||||||
hks := hyperkube.Server{
|
|
||||||
SimpleUsage: "scheduler",
|
|
||||||
Long: "Implements a Kubernetes scheduler. This will assign pods to kubelets based on capacity and constraints.",
|
|
||||||
Run: func(_ *hyperkube.Server, args []string) error {
|
|
||||||
return s.Run(args)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
s.AddFlags(hks.Flags())
|
|
||||||
return &hks
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddFlags adds flags for a specific SchedulerServer to the specified FlagSet
|
// AddFlags adds flags for a specific SchedulerServer to the specified FlagSet
|
||||||
func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
|
func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
|
||||||
fs.IntVar(&s.Port, "port", s.Port, "The port that the scheduler's http service runs on")
|
fs.IntVar(&s.Port, "port", s.Port, "The port that the scheduler's http service runs on")
|
@ -19,13 +19,13 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/server"
|
"github.com/GoogleCloudPlatform/kubernetes/plugin/cmd/kube-scheduler/app"
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
s := server.NewSchedulerServer()
|
s := app.NewSchedulerServer()
|
||||||
s.AddFlags(pflag.CommandLine)
|
s.AddFlags(pflag.CommandLine)
|
||||||
|
|
||||||
util.InitFlags()
|
util.InitFlags()
|
||||||
|
Loading…
Reference in New Issue
Block a user