Skip to content

Commit

Permalink
[addons/nodelocaldns] Bump image to latest stable v1.20.0
Browse files Browse the repository at this point in the history
As per
kubernetes/dns@3b17e06,
node-local-dns addon is now builded with latest coreDNS base v1.8 and
that brings great consistency between cache and upstream servers in a
manner of configuration, metrics name convention, etc.

So in this commit, we bump node-local-dns image to latest v1.20.0 which
is build upon latest coreDNS and also add support for overriding this
field.

Signed-off-by: dntosas <ntosas@gmail.com>
  • Loading branch information
dntosas committed Aug 29, 2021
1 parent 44c07e2 commit 31f49ae
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 5 deletions.
5 changes: 4 additions & 1 deletion docs/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ NodeLocal DNSCache can be enabled if you are using CoreDNS. It is used to improv

`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.

If `forwardToKubeDNS` is enabled, kubedns will be used as a default upstream
If `forwardToKubeDNS` is enabled, kubedns will be used as a default upstream.

There is also an option to override the default image used by Kops by defining `image`.

```yaml
spec:
Expand All @@ -139,6 +141,7 @@ spec:
enabled: true
memoryRequest: 5Mi
cpuRequest: 25m
image: "k8s.gcr.io/dns/k8s-dns-node-cache:1.20.0"
```

#### Node termination handler
Expand Down
6 changes: 5 additions & 1 deletion k8s/crds/kops.k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2104,12 +2104,16 @@ spec:
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
description: Enabled activates the node-local-dns addon.
type: boolean
forwardToKubeDNS:
description: If enabled, nodelocal dns will use kubedns as
a default upstream
type: boolean
image:
description: Image overrides the default docker image used
for node-local-dns addon.
type: string
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
Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/kops/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,10 @@ type KubeDNSConfig struct {

// NodeLocalDNSConfig are options of the node-local-dns
type NodeLocalDNSConfig struct {
// Enabled activates the node-local-dns addon
// Enabled activates the node-local-dns addon.
Enabled *bool `json:"enabled,omitempty"`
// Image overrides the default docker image used for node-local-dns addon.
Image *string `json:"image,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"`
// If enabled, nodelocal dns will use kubedns as a default upstream
Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/kops/v1alpha2/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,10 @@ type KubeDNSConfig struct {

// NodeLocalDNSConfig are options of the node-local-dns
type NodeLocalDNSConfig struct {
// Enabled activates the node-local-dns addon
// Enabled activates the node-local-dns addon.
Enabled *bool `json:"enabled,omitempty"`
// Image overrides the default docker image used for node-local-dns addon.
Image *string `json:"image,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"`
// If enabled, nodelocal dns will use kubedns as a default upstream
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pkg/apis/kops/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/model/components/kubedns.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,9 @@ func (b *KubeDnsOptionsBuilder) BuildOptions(o interface{}) error {
nodeLocalDNS.CPURequest = &defaultCPURequest
}

if nodeLocalDNS.Image == nil {
nodeLocalDNS.Image = fi.String("k8s.gcr.io/dns/k8s-dns-node-cache:1.20.0")
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ spec:
operator: "Exists"
containers:
- name: node-cache
image: k8s.gcr.io/dns/k8s-dns-node-cache:1.17.4
image: {{ KubeDNS.NodeLocalDNS.Image }}
resources:
requests:
cpu: {{ KubeDNS.NodeLocalDNS.CPURequest }}
Expand Down

0 comments on commit 31f49ae

Please sign in to comment.