From f181a858e78f746bd0b16bba924b309003ae5663 Mon Sep 17 00:00:00 2001 From: Aleksey Dukhovniy Date: Mon, 20 Apr 2020 11:28:15 +0200 Subject: [PATCH] Activating instance admission controller for the e2e tests (#1473) Summary: when initializing KUDO manager for the e2e tests we now use the `--webhook InstanceValidation --unsafe-self-signed-webhook-ca` options that activate the instance admission controller (IAC) using the self-signed webhook CA bundle. We must ensure that KUDO manager runs before we begin executing test steps, otherwise, IAC `MutatingWebhookConfiguration` will fail `CREATE` and `UPDATE` requests to the `Instance` resources if the webhook server is not up and running. To achieve this, I added first step to all e2e steps ensuring the `kudo-controller-manager` pod is `Running`. Signed-off-by: Aleksey Dukhovniy --- hack/run-e2e-tests.sh | 2 +- test/e2e/cli-install-uninstall/00-assert.yaml | 17 +++++++-------- test/e2e/cli-install-uninstall/01-assert.yaml | 12 +++++++++++ .../{00-install.yaml => 01-install.yaml} | 0 .../{02-assert.yaml => 03-assert.yaml} | 0 .../{02-errors.yaml => 03-errors.yaml} | 0 .../{02-uninstall.yaml => 03-uninstall.yaml} | 0 test/e2e/terminal-failed-job/00-assert.yaml | 14 ++++++------- test/e2e/terminal-failed-job/01-assert.yaml | 6 +++--- .../{00-install.yaml => 01-install.yaml} | 0 test/e2e/terminal-failed-job/02-assert.yaml | 11 ++++++++++ ...l-timeout.yaml => 02-install-timeout.yaml} | 0 test/e2e/toggle-task/00-assert.yaml | 21 ++++++------------- test/e2e/toggle-task/01-assert.yaml | 7 +++++++ .../{00-install.yaml => 01-install.yaml} | 0 test/e2e/toggle-task/02-assert.yaml | 15 ++++++++----- .../{01-errors.yaml => 02-errors.yaml} | 0 test/e2e/toggle-task/02-update.yaml | 4 ++-- test/e2e/toggle-task/03-assert.yaml | 6 ++++++ .../{01-update.yaml => 03-update.yaml} | 4 ++-- 20 files changed, 73 insertions(+), 46 deletions(-) create mode 100644 test/e2e/cli-install-uninstall/01-assert.yaml rename test/e2e/cli-install-uninstall/{00-install.yaml => 01-install.yaml} (100%) rename test/e2e/cli-install-uninstall/{02-assert.yaml => 03-assert.yaml} (100%) rename test/e2e/cli-install-uninstall/{02-errors.yaml => 03-errors.yaml} (100%) rename test/e2e/cli-install-uninstall/{02-uninstall.yaml => 03-uninstall.yaml} (100%) rename test/e2e/terminal-failed-job/{00-install.yaml => 01-install.yaml} (100%) create mode 100644 test/e2e/terminal-failed-job/02-assert.yaml rename test/e2e/terminal-failed-job/{01-install-timeout.yaml => 02-install-timeout.yaml} (100%) rename test/e2e/toggle-task/{00-install.yaml => 01-install.yaml} (100%) rename test/e2e/toggle-task/{01-errors.yaml => 02-errors.yaml} (100%) create mode 100644 test/e2e/toggle-task/03-assert.yaml rename test/e2e/toggle-task/{01-update.yaml => 03-update.yaml} (71%) diff --git a/hack/run-e2e-tests.sh b/hack/run-e2e-tests.sh index 29b706bb5..98dfe5616 100755 --- a/hack/run-e2e-tests.sh +++ b/hack/run-e2e-tests.sh @@ -13,7 +13,7 @@ docker build . \ -t "kudobuilder/controller:$VERSION" # Generate the kudo.yaml that is used to install KUDO while running e2e-test -./bin/kubectl-kudo init --dry-run --output yaml --kudo-image kudobuilder/controller:$VERSION \ +./bin/kubectl-kudo init --webhook InstanceValidation --unsafe-self-signed-webhook-ca --dry-run --output yaml --kudo-image kudobuilder/controller:$VERSION \ | sed -E -e '/imagePullPolicy/ s/Always/Never/' \ > test/manifests/kudo.yaml diff --git a/test/e2e/cli-install-uninstall/00-assert.yaml b/test/e2e/cli-install-uninstall/00-assert.yaml index 7b5331d6b..dcf97d88b 100644 --- a/test/e2e/cli-install-uninstall/00-assert.yaml +++ b/test/e2e/cli-install-uninstall/00-assert.yaml @@ -1,12 +1,9 @@ -apiVersion: kudo.dev/v1beta1 -kind: Instance +apiVersion: v1 +kind: Pod metadata: - name: first-operator + labels: + app: kudo-manager + control-plane: controller-manager + namespace: kudo-system status: - aggregatedStatus: - status: COMPLETE ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment + phase: Running \ No newline at end of file diff --git a/test/e2e/cli-install-uninstall/01-assert.yaml b/test/e2e/cli-install-uninstall/01-assert.yaml new file mode 100644 index 000000000..7b5331d6b --- /dev/null +++ b/test/e2e/cli-install-uninstall/01-assert.yaml @@ -0,0 +1,12 @@ +apiVersion: kudo.dev/v1beta1 +kind: Instance +metadata: + name: first-operator +status: + aggregatedStatus: + status: COMPLETE +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment diff --git a/test/e2e/cli-install-uninstall/00-install.yaml b/test/e2e/cli-install-uninstall/01-install.yaml similarity index 100% rename from test/e2e/cli-install-uninstall/00-install.yaml rename to test/e2e/cli-install-uninstall/01-install.yaml diff --git a/test/e2e/cli-install-uninstall/02-assert.yaml b/test/e2e/cli-install-uninstall/03-assert.yaml similarity index 100% rename from test/e2e/cli-install-uninstall/02-assert.yaml rename to test/e2e/cli-install-uninstall/03-assert.yaml diff --git a/test/e2e/cli-install-uninstall/02-errors.yaml b/test/e2e/cli-install-uninstall/03-errors.yaml similarity index 100% rename from test/e2e/cli-install-uninstall/02-errors.yaml rename to test/e2e/cli-install-uninstall/03-errors.yaml diff --git a/test/e2e/cli-install-uninstall/02-uninstall.yaml b/test/e2e/cli-install-uninstall/03-uninstall.yaml similarity index 100% rename from test/e2e/cli-install-uninstall/02-uninstall.yaml rename to test/e2e/cli-install-uninstall/03-uninstall.yaml diff --git a/test/e2e/terminal-failed-job/00-assert.yaml b/test/e2e/terminal-failed-job/00-assert.yaml index 1186b631e..dcf97d88b 100644 --- a/test/e2e/terminal-failed-job/00-assert.yaml +++ b/test/e2e/terminal-failed-job/00-assert.yaml @@ -1,11 +1,9 @@ -apiVersion: kudo.dev/v1beta1 -kind: Instance +apiVersion: v1 +kind: Pod metadata: labels: - kudo.dev/operator: failjob-operator -spec: - operatorVersion: - name: failjob-operator-0.1.0 + app: kudo-manager + control-plane: controller-manager + namespace: kudo-system status: - aggregatedStatus: - status: FATAL_ERROR \ No newline at end of file + phase: Running \ No newline at end of file diff --git a/test/e2e/terminal-failed-job/01-assert.yaml b/test/e2e/terminal-failed-job/01-assert.yaml index ce3f42dbe..1186b631e 100644 --- a/test/e2e/terminal-failed-job/01-assert.yaml +++ b/test/e2e/terminal-failed-job/01-assert.yaml @@ -2,10 +2,10 @@ apiVersion: kudo.dev/v1beta1 kind: Instance metadata: labels: - kudo.dev/operator: job-timeout-operator + kudo.dev/operator: failjob-operator spec: operatorVersion: - name: job-timeout-operator-0.1.0 + name: failjob-operator-0.1.0 status: aggregatedStatus: - status: FATAL_ERROR + status: FATAL_ERROR \ No newline at end of file diff --git a/test/e2e/terminal-failed-job/00-install.yaml b/test/e2e/terminal-failed-job/01-install.yaml similarity index 100% rename from test/e2e/terminal-failed-job/00-install.yaml rename to test/e2e/terminal-failed-job/01-install.yaml diff --git a/test/e2e/terminal-failed-job/02-assert.yaml b/test/e2e/terminal-failed-job/02-assert.yaml new file mode 100644 index 000000000..ce3f42dbe --- /dev/null +++ b/test/e2e/terminal-failed-job/02-assert.yaml @@ -0,0 +1,11 @@ +apiVersion: kudo.dev/v1beta1 +kind: Instance +metadata: + labels: + kudo.dev/operator: job-timeout-operator +spec: + operatorVersion: + name: job-timeout-operator-0.1.0 +status: + aggregatedStatus: + status: FATAL_ERROR diff --git a/test/e2e/terminal-failed-job/01-install-timeout.yaml b/test/e2e/terminal-failed-job/02-install-timeout.yaml similarity index 100% rename from test/e2e/terminal-failed-job/01-install-timeout.yaml rename to test/e2e/terminal-failed-job/02-install-timeout.yaml diff --git a/test/e2e/toggle-task/00-assert.yaml b/test/e2e/toggle-task/00-assert.yaml index 76f30ca22..dcf97d88b 100644 --- a/test/e2e/toggle-task/00-assert.yaml +++ b/test/e2e/toggle-task/00-assert.yaml @@ -1,18 +1,9 @@ -apiVersion: kudo.dev/v1beta1 -kind: Instance +apiVersion: v1 +kind: Pod metadata: labels: - kudo.dev/operator: feature-operator -spec: - operatorVersion: - name: feature-operator-0.1.0 + app: kudo-manager + control-plane: controller-manager + namespace: kudo-system status: - aggregatedStatus: - status: COMPLETE ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: feature-operator-cm -data: - foo: "1234" + phase: Running \ No newline at end of file diff --git a/test/e2e/toggle-task/01-assert.yaml b/test/e2e/toggle-task/01-assert.yaml index 16dac2dc6..76f30ca22 100644 --- a/test/e2e/toggle-task/01-assert.yaml +++ b/test/e2e/toggle-task/01-assert.yaml @@ -9,3 +9,10 @@ spec: status: aggregatedStatus: status: COMPLETE +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: feature-operator-cm +data: + foo: "1234" diff --git a/test/e2e/toggle-task/00-install.yaml b/test/e2e/toggle-task/01-install.yaml similarity index 100% rename from test/e2e/toggle-task/00-install.yaml rename to test/e2e/toggle-task/01-install.yaml diff --git a/test/e2e/toggle-task/02-assert.yaml b/test/e2e/toggle-task/02-assert.yaml index f2a1ca6e5..16dac2dc6 100644 --- a/test/e2e/toggle-task/02-assert.yaml +++ b/test/e2e/toggle-task/02-assert.yaml @@ -1,6 +1,11 @@ -apiVersion: v1 -kind: ConfigMap +apiVersion: kudo.dev/v1beta1 +kind: Instance metadata: - name: feature-operator-cm -data: - foo: "1234" + labels: + kudo.dev/operator: feature-operator +spec: + operatorVersion: + name: feature-operator-0.1.0 +status: + aggregatedStatus: + status: COMPLETE diff --git a/test/e2e/toggle-task/01-errors.yaml b/test/e2e/toggle-task/02-errors.yaml similarity index 100% rename from test/e2e/toggle-task/01-errors.yaml rename to test/e2e/toggle-task/02-errors.yaml diff --git a/test/e2e/toggle-task/02-update.yaml b/test/e2e/toggle-task/02-update.yaml index 9424feb16..fd27ad3a7 100644 --- a/test/e2e/toggle-task/02-update.yaml +++ b/test/e2e/toggle-task/02-update.yaml @@ -1,5 +1,5 @@ apiVersion: kudo.dev/v1beta1 kind: TestStep commands: - - command: kubectl kudo update --instance feature-operator-instance -p enable_cm=true - namespaced: true \ No newline at end of file + - command: kubectl kudo update --instance feature-operator-instance -p enable_cm=false + namespaced: true diff --git a/test/e2e/toggle-task/03-assert.yaml b/test/e2e/toggle-task/03-assert.yaml new file mode 100644 index 000000000..f2a1ca6e5 --- /dev/null +++ b/test/e2e/toggle-task/03-assert.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: feature-operator-cm +data: + foo: "1234" diff --git a/test/e2e/toggle-task/01-update.yaml b/test/e2e/toggle-task/03-update.yaml similarity index 71% rename from test/e2e/toggle-task/01-update.yaml rename to test/e2e/toggle-task/03-update.yaml index fd27ad3a7..9424feb16 100644 --- a/test/e2e/toggle-task/01-update.yaml +++ b/test/e2e/toggle-task/03-update.yaml @@ -1,5 +1,5 @@ apiVersion: kudo.dev/v1beta1 kind: TestStep commands: - - command: kubectl kudo update --instance feature-operator-instance -p enable_cm=false - namespaced: true + - command: kubectl kudo update --instance feature-operator-instance -p enable_cm=true + namespaced: true \ No newline at end of file