From 998438b8a8c0a2ae64f6fd4940e1dbe1c78b65d5 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Tue, 16 Mar 2021 14:09:29 +0100 Subject: Provide support for air gapped env for rally Sometimes, tested Kubernetes doesn't have direct access to Internet but access through repository mirrors. This patch handles this case for rally test case. There's two ways for providing the repository mirrors: - Give an environment variable (`MIRROR_REPO`) which gives a repository mirro with all needed images. - Gives an environment variable per needed repo: - `DOCKERHUB_REPO` for DockerHub repository (`docker.io`) - `GCR_REPO` for Google Cloud repository (`gcr.io`) - `K8S_GCR_REPO` for Kubernetes repository (`k8s.gcr.io`) Needed images list has also been extracted so Kubernetes administrator can easily upload these images to the mirror if the mirror also doesn't have access to Internet. Signed-off-by: Sylvain Desbureaux Change-Id: I2ea6622b79f7e3c3c63c1441c4dab48e9bc4fb1a (cherry picked from commit b26ac308d4d441195fcd804d4d0ff36356fa8a90) --- functest_kubernetes/rally/rally_kubernetes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'functest_kubernetes/rally/rally_kubernetes.py') diff --git a/functest_kubernetes/rally/rally_kubernetes.py b/functest_kubernetes/rally/rally_kubernetes.py index fb20296e..f5d7e955 100644 --- a/functest_kubernetes/rally/rally_kubernetes.py +++ b/functest_kubernetes/rally/rally_kubernetes.py @@ -31,6 +31,9 @@ class RallyKubernetes(testcase.TestCase): concurrency = 1 times = 1 namespaces_count = 1 + dockerhub_repo = os.getenv("MIRROR_REPO", "docker.io") + gcr_repo = os.getenv("MIRROR_REPO", "gcr.io") + k8s_gcr_repo = os.getenv("MIRROR_REPO", "k8s.gcr.io") def __init__(self, **kwargs): super(RallyKubernetes, self).__init__(**kwargs) @@ -68,7 +71,10 @@ class RallyKubernetes(testcase.TestCase): concurrency=kwargs.get("concurrency", self.concurrency), times=kwargs.get("times", self.times), namespaces_count=kwargs.get( - "namespaces_count", self.namespaces_count))) + "namespaces_count", self.namespaces_count), + dockerhub_repo=os.getenv("DOCKERHUB_REPO", self.dockerhub_repo), + gcr_repo=os.getenv("GCR_REPO", self.gcr_repo), + k8s_gcr_repo=os.getenv("K8S_GCR_REPO", self.k8s_gcr_repo))) rapi.task.validate(deployment='my-kubernetes', config=task) task_instance = rapi.task.create(deployment='my-kubernetes') rapi.task.start( -- cgit 1.2.3-korg