submit custom operator images

This commit is contained in:
Sergey Dudoladov 2019-05-02 11:46:14 +02:00
parent 806ca7ba81
commit 30e7445c80
5 changed files with 29 additions and 4 deletions

View File

@ -92,7 +92,6 @@ test:
hack/verify-codegen.sh hack/verify-codegen.sh
@go test ./... @go test ./...
e2e: e2e: docker
e2e/run.sh e2e/run.sh
# TODO run before tests once they are implemented completely
flake8 --exit-zero flake8 --exit-zero

View File

@ -4,4 +4,3 @@ nodes:
- role: control-plane - role: control-plane
- role: worker - role: worker
- role: worker - role: worker
- role: worker

View File

@ -18,5 +18,8 @@ kind create cluster --name ${cluster_name} --config ./e2e/kind-config-smoke-test
export KUBECONFIG="$(kind get kubeconfig-path --name=${cluster_name})" export KUBECONFIG="$(kind get kubeconfig-path --name=${cluster_name})"
kubectl cluster-info kubectl cluster-info
version=$(git describe --tags --always --dirty)
kind load docker-image "registry.opensource.zalan.do/acid/postgres-operator:${version}" --name ${cluster_name}
python3 -m unittest discover --start-directory e2e/tests/ && python3 -m unittest discover --start-directory e2e/tests/ &&
kind delete cluster --name ${cluster_name} kind delete cluster --name ${cluster_name}

View File

@ -4,7 +4,7 @@ from kubernetes import client, config, utils
from pprint import pprint from pprint import pprint
import timeout_decorator import timeout_decorator
import subprocess import subprocess
import git
class K8sApi: class K8sApi:
@ -13,6 +13,8 @@ class K8sApi:
self.k8s_client = client.ApiClient() self.k8s_client = client.ApiClient()
self.core_v1 = client.CoreV1Api() self.core_v1 = client.CoreV1Api()
self.crd_api = client.CustomObjectsApi() self.crd_api = client.CustomObjectsApi()
self.apps_v1 = client.AppsV1Api()
class SmokeTestCase(unittest.TestCase): class SmokeTestCase(unittest.TestCase):
@ -41,6 +43,26 @@ class SmokeTestCase(unittest.TestCase):
for filename in ["configmap.yaml", "postgres-operator.yaml"]: for filename in ["configmap.yaml", "postgres-operator.yaml"]:
path = "manifests/" + filename path = "manifests/" + filename
utils.create_from_yaml(k8s_api.k8s_client, path) utils.create_from_yaml(k8s_api.k8s_client, path)
# submit most recent operator image built locally; see VERSION in Makefile
repo = git.Repo(".")
version = repo.git.describe("--tags", "--always", "--dirty")
body = {
"spec": {
"template": {
"spec": {
"containers": [
{
"name" : "postgres-operator",
"image": "registry.opensource.zalan.do/acid/postgres-operator:" + version
}
]
}
}
}
}
k8s_api.apps_v1.patch_namespaced_deployment("postgres-operator", "default", body)
pod_phase = None pod_phase = None
while pod_phase != 'Running': while pod_phase != 'Running':

View File

@ -1,2 +1,4 @@
kubernetes kubernetes
flake8 flake8
git
timeout_decorator