Skip to content

Commit

Permalink
Merge pull request kubernetes#20542 from mikedanese/kube-proxy-defaul…
Browse files Browse the repository at this point in the history
…ting

componentconfig: move kube proxy defaulting into the exetrnal api
  • Loading branch information
lavalamp committed Feb 5, 2016
2 parents 82e928d + ee4e60d commit 5fe99f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
22 changes: 7 additions & 15 deletions cmd/kube-proxy/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"time"

"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/componentconfig"
"k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1"
"k8s.io/kubernetes/pkg/kubelet/qos"
"k8s.io/kubernetes/pkg/util"

Expand All @@ -48,21 +48,13 @@ type ProxyServerConfig struct {
}

func NewProxyConfig() *ProxyServerConfig {
config := componentconfig.KubeProxyConfiguration{}
api.Scheme.Convert(&v1alpha1.KubeProxyConfiguration{}, &config)
return &ProxyServerConfig{
KubeProxyConfiguration: componentconfig.KubeProxyConfiguration{
BindAddress: "0.0.0.0",
HealthzPort: 10249,
HealthzBindAddress: "127.0.0.1",
OOMScoreAdj: util.IntPtr(qos.KubeProxyOOMScoreAdj),
ResourceContainer: "/kube-proxy",
IPTablesSyncPeriod: unversioned.Duration{30 * time.Second},
UDPIdleTimeout: unversioned.Duration{250 * time.Millisecond},
ConntrackMax: 256 * 1024, // 4x default (64k)
ConntrackTCPEstablishedTimeout: unversioned.Duration{Duration: 24 * time.Hour}, // 1 day (1/5 default)
},
KubeAPIQPS: 5.0,
KubeAPIBurst: 10,
ConfigSyncPeriod: 15 * time.Minute,
KubeProxyConfiguration: config,
KubeAPIQPS: 5.0,
KubeAPIBurst: 10,
ConfigSyncPeriod: 15 * time.Minute,
}
}

Expand Down
15 changes: 14 additions & 1 deletion pkg/apis/componentconfig/v1alpha1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,21 @@ func addDefaultingFuncs(scheme *runtime.Scheme) {
temp := int32(qos.KubeProxyOOMScoreAdj)
obj.OOMScoreAdj = &temp
}
if obj.ResourceContainer == "" {
obj.ResourceContainer = "/kube-proxy"
}
if obj.IPTablesSyncPeriod.Duration == 0 {
obj.IPTablesSyncPeriod = unversioned.Duration{5 * time.Second}
obj.IPTablesSyncPeriod = unversioned.Duration{30 * time.Second}
}
zero := unversioned.Duration{}
if obj.UDPIdleTimeout == zero {
obj.UDPIdleTimeout = unversioned.Duration{250 * time.Millisecond}
}
if obj.ConntrackMax == 0 {
obj.ConntrackMax = 256 * 1024 // 4x default (64k)
}
if obj.ConntrackTCPEstablishedTimeout == zero {
obj.ConntrackTCPEstablishedTimeout = unversioned.Duration{Duration: 24 * time.Hour} // 1 day (1/5 default)
}
},
func(obj *KubeSchedulerConfiguration) {
Expand Down

0 comments on commit 5fe99f4

Please sign in to comment.