diff --git a/kubemarine/kubernetes/__init__.py b/kubemarine/kubernetes/__init__.py index 00b8b4b20..4231f60e2 100644 --- a/kubemarine/kubernetes/__init__.py +++ b/kubemarine/kubernetes/__init__.py @@ -755,6 +755,13 @@ def patch_kubeadm_configmap(first_master, cluster): if cluster.context.get('patch_image_repo', False): cluster_config["imageRepository"] = cluster_config["imageRepository"].replace('/k8s.gcr.io', '') + new_image_repo_port = cluster.context.get('patch_image_repo_port', '') + old_image_repo_port = cluster.context.get('old_image_repo_port', '') + if new_image_repo_port and old_image_repo_port: + cluster_config["imageRepository"] = cluster_config["imageRepository"].replace('/k8s.gcr.io', '') + cluster_config["imageRepository"] = cluster_config["imageRepository"].replace(old_image_repo_port, + new_image_repo_port) + if version_higher_or_equal(current_kubernetes_version, version_coredns_path_breakage): cluster_config['dns']['imageRepository'] = "%s/coredns" % cluster_config["imageRepository"]