From c772287e0daa9c46564d175cb60f1917ff31f259 Mon Sep 17 00:00:00 2001 From: erthalion <9erthalion6@gmail.com> Date: Tue, 7 May 2019 14:27:29 +0200 Subject: [PATCH] Test client --- Makefile | 2 +- e2e/tests/test_smoke.py | 2 +- ...ice-account-rbac.yaml => clusterrole.yaml} | 25 +------------------ manifests/clusterrolebinding.yaml | 14 +++++++++++ manifests/serviceaccount.yaml | 5 ++++ 5 files changed, 22 insertions(+), 26 deletions(-) rename manifests/{operator-service-account-rbac.yaml => clusterrole.yaml} (76%) create mode 100644 manifests/clusterrolebinding.yaml create mode 100644 manifests/serviceaccount.yaml diff --git a/Makefile b/Makefile index 378aa0082..7dcc42772 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ test: @go test ./... e2e-tools: - @pip3 install -r e2e/requirements.txt + @pip3 install --user --upgrade -r e2e/requirements.txt @go get -u sigs.k8s.io/kind # assumes kubectl is already isntalled diff --git a/e2e/tests/test_smoke.py b/e2e/tests/test_smoke.py index bb3b5f5b0..b53157574 100755 --- a/e2e/tests/test_smoke.py +++ b/e2e/tests/test_smoke.py @@ -35,7 +35,7 @@ class SmokeTestCase(unittest.TestCase): # 1. creating RBAC entites with a separate client fails # with "AttributeError: object has no attribute 'select_header_accept'" # 2. utils.create_from_yaml cannot create multiple entites from a single file - subprocess.run(["kubectl", "create", "-f", "manifests/operator-service-account-rbac.yaml"]) + # subprocess.run(["kubectl", "create", "-f", "manifests/operator-service-account-rbac.yaml"]) for filename in ["configmap.yaml", "postgres-operator.yaml"]: utils.create_from_yaml(k8s_api.k8s_client, "manifests/" + filename) diff --git a/manifests/operator-service-account-rbac.yaml b/manifests/clusterrole.yaml similarity index 76% rename from manifests/operator-service-account-rbac.yaml rename to manifests/clusterrole.yaml index 7bd539ac5..8c3f15b67 100644 --- a/manifests/operator-service-account-rbac.yaml +++ b/manifests/clusterrole.yaml @@ -1,10 +1,3 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: zalando-postgres-operator - namespace: default - ---- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole metadata: @@ -137,21 +130,5 @@ rules: - clusterroles verbs: - bind - resourceNames: + resourceNames: - zalando-postgres-operator - ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: zalando-postgres-operator -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: zalando-postgres-operator -subjects: -- kind: ServiceAccount -# note: the cluster role binding needs to be defined -# for every namespace the operator service account lives in. - name: zalando-postgres-operator - namespace: default diff --git a/manifests/clusterrolebinding.yaml b/manifests/clusterrolebinding.yaml new file mode 100644 index 000000000..a9440631d --- /dev/null +++ b/manifests/clusterrolebinding.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: zalando-postgres-operator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: zalando-postgres-operator +subjects: +- kind: ServiceAccount +# note: the cluster role binding needs to be defined +# for every namespace the operator service account lives in. + name: zalando-postgres-operator + namespace: default diff --git a/manifests/serviceaccount.yaml b/manifests/serviceaccount.yaml new file mode 100644 index 000000000..0ee26b853 --- /dev/null +++ b/manifests/serviceaccount.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: zalando-postgres-operator + namespace: default