mirror of https://github.com/k3s-io/k3s
Merge pull request #1296 from brendandburns/healthz
Add healthz handlers to the controller manager and schedulerpull/6/head
commit
24b5b7e8d3
|
@ -22,17 +22,24 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
|
||||||
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
|
||||||
|
masterPkg "github.com/GoogleCloudPlatform/kubernetes/pkg/master"
|
||||||
"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/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
master = flag.String("master", "", "The address of the Kubernetes API server")
|
master = flag.String("master", "", "The address of the Kubernetes API server")
|
||||||
|
port = flag.Int("port", masterPkg.ControllerManagerPort, "The port that the controller-manager's http service runs on")
|
||||||
|
address = flag.String("address", "127.0.0.1", "The address to serve from")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -51,6 +58,8 @@ func main() {
|
||||||
glog.Fatalf("Invalid -master: %v", err)
|
glog.Fatalf("Invalid -master: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go http.ListenAndServe(net.JoinHostPort(*address, strconv.Itoa(*port)), nil)
|
||||||
|
|
||||||
controllerManager := controller.NewReplicationManager(kubeClient)
|
controllerManager := controller.NewReplicationManager(kubeClient)
|
||||||
controllerManager.Run(10 * time.Second)
|
controllerManager.Run(10 * time.Second)
|
||||||
select {}
|
select {}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import (
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet"
|
||||||
kconfig "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config"
|
kconfig "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
|
||||||
"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"
|
||||||
|
@ -53,7 +54,7 @@ var (
|
||||||
manifestURL = flag.String("manifest_url", "", "URL for accessing the container manifest")
|
manifestURL = flag.String("manifest_url", "", "URL for accessing the container manifest")
|
||||||
enableServer = flag.Bool("enable_server", true, "Enable the info server")
|
enableServer = flag.Bool("enable_server", true, "Enable the info server")
|
||||||
address = flag.String("address", "127.0.0.1", "The address for the info server to serve on (set to 0.0.0.0 or \"\" for all interfaces)")
|
address = flag.String("address", "127.0.0.1", "The address for the info server to serve on (set to 0.0.0.0 or \"\" for all interfaces)")
|
||||||
port = flag.Uint("port", 10250, "The port for the info server to serve on")
|
port = flag.Uint("port", master.KubeletPort, "The port for the info server to serve on")
|
||||||
hostnameOverride = flag.String("hostname_override", "", "If non-empty, will use this string as identification instead of the actual hostname.")
|
hostnameOverride = flag.String("hostname_override", "", "If non-empty, will use this string as identification instead of the actual hostname.")
|
||||||
dockerEndpoint = flag.String("docker_endpoint", "", "If non-empty, use this for the docker endpoint to communicate with")
|
dockerEndpoint = flag.String("docker_endpoint", "", "If non-empty, use this for the docker endpoint to communicate with")
|
||||||
etcdServerList util.StringList
|
etcdServerList util.StringList
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
Copyright 2014 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 master
|
||||||
|
|
||||||
|
const (
|
||||||
|
// KubeletPort is the default port for the kubelet status server on each host machine.
|
||||||
|
// May be overridden by a flag at startup.
|
||||||
|
KubeletPort = 10250
|
||||||
|
// SchedulerPort is the default port for the scheduler status server.
|
||||||
|
// May be overridden by a flag at startup.
|
||||||
|
SchedulerPort = 10251
|
||||||
|
// ControllerManagerPort is the default port for the controller manager status server.
|
||||||
|
// May be overridden by a flag at startup.
|
||||||
|
ControllerManagerPort = 10252
|
||||||
|
)
|
|
@ -18,8 +18,13 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
|
||||||
|
masterPkg "github.com/GoogleCloudPlatform/kubernetes/pkg/master"
|
||||||
"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"
|
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler"
|
||||||
|
@ -28,7 +33,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
master = flag.String("master", "", "The address of the Kubernetes API server")
|
master = flag.String("master", "", "The address of the Kubernetes API server")
|
||||||
|
port = flag.Int("port", masterPkg.SchedulerPort, "The port that the scheduler's http service runs on")
|
||||||
|
address = flag.String("address", "127.0.0.1", "The address to serve from")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -44,6 +51,8 @@ func main() {
|
||||||
glog.Fatalf("Invalid -master: %v", err)
|
glog.Fatalf("Invalid -master: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go http.ListenAndServe(net.JoinHostPort(*address, strconv.Itoa(*port)), nil)
|
||||||
|
|
||||||
configFactory := &factory.ConfigFactory{Client: kubeClient}
|
configFactory := &factory.ConfigFactory{Client: kubeClient}
|
||||||
config := configFactory.Create()
|
config := configFactory.Create()
|
||||||
s := scheduler.New(config)
|
s := scheduler.New(config)
|
||||||
|
|
Loading…
Reference in New Issue