Structural changes to kube-proxy and apiserver

pull/1693/head
Matt Rickard 2017-06-28 11:25:59 -07:00
parent 8ad4ffe217
commit 81fa73d2df
2 changed files with 20 additions and 14 deletions

View File

@ -46,8 +46,13 @@ func StartAPIServer(lk LocalkubeServer) func() error {
config.SecureServing.ServerCert.CertKey.CertFile = lk.GetPublicKeyCertPath()
config.SecureServing.ServerCert.CertKey.KeyFile = lk.GetPrivateKeyCertPath()
config.GenericServerRunOptions.AdmissionControl = "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota"
config.Admission.PluginNames = []string{
"NamespaceLifecycle",
"LimitRanger",
"ServiceAccount",
"DefaultStorageClass",
"ResourceQuota",
}
// use localkube etcd
config.Etcd.StorageConfig.ServerList = KubeEtcdClientURLs

View File

@ -19,7 +19,7 @@ package localkube
import (
kubeproxy "k8s.io/kubernetes/cmd/kube-proxy/app"
"k8s.io/kubernetes/cmd/kube-proxy/app/options"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/pkg/kubelet/qos"
)
@ -34,22 +34,23 @@ func (lk LocalkubeServer) NewProxyServer() Server {
}
func StartProxyServer(lk LocalkubeServer) func() error {
config := options.NewProxyConfig()
// master details
config.Master = lk.GetAPIServerInsecureURL()
config.Mode = componentconfig.ProxyModeIPTables
// defaults
config.OOMScoreAdj = &OOMScoreAdj
config.IPTablesMasqueradeBit = &MasqueradeBit
config := &componentconfig.KubeProxyConfiguration{
OOMScoreAdj: &OOMScoreAdj,
IPTables: componentconfig.KubeProxyIPTablesConfiguration{
MasqueradeBit: &MasqueradeBit,
},
BindAddress: lk.APIServerInsecureAddress.String(),
Mode: componentconfig.ProxyModeIPTables,
FeatureGates: lk.FeatureGates,
// Disable the healthz check
HealthzBindAddress: "0",
}
lk.SetExtraConfigForComponent("proxy", &config)
return func() error {
// Creating this config requires the API Server to be up, so do it in the start function itself.
server, err := kubeproxy.NewProxyServerDefault(config)
server, err := kubeproxy.NewProxyServer(config, false, runtime.NewScheme(), lk.GetAPIServerInsecureURL())
if err != nil {
panic(err)
}