Merge pull request #9901 from commixon/nodelocalcache-configure-resources

Nodelocalcache configure resources
This commit is contained in:
Kubernetes Prow Robot 2020-09-09 09:19:08 -07:00 committed by GitHub
commit 8a07275bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 64 additions and 4 deletions

View File

@ -577,12 +577,16 @@ spec:
NodeLocal DNSCache can be enabled if you are using CoreDNS. It is used to improve the Cluster DNS performance by running a dns caching agent on cluster nodes as a DaemonSet.
`memoryRequest` and `cpuRequest` for the `node-local-dns` pods can also be configured. If not set, they will be configured by default to `5Mi` and `25m` respectively.
```yaml
spec:
kubeDNS:
provider: CoreDNS
nodeLocalDNS:
enabled: true
memoryRequest: 5Mi
cpuRequest: 25m
```
## kubeControllerManager

View File

@ -1345,12 +1345,26 @@ spec:
nodeLocalDNS:
description: NodeLocalDNS specifies the configuration for the node-local-dns addon
properties:
cpuRequest:
anyOf:
- type: integer
- type: string
description: CPURequest specifies the cpu requests of each node-local-dns container in the daemonset. Default 25m.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
enabled:
description: Enabled activates the node-local-dns addon
type: boolean
localIP:
description: Local listen IP address. It can be any IP in the 169.254.20.0/16 space or any other IP address that can be guaranteed to not collide with any existing IP.
type: string
memoryRequest:
anyOf:
- type: integer
- type: string
description: MemoryRequest specifies the memory requests of each node-local-dns container in the daemonset. Default 5Mi.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
provider:
description: Provider indicates whether CoreDNS or kube-dns will be the default service discovery.

View File

@ -413,6 +413,10 @@ type NodeLocalDNSConfig struct {
Enabled *bool `json:"enabled,omitempty"`
// Local listen IP address. It can be any IP in the 169.254.20.0/16 space or any other IP address that can be guaranteed to not collide with any existing IP.
LocalIP string `json:"localIP,omitempty"`
// MemoryRequest specifies the memory requests of each node-local-dns container in the daemonset. Default 5Mi.
MemoryRequest *resource.Quantity `json:"memoryRequest,omitempty"`
// CPURequest specifies the cpu requests of each node-local-dns container in the daemonset. Default 25m.
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
}
// ExternalDNSConfig are options of the dns-controller

View File

@ -414,6 +414,10 @@ type NodeLocalDNSConfig struct {
Enabled *bool `json:"enabled,omitempty"`
// Local listen IP address. It can be any IP in the 169.254.20.0/16 space or any other IP address that can be guaranteed to not collide with any existing IP.
LocalIP string `json:"localIP,omitempty"`
// MemoryRequest specifies the memory requests of each node-local-dns container in the daemonset. Default 5Mi.
MemoryRequest *resource.Quantity `json:"memoryRequest,omitempty"`
// CPURequest specifies the cpu requests of each node-local-dns container in the daemonset. Default 25m.
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
}
// ExternalDNSConfig are options of the dns-controller

View File

@ -5031,6 +5031,8 @@ func Convert_kops_NodeAuthorizerSpec_To_v1alpha2_NodeAuthorizerSpec(in *kops.Nod
func autoConvert_v1alpha2_NodeLocalDNSConfig_To_kops_NodeLocalDNSConfig(in *NodeLocalDNSConfig, out *kops.NodeLocalDNSConfig, s conversion.Scope) error {
out.Enabled = in.Enabled
out.LocalIP = in.LocalIP
out.MemoryRequest = in.MemoryRequest
out.CPURequest = in.CPURequest
return nil
}
@ -5042,6 +5044,8 @@ func Convert_v1alpha2_NodeLocalDNSConfig_To_kops_NodeLocalDNSConfig(in *NodeLoca
func autoConvert_kops_NodeLocalDNSConfig_To_v1alpha2_NodeLocalDNSConfig(in *kops.NodeLocalDNSConfig, out *NodeLocalDNSConfig, s conversion.Scope) error {
out.Enabled = in.Enabled
out.LocalIP = in.LocalIP
out.MemoryRequest = in.MemoryRequest
out.CPURequest = in.CPURequest
return nil
}

View File

@ -3357,6 +3357,16 @@ func (in *NodeLocalDNSConfig) DeepCopyInto(out *NodeLocalDNSConfig) {
*out = new(bool)
**out = **in
}
if in.MemoryRequest != nil {
in, out := &in.MemoryRequest, &out.MemoryRequest
x := (*in).DeepCopy()
*out = &x
}
if in.CPURequest != nil {
in, out := &in.CPURequest, &out.CPURequest
x := (*in).DeepCopy()
*out = &x
}
return
}

View File

@ -3555,6 +3555,16 @@ func (in *NodeLocalDNSConfig) DeepCopyInto(out *NodeLocalDNSConfig) {
*out = new(bool)
**out = **in
}
if in.MemoryRequest != nil {
in, out := &in.MemoryRequest, &out.MemoryRequest
x := (*in).DeepCopy()
*out = &x
}
if in.CPURequest != nil {
in, out := &in.CPURequest, &out.CPURequest
x := (*in).DeepCopy()
*out = &x
}
return
}

View File

@ -87,5 +87,15 @@ func (b *KubeDnsOptionsBuilder) BuildOptions(o interface{}) error {
nodeLocalDNS.LocalIP = "169.254.20.10"
}
if nodeLocalDNS.MemoryRequest == nil || nodeLocalDNS.MemoryRequest.IsZero() {
defaultMemoryRequest := resource.MustParse("5Mi")
nodeLocalDNS.MemoryRequest = &defaultMemoryRequest
}
if nodeLocalDNS.CPURequest == nil || nodeLocalDNS.CPURequest.IsZero() {
defaultCPURequest := resource.MustParse("25m")
nodeLocalDNS.CPURequest = &defaultCPURequest
}
return nil
}

View File

@ -18640,8 +18640,8 @@ spec:
image: k8s.gcr.io/k8s-dns-node-cache:1.15.10
resources:
requests:
cpu: 25m
memory: 5Mi
cpu: {{ KubeDNS.NodeLocalDNS.CPURequest }}
memory: {{ KubeDNS.NodeLocalDNS.MemoryRequest }}
{{ if NodeLocalDNSServerIP }}
args: [ "-localip", "{{ .KubeDNS.NodeLocalDNS.LocalIP }},{{ NodeLocalDNSServerIP }}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
{{ else }}

View File

@ -131,8 +131,8 @@ spec:
image: k8s.gcr.io/k8s-dns-node-cache:1.15.10
resources:
requests:
cpu: 25m
memory: 5Mi
cpu: {{ KubeDNS.NodeLocalDNS.CPURequest }}
memory: {{ KubeDNS.NodeLocalDNS.MemoryRequest }}
{{ if NodeLocalDNSServerIP }}
args: [ "-localip", "{{ .KubeDNS.NodeLocalDNS.LocalIP }},{{ NodeLocalDNSServerIP }}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
{{ else }}