mirror of https://github.com/k3s-io/k3s
kubeadm: Use GetGenericImage for kube-dns
As kube-dns transitioned to fat manifests, it's no longer required to use arch suffixed images. This change makes use of fat manifests for kube-dns and removes the last few calls to the GetGenericArchImage function, thus removing GetGenericArchImage too. Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>pull/8/head
parent
e3dbad3211
commit
68ed2bdd35
|
@ -18,7 +18,6 @@ package images
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||
|
@ -31,11 +30,6 @@ func GetGenericImage(prefix, image, tag string) string {
|
|||
return fmt.Sprintf("%s/%s:%s", prefix, image, tag)
|
||||
}
|
||||
|
||||
// GetGenericArchImage generates and returns an image based on the current runtime arch
|
||||
func GetGenericArchImage(prefix, image, tag string) string {
|
||||
return fmt.Sprintf("%s/%s-%s:%s", prefix, image, runtime.GOARCH, tag)
|
||||
}
|
||||
|
||||
// GetKubeControlPlaneImage generates and returns the image for the core Kubernetes components or returns the unified control plane image if specified
|
||||
func GetKubeControlPlaneImage(image string, cfg *kubeadmapi.ClusterConfiguration) string {
|
||||
if cfg.UnifiedControlPlaneImage != "" {
|
||||
|
@ -79,9 +73,9 @@ func GetAllImages(cfg *kubeadmapi.ClusterConfiguration) []string {
|
|||
if features.Enabled(cfg.FeatureGates, features.CoreDNS) {
|
||||
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, GetGenericImage(cfg.ImageRepository, "k8s-dns-kube-dns", constants.KubeDNSVersion))
|
||||
imgs = append(imgs, GetGenericImage(cfg.ImageRepository, "k8s-dns-sidecar", constants.KubeDNSVersion))
|
||||
imgs = append(imgs, GetGenericImage(cfg.ImageRepository, "k8s-dns-dnsmasq-nanny", constants.KubeDNSVersion))
|
||||
}
|
||||
|
||||
return imgs
|
||||
|
|
|
@ -18,7 +18,6 @@ package images
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -45,19 +44,6 @@ func TestGetGenericImage(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetGenericArchImage(t *testing.T) {
|
||||
const (
|
||||
prefix = "foo"
|
||||
image = "bar"
|
||||
tag = "baz"
|
||||
)
|
||||
expected := fmt.Sprintf("%s/%s-%s:%s", prefix, image, runtime.GOARCH, tag)
|
||||
actual := GetGenericArchImage(prefix, image, tag)
|
||||
if actual != expected {
|
||||
t.Errorf("failed GetGenericArchImage:\n\texpected: %s\n\t actual: %s", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetKubeControlPlaneImage(t *testing.T) {
|
||||
var tests = []struct {
|
||||
image string
|
||||
|
|
|
@ -19,7 +19,6 @@ package dns
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/mholt/caddy/caddyfile"
|
||||
|
@ -97,9 +96,8 @@ func kubeDNSAddon(cfg *kubeadmapi.InitConfiguration, client clientset.Interface)
|
|||
}
|
||||
|
||||
dnsDeploymentBytes, err := kubeadmutil.ParseTemplate(KubeDNSDeployment,
|
||||
struct{ ImageRepository, Arch, Version, DNSBindAddr, DNSProbeAddr, DNSDomain, MasterTaintKey string }{
|
||||
struct{ ImageRepository, Version, DNSBindAddr, DNSProbeAddr, DNSDomain, MasterTaintKey string }{
|
||||
ImageRepository: cfg.ImageRepository,
|
||||
Arch: runtime.GOARCH,
|
||||
Version: kubeadmconstants.KubeDNSVersion,
|
||||
DNSBindAddr: dnsBindAddr,
|
||||
DNSProbeAddr: dnsProbeAddr,
|
||||
|
|
|
@ -95,9 +95,8 @@ func TestCompileManifests(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
manifest: KubeDNSDeployment,
|
||||
data: struct{ ImageRepository, Arch, Version, DNSBindAddr, DNSProbeAddr, DNSDomain, MasterTaintKey string }{
|
||||
data: struct{ ImageRepository, Version, DNSBindAddr, DNSProbeAddr, DNSDomain, MasterTaintKey string }{
|
||||
ImageRepository: "foo",
|
||||
Arch: "foo",
|
||||
Version: "foo",
|
||||
DNSBindAddr: "foo",
|
||||
DNSProbeAddr: "foo",
|
||||
|
|
|
@ -50,7 +50,7 @@ spec:
|
|||
optional: true
|
||||
containers:
|
||||
- name: kubedns
|
||||
image: {{ .ImageRepository }}/k8s-dns-kube-dns-{{ .Arch }}:{{ .Version }}
|
||||
image: {{ .ImageRepository }}/k8s-dns-kube-dns:{{ .Version }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
resources:
|
||||
# TODO: Set memory limits when we've profiled the container for large
|
||||
|
@ -102,7 +102,7 @@ spec:
|
|||
- name: kube-dns-config
|
||||
mountPath: /kube-dns-config
|
||||
- name: dnsmasq
|
||||
image: {{ .ImageRepository }}/k8s-dns-dnsmasq-nanny-{{ .Arch }}:{{ .Version }}
|
||||
image: {{ .ImageRepository }}/k8s-dns-dnsmasq-nanny:{{ .Version }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
|
@ -143,7 +143,7 @@ spec:
|
|||
- name: kube-dns-config
|
||||
mountPath: /etc/k8s/dns/dnsmasq-nanny
|
||||
- name: sidecar
|
||||
image: {{ .ImageRepository }}/k8s-dns-sidecar-{{ .Arch }}:{{ .Version }}
|
||||
image: {{ .ImageRepository }}/k8s-dns-sidecar:{{ .Version }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
|
@ -174,8 +174,6 @@ spec:
|
|||
operator: Exists
|
||||
- key: {{ .MasterTaintKey }}
|
||||
effect: NoSchedule
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/arch: {{ .Arch }}
|
||||
`
|
||||
|
||||
// KubeDNSService is the kube-dns Service manifest
|
||||
|
|
Loading…
Reference in New Issue