Merge pull request #9722 from mikedanese/host-ip-spam

Fix spammy GetHostIP error log in kubelet
pull/6/head
Abhi Shah 2015-06-12 15:26:54 -07:00
commit 3ce7fe8310
3 changed files with 26 additions and 13 deletions

View File

@ -94,6 +94,7 @@ type KubeletServer struct {
OOMScoreAdj int
APIServerList util.StringList
RegisterNode bool
StandaloneMode bool
ClusterDomain string
MasterServiceNamespace string
ClusterDNS util.IP
@ -332,6 +333,7 @@ func (s *KubeletServer) Run(_ []string) error {
MaxPerPodContainerCount: s.MaxPerPodContainerCount,
MaxContainerCount: s.MaxContainerCount,
RegisterNode: s.RegisterNode,
StandaloneMode: (len(s.APIServerList) == 0),
ClusterDomain: s.ClusterDomain,
ClusterDNS: s.ClusterDNS,
Runonce: s.RunOnce,
@ -662,6 +664,7 @@ type KubeletConfig struct {
MaxPerPodContainerCount int
MaxContainerCount int
RegisterNode bool
StandaloneMode bool
ClusterDomain string
ClusterDNS util.IP
EnableServer bool
@ -722,6 +725,7 @@ func createAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
gcPolicy,
pc.SeenAllSources,
kc.RegisterNode,
kc.StandaloneMode,
kc.ClusterDomain,
net.IP(kc.ClusterDNS),
kc.MasterServiceNamespace,

View File

@ -218,14 +218,15 @@ func (s *KubeletExecutorServer) Run(hks hyperkube.Interface, _ []string) error {
// ManifestURL: ""
// FileCheckFrequency
// HTTPCheckFrequency
PodInfraContainerImage: s.PodInfraContainerImage,
SyncFrequency: s.SyncFrequency,
RegistryPullQPS: s.RegistryPullQPS,
RegistryBurst: s.RegistryBurst,
MinimumGCAge: s.MinimumGCAge,
MaxPerPodContainerCount: s.MaxPerPodContainerCount,
MaxContainerCount: s.MaxContainerCount,
RegisterNode: s.RegisterNode,
PodInfraContainerImage: s.PodInfraContainerImage,
SyncFrequency: s.SyncFrequency,
RegistryPullQPS: s.RegistryPullQPS,
RegistryBurst: s.RegistryBurst,
MinimumGCAge: s.MinimumGCAge,
MaxPerPodContainerCount: s.MaxPerPodContainerCount,
MaxContainerCount: s.MaxContainerCount,
RegisterNode: s.RegisterNode,
// StandaloneMode: false
ClusterDomain: s.ClusterDomain,
ClusterDNS: s.ClusterDNS,
Runonce: s.RunOnce,
@ -327,6 +328,7 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
gcPolicy,
pc.SeenAllSources,
kc.RegisterNode,
kc.StandaloneMode,
kc.ClusterDomain,
net.IP(kc.ClusterDNS),
kc.MasterServiceNamespace,

View File

@ -124,6 +124,7 @@ func NewMainKubelet(
containerGCPolicy ContainerGCPolicy,
sourcesReady SourcesReadyFn,
registerNode bool,
standaloneMode bool,
clusterDomain string,
clusterDNS net.IP,
masterServiceNamespace string,
@ -232,6 +233,7 @@ func NewMainKubelet(
httpClient: &http.Client{},
sourcesReady: sourcesReady,
registerNode: registerNode,
standaloneMode: standaloneMode,
clusterDomain: clusterDomain,
clusterDNS: clusterDNS,
serviceLister: serviceLister,
@ -387,6 +389,9 @@ type Kubelet struct {
// Set to true to have the node register itself with the apiserver.
registerNode bool
// Set to true if the kubelet is in standalone mode (i.e. setup without an apiserver)
standaloneMode bool
// If non-empty, use this for container DNS search.
clusterDomain string
@ -2126,11 +2131,13 @@ func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
podStatus.Conditions = append(podStatus.Conditions, getPodReadyCondition(spec, podStatus.ContainerStatuses)...)
hostIP, err := kl.GetHostIP()
if err != nil {
glog.Errorf("Cannot get host IP: %v", err)
} else {
podStatus.HostIP = hostIP.String()
if !kl.standaloneMode {
hostIP, err := kl.GetHostIP()
if err != nil {
glog.V(4).Infof("Cannot get host IP: %v", err)
} else {
podStatus.HostIP = hostIP.String()
}
}
return *podStatus, nil