Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Correctly sets DNS imageRepository when custom repositories are used #2832

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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