mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
Refactoring cAdvisor interface into a package.
This will make it easier to start running the real cAdvisor alongside Kubelet. This change is primarily no-op refactoring. The main behavioral change is that we always create a cAdvisor interface and expect it to always be available. When we make a request, if cAdvisor is not connected the request fails with a connection error. This failure is handled today as well.
This commit is contained in:
@@ -17,8 +17,6 @@ limitations under the License.
|
||||
package kubelet
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
||||
@@ -26,23 +24,8 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/coreos/go-etcd/etcd"
|
||||
"github.com/golang/glog"
|
||||
cadvisor "github.com/google/cadvisor/client"
|
||||
)
|
||||
|
||||
// TODO: move this into the kubelet itself
|
||||
func MonitorCAdvisor(k *Kubelet, cp uint) {
|
||||
defer util.HandleCrash()
|
||||
// TODO: Monitor this connection, reconnect if needed?
|
||||
glog.V(1).Infof("Trying to create cadvisor client.")
|
||||
cadvisorClient, err := cadvisor.NewClient("http://127.0.0.1:" + strconv.Itoa(int(cp)))
|
||||
if err != nil {
|
||||
glog.Errorf("Error on creating cadvisor client: %v", err)
|
||||
return
|
||||
}
|
||||
glog.V(1).Infof("Successfully created cadvisor client.")
|
||||
k.SetCadvisorClient(cadvisorClient)
|
||||
}
|
||||
|
||||
// TODO: move this into a pkg/tools/etcd_tools
|
||||
func EtcdClientOrDie(etcdServerList util.StringList, etcdConfigFile string) tools.EtcdClient {
|
||||
if len(etcdServerList) > 0 {
|
||||
|
Reference in New Issue
Block a user