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:
- `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)
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
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:
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
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:
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
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
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:
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
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
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
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:
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
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:
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
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
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:
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
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
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
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
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:
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
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
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:
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
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:
image:
path: ollivier/clearwater
tag: hunter
+repo:
+ dockerHub: docker.io
+ quay: quay.io
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
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
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:
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
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
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__)
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)
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)
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
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:
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
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: