Skip to content

Commit

Permalink
Use 'coredns' constant to identify container image name
Browse files Browse the repository at this point in the history
  • Loading branch information
gab-satchi committed Apr 2, 2020
1 parent 1c4935e commit fa18c56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions controlplane/kubeadm/internal/workload_cluster_coredns.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ func (w *Workload) getCoreDNSInfo(ctx context.Context, clusterConfig *kubeadmv1.
// Handle imageRepository.
toImageRepository := fmt.Sprintf("%s/%s", reference.Domain(parsedImage), reference.Path(parsedImage))
if clusterConfig.ImageRepository != "" {
toImageRepository = fmt.Sprintf("%s/%s", clusterConfig.ImageRepository, reference.Path(parsedImage))
toImageRepository = fmt.Sprintf("%s/%s", clusterConfig.ImageRepository, coreDNSKey)
}
if clusterConfig.DNS.ImageRepository != "" {
toImageRepository = fmt.Sprintf("%s/%s", clusterConfig.DNS.ImageRepository, reference.Path(parsedImage))
toImageRepository = fmt.Sprintf("%s/%s", clusterConfig.DNS.ImageRepository, coreDNSKey)
}

// Handle imageTag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func TestUpdateCoreDNSCorefile(t *testing.T) {

func TestGetCoreDNSInfo(t *testing.T) {
t.Run("get coredns info", func(t *testing.T) {
expectedImage := "k8s.gcr.io/coredns:1.6.2"
expectedImage := "k8s.gcr.io/some-folder/coredns:1.6.2"
depl := &appsv1.Deployment{
TypeMeta: v1.TypeMeta{
Kind: "Deployment",
Expand Down Expand Up @@ -345,14 +345,14 @@ func TestGetCoreDNSInfo(t *testing.T) {
name: "uses global config ImageRepository if DNS ImageRepository is not set",
objs: []runtime.Object{depl, cm},
clusterConfig: &kubeadmv1.ClusterConfiguration{
ImageRepository: "globalRepo",
ImageRepository: "globalRepo/sub-path",
DNS: kubeadmv1.DNS{
ImageMeta: kubeadmv1.ImageMeta{
ImageTag: "1.7.2-foobar.1",
},
},
},
toImage: "globalRepo/coredns:1.7.2-foobar.1",
toImage: "globalRepo/sub-path/coredns:1.7.2-foobar.1",
},
{
name: "uses DNS ImageRepository config if both global and DNS-level are set",
Expand Down

0 comments on commit fa18c56

Please sign in to comment.