Merge pull request #545 from justinsb/kube_proxy_localhost

Point kube-proxy to localhost when running on master
This commit is contained in:
Justin Santa Barbara 2016-09-30 20:41:20 -04:00 committed by GitHub
commit b03793c972
1 changed files with 17 additions and 3 deletions

View File

@ -121,9 +121,7 @@ func (t *templateFunctions) populate(dest template.FuncMap) {
dest["KubeControllerManager"] = func() *api.KubeControllerManagerConfig {
return t.cluster.Spec.KubeControllerManager
}
dest["KubeProxy"] = func() *api.KubeProxyConfig {
return t.cluster.Spec.KubeProxy
}
dest["KubeProxy"] = t.KubeProxyConfig
dest["KubeletConfig"] = func() *api.KubeletConfigSpec {
return t.kubeletConfig
}
@ -222,3 +220,19 @@ func (t *templateFunctions) ProtokubeImage() string {
}
return image
}
// KubeProxyConfig builds the KubeProxyConfig configuration object
func (t *templateFunctions) KubeProxyConfig() *api.KubeProxyConfig {
config := &api.KubeProxyConfig{}
*config = *t.cluster.Spec.KubeProxy
// As a special case, if this is the master, we point kube-proxy to the local IP
// This prevents a circular dependency where kube-proxy can't come up until DNS comes up,
// which would mean that DNS can't rely on API to come up
if t.IsMaster() {
glog.Infof("kube-proxy running on the master; setting API endpoint to localhost")
config.Master = fi.String("http://127.0.0.1:8080")
}
return config
}