kubeadm: Pull sidecar and dnsmasq-nanny images when using kube-dns

It appears that sidecar and dnsmasq-nanny images are now required for
kube-dns deployment to work correctly. Thus the following default kube-dns
images are used now:

- k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.10
- k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.10
- k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.10

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
This commit is contained in:
Rostislav M. Georgiev 2018-07-23 15:11:35 +03:00
parent 4e0a60a44c
commit fb7ba52341
2 changed files with 43 additions and 3 deletions

View File

@ -80,10 +80,14 @@ func GetAllImages(cfg *kubeadmapi.InitConfiguration) []string {
imgs = append(imgs, GetEtcdImage(cfg))
}
dnsImage := GetGenericArchImage(cfg.ImageRepository, "k8s-dns-kube-dns", constants.KubeDNSVersion)
// Append the appropriate DNS images
if features.Enabled(cfg.FeatureGates, features.CoreDNS) {
dnsImage = fmt.Sprintf("%s/%s:%s", cfg.ImageRepository, constants.CoreDNS, constants.CoreDNSVersion)
imgs = append(imgs, GetGenericImage(cfg.ImageRepository, constants.CoreDNS, constants.CoreDNSVersion))
} else {
imgs = append(imgs, GetGenericArchImage(cfg.ImageRepository, "k8s-dns-kube-dns", constants.KubeDNSVersion))
imgs = append(imgs, GetGenericArchImage(cfg.ImageRepository, "k8s-dns-sidecar", constants.KubeDNSVersion))
imgs = append(imgs, GetGenericArchImage(cfg.ImageRepository, "k8s-dns-dnsmasq-nanny", constants.KubeDNSVersion))
}
imgs = append(imgs, dnsImage)
return imgs
}

View File

@ -211,6 +211,42 @@ func TestGetAllImages(t *testing.T) {
},
expect: constants.Etcd,
},
{
name: "CoreDNS image is returned",
cfg: &kubeadmapi.InitConfiguration{
FeatureGates: map[string]bool{
"CoreDNS": true,
},
},
expect: constants.CoreDNS,
},
{
name: "main kube-dns image is returned",
cfg: &kubeadmapi.InitConfiguration{
FeatureGates: map[string]bool{
"CoreDNS": false,
},
},
expect: "k8s-dns-kube-dns",
},
{
name: "kube-dns sidecar image is returned",
cfg: &kubeadmapi.InitConfiguration{
FeatureGates: map[string]bool{
"CoreDNS": false,
},
},
expect: "k8s-dns-sidecar",
},
{
name: "kube-dns dnsmasq-nanny image is returned",
cfg: &kubeadmapi.InitConfiguration{
FeatureGates: map[string]bool{
"CoreDNS": false,
},
},
expect: "k8s-dns-dnsmasq-nanny",
},
}
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {