From ad99c818faa2362ed62fd196676beab45801c6d4 Mon Sep 17 00:00:00 2001 From: Yaroslav-Lahtachev Date: Wed, 27 Apr 2022 12:00:47 +0300 Subject: [PATCH] [MANOPD-75552] Add port replacement for registry (#150) * add port replacement * add port replacement --- kubemarine/kubernetes/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) 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"]