diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2021-03-24 08:23:03 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-04-02 10:07:39 +0200 |
commit | 1ab07437d4c6c787ec30563fd4a52c162bd689a2 (patch) | |
tree | 57ea472fc09df037464b180f738fdc66f2762c03 | |
parent | 521642ab84512aff7e4df952b0725703f1a70779 (diff) |
Provide support for air gapped env for ims
Sometimes, tested Kubernetes doesn't have direct access to Internet but
access through repository mirrors.
This patch handles this case for ims test cases.
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I3b5e78fcf43ca7af6bcfd2d87fa4bb0705373697
(cherry picked from commit 9c95b5f46e57365c1f6e7e5c9073f7fe2ad48a66)
25 files changed, 82 insertions, 66 deletions
@@ -123,7 +123,7 @@ sudo docker run --env-file env \ To test a Kubernetes without access to Internet, repository mirrors needs to be provided. -Currently, only rally and security tests supports this feature. +Currently, only ims, rally and security tests supports this feature. There's two ways for providing the repository mirrors: @@ -133,6 +133,7 @@ There's two ways for providing the repository mirrors: - `DOCKERHUB_REPO` for DockerHub repository (`docker.io`) - `GCR_REPO` for Google Cloud repository (`gcr.io`) - `K8S_GCR_REPO` for Kubernetes repository (`k8s.gcr.io`) + - `QUAY_REPO` for Quay repository (`quay.io`) All needed images are given in [functest-kubernetes/ci/images.txt](functest-kubernetes/ci/images.txt) diff --git a/functest_kubernetes/ims/astaire-depl.yaml b/functest_kubernetes/ims/astaire-depl.yaml index 2ceebfde..d00b790b 100644 --- a/functest_kubernetes/ims/astaire-depl.yaml +++ b/functest_kubernetes/ims/astaire-depl.yaml @@ -15,10 +15,10 @@ spec: terminationGracePeriodSeconds: 120 initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-astaire:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-astaire:hunter" name: astaire ports: - containerPort: 22 @@ -47,7 +47,7 @@ spec: preStop: exec: command: ["/bin/bash", "-c", "/usr/bin/pre-stop"] - - image: busybox:1.28 + - image: {{ dockerhub_repo }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/astaire/astaire_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/bono-depl.yaml b/functest_kubernetes/ims/bono-depl.yaml index d8507165..3537927e 100644 --- a/functest_kubernetes/ims/bono-depl.yaml +++ b/functest_kubernetes/ims/bono-depl.yaml @@ -15,10 +15,10 @@ spec: spec: initContainers: - name: wait-on-sprout - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup sprout; do echo waiting for sprout to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-bono:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-bono:hunter" name: bono ports: - containerPort: 22 @@ -54,7 +54,7 @@ spec: volumeMounts: - name: bonologs mountPath: /var/log/bono - - image: busybox:1.28 + - image: {{ dockerhub_repo }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/bono/bono_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/cassandra-depl.yaml b/functest_kubernetes/ims/cassandra-depl.yaml index 50f8c87c..8f33abc5 100644 --- a/functest_kubernetes/ims/cassandra-depl.yaml +++ b/functest_kubernetes/ims/cassandra-depl.yaml @@ -14,10 +14,10 @@ spec: spec: initContainers: - name: wait-on-etcd - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup etcd; do echo waiting for etcd to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-cassandra:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-cassandra:hunter" name: cassandra ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/chronos-depl.yaml b/functest_kubernetes/ims/chronos-depl.yaml index 5f753f1f..cd9c8bcc 100644 --- a/functest_kubernetes/ims/chronos-depl.yaml +++ b/functest_kubernetes/ims/chronos-depl.yaml @@ -16,11 +16,11 @@ spec: spec: terminationGracePeriodSeconds: 120 initContainers: - - name: wait-on-cassandra - image: busybox:1.28 + - name: {{ dockerhub_repo }}/wait-on-cassandra + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-chronos:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-chronos:hunter" name: chronos ports: - containerPort: 22 @@ -48,7 +48,7 @@ spec: preStop: exec: command: ["/bin/bash", "-c", "/usr/bin/pre-stop"] - - image: busybox:1.28 + - image: {{ dockerhub_repo }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/chronos/chronos_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/ellis-depl.yaml b/functest_kubernetes/ims/ellis-depl.yaml index 9403dbbe..6d69d62b 100644 --- a/functest_kubernetes/ims/ellis-depl.yaml +++ b/functest_kubernetes/ims/ellis-depl.yaml @@ -14,13 +14,13 @@ spec: spec: initContainers: - name: wait-on-homestead-prov - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup homestead-prov; do echo waiting for homestead-prov to start ...; sleep 2; done'] - name: wait-on-sprout - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup sprout; do echo waiting for sprout to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-ellis:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-ellis:hunter" name: ellis ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/etcd-depl.yaml b/functest_kubernetes/ims/etcd-depl.yaml index c9e628ff..0fc50cb6 100644 --- a/functest_kubernetes/ims/etcd-depl.yaml +++ b/functest_kubernetes/ims/etcd-depl.yaml @@ -45,7 +45,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name - image: quay.io/coreos/etcd:v2.2.5 + image: {{ quay_repo }}/coreos/etcd:v2.2.5 name: etcd ports: - containerPort: 2379 diff --git a/functest_kubernetes/ims/helm/templates/astaire-depl.yaml b/functest_kubernetes/ims/helm/templates/astaire-depl.yaml index 11fcb1d6..13bf0001 100644 --- a/functest_kubernetes/ims/helm/templates/astaire-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/astaire-depl.yaml @@ -15,10 +15,10 @@ spec: terminationGracePeriodSeconds: 120 initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-astaire:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-astaire:{{ .Values.image.tag }}" name: astaire ports: - containerPort: 22 @@ -47,7 +47,7 @@ spec: preStop: exec: command: ["/bin/bash", "-c", "/usr/bin/pre-stop"] - - image: busybox:1.28 + - image: {{ .Values.repo.dockerHub }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/astaire/astaire_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/helm/templates/bono-depl.yaml b/functest_kubernetes/ims/helm/templates/bono-depl.yaml index d3fb1b82..2ab749b4 100644 --- a/functest_kubernetes/ims/helm/templates/bono-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/bono-depl.yaml @@ -15,10 +15,10 @@ spec: spec: initContainers: - name: wait-on-sprout - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup sprout; do echo waiting for sprout to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-bono:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-bono:{{ .Values.image.tag }}" name: bono ports: - containerPort: 22 @@ -54,7 +54,7 @@ spec: volumeMounts: - name: bonologs mountPath: /var/log/bono - - image: busybox:1.28 + - image: {{ .Values.repo.dockerHub }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/bono/bono_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/helm/templates/cassandra-depl.yaml b/functest_kubernetes/ims/helm/templates/cassandra-depl.yaml index fb04a78f..d1850f52 100644 --- a/functest_kubernetes/ims/helm/templates/cassandra-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/cassandra-depl.yaml @@ -14,10 +14,10 @@ spec: spec: initContainers: - name: wait-on-etcd - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup etcd; do echo waiting for etcd to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-cassandra:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-cassandra:{{ .Values.image.tag }}" name: cassandra ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/helm/templates/chronos-depl.yaml b/functest_kubernetes/ims/helm/templates/chronos-depl.yaml index 641ba479..6188754e 100644 --- a/functest_kubernetes/ims/helm/templates/chronos-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/chronos-depl.yaml @@ -17,10 +17,10 @@ spec: terminationGracePeriodSeconds: 120 initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-chronos:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-chronos:{{ .Values.image.tag }}" name: chronos ports: - containerPort: 22 @@ -48,7 +48,7 @@ spec: preStop: exec: command: ["/bin/bash", "-c", "/usr/bin/pre-stop"] - - image: busybox:1.28 + - image: {{ .Values.repo.dockerHub }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/chronos/chronos_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/helm/templates/ellis-depl.yaml b/functest_kubernetes/ims/helm/templates/ellis-depl.yaml index 0a290139..c8dd9232 100644 --- a/functest_kubernetes/ims/helm/templates/ellis-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/ellis-depl.yaml @@ -14,13 +14,13 @@ spec: spec: initContainers: - name: wait-on-homestead-prov - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup homestead-prov; do echo waiting for homestead-prov to start ...; sleep 2; done'] - name: wait-on-sprout - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup sprout; do echo waiting for sprout to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-ellis:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-ellis:{{ .Values.image.tag }}" name: ellis ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/helm/templates/etcd-depl.yaml b/functest_kubernetes/ims/helm/templates/etcd-depl.yaml index c9e628ff..33fc2e81 100644 --- a/functest_kubernetes/ims/helm/templates/etcd-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/etcd-depl.yaml @@ -45,7 +45,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name - image: quay.io/coreos/etcd:v2.2.5 + image: {{ .Values.repo.quay }}//coreos/etcd:v2.2.5 name: etcd ports: - containerPort: 2379 diff --git a/functest_kubernetes/ims/helm/templates/homer-depl.yaml b/functest_kubernetes/ims/helm/templates/homer-depl.yaml index 01bf9cdc..073124f1 100644 --- a/functest_kubernetes/ims/helm/templates/homer-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/homer-depl.yaml @@ -14,10 +14,10 @@ spec: spec: initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-homer:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-homer:{{ .Values.image.tag }}" name: homer ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/helm/templates/homestead-depl.yaml b/functest_kubernetes/ims/helm/templates/homestead-depl.yaml index 782ff16d..4e7f86a6 100644 --- a/functest_kubernetes/ims/helm/templates/homestead-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/homestead-depl.yaml @@ -15,13 +15,13 @@ spec: spec: initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] - name: wait-on-astaire - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup astaire; do echo waiting for astaire to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-homestead:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-homestead:{{ .Values.image.tag }}" name: homestead ports: - containerPort: 22 @@ -44,7 +44,7 @@ spec: volumeMounts: - name: homesteadlogs mountPath: /var/log/homestead - - image: busybox:1.28 + - image: {{ .Values.repo.dockerHub }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/homestead/homestead_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml b/functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml index 59ec4e26..49e3e4b3 100644 --- a/functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml @@ -15,10 +15,10 @@ spec: spec: initContainers: - name: wait-on-homestead - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup homestead; do echo waiting for homestead to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-homestead-prov:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-homestead-prov:{{ .Values.image.tag }}" name: homestead-prov ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/helm/templates/ralf-depl.yaml b/functest_kubernetes/ims/helm/templates/ralf-depl.yaml index b052eea6..e115ee25 100644 --- a/functest_kubernetes/ims/helm/templates/ralf-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/ralf-depl.yaml @@ -15,10 +15,10 @@ spec: spec: initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-ralf:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-ralf:{{ .Values.image.tag }}" name: ralf ports: - containerPort: 22 @@ -41,7 +41,7 @@ spec: volumeMounts: - name: ralflogs mountPath: /var/log/ralf - - image: busybox:1.28 + - image: {{ .Values.repo.dockerHub }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/ralf/ralf_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/helm/templates/sprout-depl.yaml b/functest_kubernetes/ims/helm/templates/sprout-depl.yaml index 1ee4701f..dd7ef49e 100644 --- a/functest_kubernetes/ims/helm/templates/sprout-depl.yaml +++ b/functest_kubernetes/ims/helm/templates/sprout-depl.yaml @@ -15,16 +15,16 @@ spec: spec: initContainers: - name: wait-on-ralf - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup ralf; do echo waiting for ralf to start ...; sleep 2; done'] - name: wait-on-chronos - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup chronos; do echo waiting for chronos to start ...; sleep 2; done'] - name: wait-on-homestead - image: busybox:1.28 + image: {{ .Values.repo.dockerHub }}/busybox:1.28 command: ['sh', '-c', 'until nslookup homestead; do echo waiting for homestead to start ...; sleep 2; done'] containers: - - image: "{{ .Values.image.path }}-sprout:{{ .Values.image.tag }}" + - image: "{{ .Values.repo.dockerHub }}/{{ .Values.image.path }}-sprout:{{ .Values.image.tag }}" name: sprout ports: - containerPort: 22 @@ -47,7 +47,7 @@ spec: volumeMounts: - name: sproutlogs mountPath: /var/log/sprout - - image: busybox:1.28 + - image: {{ .Values.repo.dockerHub }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/sprout/sprout_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/helm/values.yaml b/functest_kubernetes/ims/helm/values.yaml index b2cb3272..03866e33 100644 --- a/functest_kubernetes/ims/helm/values.yaml +++ b/functest_kubernetes/ims/helm/values.yaml @@ -4,3 +4,6 @@ image: path: ollivier/clearwater tag: hunter +repo: + dockerHub: docker.io + quay: quay.io diff --git a/functest_kubernetes/ims/homer-depl.yaml b/functest_kubernetes/ims/homer-depl.yaml index 564b2374..665d618e 100644 --- a/functest_kubernetes/ims/homer-depl.yaml +++ b/functest_kubernetes/ims/homer-depl.yaml @@ -14,10 +14,10 @@ spec: spec: initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-homer:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-homer:hunter" name: homer ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/homestead-depl.yaml b/functest_kubernetes/ims/homestead-depl.yaml index 82ea0cef..d8b8a65f 100644 --- a/functest_kubernetes/ims/homestead-depl.yaml +++ b/functest_kubernetes/ims/homestead-depl.yaml @@ -15,13 +15,13 @@ spec: spec: initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] - name: wait-on-astaire - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup astaire; do echo waiting for astaire to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-homestead:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-homestead:hunter" name: homestead ports: - containerPort: 22 @@ -44,7 +44,7 @@ spec: volumeMounts: - name: homesteadlogs mountPath: /var/log/homestead - - image: busybox:1.28 + - image: {{ dockerhub_repo }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/homestead/homestead_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/homestead-prov-depl.yaml b/functest_kubernetes/ims/homestead-prov-depl.yaml index c194cea9..efcbd048 100644 --- a/functest_kubernetes/ims/homestead-prov-depl.yaml +++ b/functest_kubernetes/ims/homestead-prov-depl.yaml @@ -15,10 +15,10 @@ spec: spec: initContainers: - name: wait-on-homestead - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup homestead; do echo waiting for homestead to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-homestead-prov:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-homestead-prov:hunter" name: homestead-prov ports: - containerPort: 22 diff --git a/functest_kubernetes/ims/ims.py b/functest_kubernetes/ims/ims.py index adb46023..49a66370 100644 --- a/functest_kubernetes/ims/ims.py +++ b/functest_kubernetes/ims/ims.py @@ -13,11 +13,13 @@ from __future__ import division import abc import logging +import os import time import subprocess import re import yaml +from jinja2 import Template from kubernetes import client from kubernetes import config from kubernetes import watch @@ -39,6 +41,8 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes test_image_name = "ollivier/clearwater-live-test:hunter" test_container_name = "live-test" ns_generate_name = "ims-" + dockerhub_repo = os.getenv("MIRROR_REPO", "docker.io") + quay_repo = os.getenv("MIRROR_REPO", "quay.io") __logger = logging.getLogger(__name__) @@ -218,7 +222,12 @@ class K8sVims(Vims): with open(pkg_resources.resource_filename( 'functest_kubernetes', 'ims/{}-depl.yaml'.format(deployment))) as yfile: - body = yaml.safe_load(yfile) + template = Template(yfile.read()) + body = yaml.safe_load(template.render( + dockerhub_repo=os.getenv( + "DOCKERHUB_REPO", self.dockerhub_repo), + quay_repo=os.getenv( + "QUAY_REPO", self.quay_repo))) resp = self.appsv1.create_namespaced_deployment( body=body, namespace=self.namespace) self.__logger.info("Deployment %s created", resp.metadata.name) @@ -270,8 +279,11 @@ class HelmVims(Vims): See https://github.com/Metaswitch/clearwater-docker for more details """ + dockerhub_repo = os.getenv("DOCKERHUB_REPO", self.dockerhub_repo) + quay_repo = os.getenv("QUAY_REPO", self.quay_repo) cmd = [ - "helm", "install", "clearwater", + "helm", "install", "clearwater", "--set", + "repo.dockerHub={},repo.quay={}".format(dockerhub_repo, quay_repo), pkg_resources.resource_filename("functest_kubernetes", "ims/helm"), "-n", self.namespace] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) diff --git a/functest_kubernetes/ims/ralf-depl.yaml b/functest_kubernetes/ims/ralf-depl.yaml index de2b93ec..c1ce59ca 100644 --- a/functest_kubernetes/ims/ralf-depl.yaml +++ b/functest_kubernetes/ims/ralf-depl.yaml @@ -15,10 +15,10 @@ spec: spec: initContainers: - name: wait-on-cassandra - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-ralf:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-ralf:hunter" name: ralf ports: - containerPort: 22 @@ -41,7 +41,7 @@ spec: volumeMounts: - name: ralflogs mountPath: /var/log/ralf - - image: busybox:1.28 + - image: {{ dockerhub_repo }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/ralf/ralf_current.txt" ] volumeMounts: diff --git a/functest_kubernetes/ims/sprout-depl.yaml b/functest_kubernetes/ims/sprout-depl.yaml index 5e182483..b3840a8e 100644 --- a/functest_kubernetes/ims/sprout-depl.yaml +++ b/functest_kubernetes/ims/sprout-depl.yaml @@ -15,16 +15,16 @@ spec: spec: initContainers: - name: wait-on-ralf - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup ralf; do echo waiting for ralf to start ...; sleep 2; done'] - name: wait-on-chronos - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup chronos; do echo waiting for chronos to start ...; sleep 2; done'] - name: wait-on-homestead - image: busybox:1.28 + image: {{ dockerhub_repo }}/busybox:1.28 command: ['sh', '-c', 'until nslookup homestead; do echo waiting for homestead to start ...; sleep 2; done'] containers: - - image: "ollivier/clearwater-sprout:hunter" + - image: "{{ dockerhub_repo }}/ollivier/clearwater-sprout:hunter" name: sprout ports: - containerPort: 22 @@ -47,7 +47,7 @@ spec: volumeMounts: - name: sproutlogs mountPath: /var/log/sprout - - image: busybox:1.28 + - image: {{ dockerhub_repo }}/busybox:1.28 name: tailer command: [ "tail", "-F", "/var/log/sprout/sprout_current.txt" ] volumeMounts: |