Skip to content

Commit

Permalink
Merge pull request #2832 from gab-satchi/2810-imageRepo-subpath
Browse files Browse the repository at this point in the history
🐛 Correctly sets DNS imageRepository when custom repositories are used
  • Loading branch information
k8s-ci-robot authored Apr 2, 2020
2 parents 22e254d + fa18c56 commit a9c54ec
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 a9c54ec

Please sign in to comment.