From 82c7ff94dbca709598d11fbbb4b1c1e6e558e2ea Mon Sep 17 00:00:00 2001 From: Omer Tuchfeld Date: Thu, 25 Mar 2021 00:03:09 +0200 Subject: [PATCH] Add a workflow to execute single node openshift e2e test on GCP Also created job that runs said workflow in the machine-config-operator master presubmit. The conf step has been removed, there is now conf/aws and conf/gcp separate steps --- ...nshift-machine-config-operator-master.yaml | 4 ++ ...ine-config-operator-master-presubmits.yaml | 69 +++++++++++++++++++ ...penshift-e2e-aws-single-node-workflow.yaml | 2 +- .../openshift/e2e/gcp/single-node/OWNERS | 7 ++ ...e2e-gcp-single-node-workflow.metadata.json | 13 ++++ ...penshift-e2e-gcp-single-node-workflow.yaml | 15 ++++ .../step-registry/single-node/conf/aws/OWNERS | 7 ++ .../single-node-conf-aws-commands.sh} | 5 +- .../single-node-conf-aws-ref.metadata.json} | 2 +- .../single-node-conf-aws-ref.yaml} | 4 +- .../step-registry/single-node/conf/gcp/OWNERS | 7 ++ .../conf/gcp/single-node-conf-gcp-commands.sh | 48 +++++++++++++ .../single-node-conf-gcp-ref.metadata.json | 13 ++++ .../conf/gcp/single-node-conf-gcp-ref.yaml | 10 +++ 14 files changed, 200 insertions(+), 6 deletions(-) create mode 100644 ci-operator/step-registry/openshift/e2e/gcp/single-node/OWNERS create mode 100644 ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.metadata.json create mode 100644 ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.yaml create mode 100644 ci-operator/step-registry/single-node/conf/aws/OWNERS rename ci-operator/step-registry/single-node/conf/{single-node-conf-commands.sh => aws/single-node-conf-aws-commands.sh} (85%) rename ci-operator/step-registry/single-node/conf/{single-node-conf-ref.metadata.json => aws/single-node-conf-aws-ref.metadata.json} (66%) rename ci-operator/step-registry/single-node/conf/{single-node-conf-ref.yaml => aws/single-node-conf-aws-ref.yaml} (73%) create mode 100644 ci-operator/step-registry/single-node/conf/gcp/OWNERS create mode 100644 ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-commands.sh create mode 100644 ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.metadata.json create mode 100644 ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.yaml diff --git a/ci-operator/config/openshift/machine-config-operator/openshift-machine-config-operator-master.yaml b/ci-operator/config/openshift/machine-config-operator/openshift-machine-config-operator-master.yaml index cada1a3821dee..daf637245e2db 100644 --- a/ci-operator/config/openshift/machine-config-operator/openshift-machine-config-operator-master.yaml +++ b/ci-operator/config/openshift/machine-config-operator/openshift-machine-config-operator-master.yaml @@ -177,6 +177,10 @@ tests: steps: cluster_profile: aws workflow: openshift-e2e-aws-single-node +- as: e2e-gcp-single-node + steps: + cluster_profile: gcp + workflow: openshift-e2e-gcp-single-node zz_generated_metadata: branch: master org: openshift diff --git a/ci-operator/jobs/openshift/machine-config-operator/openshift-machine-config-operator-master-presubmits.yaml b/ci-operator/jobs/openshift/machine-config-operator/openshift-machine-config-operator-master-presubmits.yaml index 915807dfa2d64..c6ce55fc2850f 100644 --- a/ci-operator/jobs/openshift/machine-config-operator/openshift-machine-config-operator-master-presubmits.yaml +++ b/ci-operator/jobs/openshift/machine-config-operator/openshift-machine-config-operator-master-presubmits.yaml @@ -685,6 +685,75 @@ presubmits: secret: secretName: result-aggregator trigger: (?m)^/test( | .* )e2e-gcp-op,?($|\s.*) + - agent: kubernetes + always_run: false + branches: + - master + cluster: build01 + context: ci/prow/e2e-gcp-single-node + decorate: true + decoration_config: + skip_cloning: true + labels: + ci-operator.openshift.io/prowgen-controlled: "true" + pj-rehearse.openshift.io/can-be-rehearsed: "true" + name: pull-ci-openshift-machine-config-operator-master-e2e-gcp-single-node + optional: true + rerun_command: /test e2e-gcp-single-node + spec: + containers: + - args: + - --gcs-upload-secret=/secrets/gcs/service-account.json + - --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson + - --lease-server-credentials-file=/etc/boskos/credentials + - --report-credentials-file=/etc/report/credentials + - --secret-dir=/usr/local/e2e-gcp-single-node-cluster-profile + - --target=e2e-gcp-single-node + command: + - ci-operator + image: ci-operator:latest + imagePullPolicy: Always + name: "" + resources: + requests: + cpu: 10m + volumeMounts: + - mountPath: /etc/boskos + name: boskos + readOnly: true + - mountPath: /usr/local/e2e-gcp-single-node-cluster-profile + name: cluster-profile + - mountPath: /secrets/gcs + name: gcs-credentials + readOnly: true + - mountPath: /etc/pull-secret + name: pull-secret + readOnly: true + - mountPath: /etc/report + name: result-aggregator + readOnly: true + serviceAccountName: ci-operator + volumes: + - name: boskos + secret: + items: + - key: credentials + path: credentials + secretName: boskos-credentials + - name: cluster-profile + projected: + sources: + - secret: + name: cluster-secrets-gcp + - configMap: + name: cluster-profile-gcp + - name: pull-secret + secret: + secretName: registry-pull-credentials + - name: result-aggregator + secret: + secretName: result-aggregator + trigger: (?m)^/test( | .* )e2e-gcp-single-node,?($|\s.*) - agent: kubernetes always_run: false branches: diff --git a/ci-operator/step-registry/openshift/e2e/aws/single-node/openshift-e2e-aws-single-node-workflow.yaml b/ci-operator/step-registry/openshift/e2e/aws/single-node/openshift-e2e-aws-single-node-workflow.yaml index c8035f30b6fb3..386e20cdea137 100644 --- a/ci-operator/step-registry/openshift/e2e/aws/single-node/openshift-e2e-aws-single-node-workflow.yaml +++ b/ci-operator/step-registry/openshift/e2e/aws/single-node/openshift-e2e-aws-single-node-workflow.yaml @@ -3,7 +3,7 @@ workflow: steps: pre: - chain: ipi-conf-aws - - ref: single-node-conf + - ref: single-node-conf-aws - chain: ipi-install test: - ref: openshift-e2e-test diff --git a/ci-operator/step-registry/openshift/e2e/gcp/single-node/OWNERS b/ci-operator/step-registry/openshift/e2e/gcp/single-node/OWNERS new file mode 100644 index 0000000000000..99fde41d0c99f --- /dev/null +++ b/ci-operator/step-registry/openshift/e2e/gcp/single-node/OWNERS @@ -0,0 +1,7 @@ +approvers: +- romfreiman +- eranco74 +- tsorya +- osherdp +- yuvigold +- omertuc diff --git a/ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.metadata.json b/ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.metadata.json new file mode 100644 index 0000000000000..18642d15b7169 --- /dev/null +++ b/ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.metadata.json @@ -0,0 +1,13 @@ +{ + "path": "openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.yaml", + "owners": { + "approvers": [ + "romfreiman", + "eranco74", + "tsorya", + "osherdp", + "yuvigold", + "omertuc" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.yaml b/ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.yaml new file mode 100644 index 0000000000000..4aef64efc1d90 --- /dev/null +++ b/ci-operator/step-registry/openshift/e2e/gcp/single-node/openshift-e2e-gcp-single-node-workflow.yaml @@ -0,0 +1,15 @@ +workflow: + as: openshift-e2e-gcp-single-node + steps: + pre: + - chain: ipi-conf-gcp + - ref: single-node-conf-gcp + - chain: ipi-install + test: + - ref: openshift-e2e-test + post: + - chain: gather-network + - chain: gather-core-dump + - chain: ipi-deprovision + documentation: |- + The Openshift E2E Single Node workflow executes the common end-to-end test suite with the a single node cluster. diff --git a/ci-operator/step-registry/single-node/conf/aws/OWNERS b/ci-operator/step-registry/single-node/conf/aws/OWNERS new file mode 100644 index 0000000000000..99fde41d0c99f --- /dev/null +++ b/ci-operator/step-registry/single-node/conf/aws/OWNERS @@ -0,0 +1,7 @@ +approvers: +- romfreiman +- eranco74 +- tsorya +- osherdp +- yuvigold +- omertuc diff --git a/ci-operator/step-registry/single-node/conf/single-node-conf-commands.sh b/ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-commands.sh similarity index 85% rename from ci-operator/step-registry/single-node/conf/single-node-conf-commands.sh rename to ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-commands.sh index 3c6ae71fd4c7a..d49fb94b27475 100644 --- a/ci-operator/step-registry/single-node/conf/single-node-conf-commands.sh +++ b/ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-commands.sh @@ -26,8 +26,9 @@ if not "controlPlane" in cfg: cfg["controlPlane"]["replicas"] = 1 # Single Node Openshift requires extra memory and compute resources -assert "aws" in cfg["controlPlane"]["platform"], "Only AWS single-node is supported for now" -cfg["controlPlane"]["platform"]["aws"]["type"] = "'${SINGLE_NODE_AWS_INSTANCE_TYPE}'" +platform = cfg["controlPlane"]["platform"] +assert "aws" in platform +platform["aws"]["type"] = "'${SINGLE_NODE_AWS_INSTANCE_TYPE}'" # Some workflows do not define any compute machine pools in install-config.yaml if not "compute" in cfg: diff --git a/ci-operator/step-registry/single-node/conf/single-node-conf-ref.metadata.json b/ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-ref.metadata.json similarity index 66% rename from ci-operator/step-registry/single-node/conf/single-node-conf-ref.metadata.json rename to ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-ref.metadata.json index d25c7d10ee1cc..428588d944d37 100644 --- a/ci-operator/step-registry/single-node/conf/single-node-conf-ref.metadata.json +++ b/ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-ref.metadata.json @@ -1,5 +1,5 @@ { - "path": "single-node/conf/single-node-conf-ref.yaml", + "path": "single-node/conf/aws/single-node-conf-aws-ref.yaml", "owners": { "approvers": [ "romfreiman", diff --git a/ci-operator/step-registry/single-node/conf/single-node-conf-ref.yaml b/ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-ref.yaml similarity index 73% rename from ci-operator/step-registry/single-node/conf/single-node-conf-ref.yaml rename to ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-ref.yaml index b0d449906a0c3..c045a8552af2c 100644 --- a/ci-operator/step-registry/single-node/conf/single-node-conf-ref.yaml +++ b/ci-operator/step-registry/single-node/conf/aws/single-node-conf-aws-ref.yaml @@ -1,7 +1,7 @@ ref: - as: single-node-conf + as: single-node-conf-aws from: installer - commands: single-node-conf-commands.sh + commands: single-node-conf-aws-commands.sh resources: requests: cpu: 10m diff --git a/ci-operator/step-registry/single-node/conf/gcp/OWNERS b/ci-operator/step-registry/single-node/conf/gcp/OWNERS new file mode 100644 index 0000000000000..99fde41d0c99f --- /dev/null +++ b/ci-operator/step-registry/single-node/conf/gcp/OWNERS @@ -0,0 +1,7 @@ +approvers: +- romfreiman +- eranco74 +- tsorya +- osherdp +- yuvigold +- omertuc diff --git a/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-commands.sh b/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-commands.sh new file mode 100644 index 0000000000000..99eddb066aa87 --- /dev/null +++ b/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-commands.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +SINGLE_NODE_GCP_INSTANCE_TYPE="n1-standard-16" + +echo "Updating install-config.yaml to a single ${SINGLE_NODE_GCP_INSTANCE_TYPE} control plane node and 0 workers" + +pip3 install pyyaml --user +python3 -c ' +import yaml +import sys + +input_file = sys.argv[1] +output_file = sys.argv[2] if len(sys.argv) == 3 else sys.argv[1] # Output in-place if destination not given + +with open(input_file) as f: + cfg = yaml.safe_load(f) + +# Some workflows do not define controlPlane in install-config.yaml +if not "controlPlane" in cfg: + cfg["controlPlane"] = {} + +cfg["controlPlane"]["replicas"] = 1 + +# Single Node Openshift requires extra memory and compute resources +platform = cfg["controlPlane"]["platform"] +assert "gcp" in platform +platform["gcp"]["type"] = "'${SINGLE_NODE_GCP_INSTANCE_TYPE}'" + +# Some workflows do not define any compute machine pools in install-config.yaml +if not "compute" in cfg: + cfg["compute"] = [ + { + "name": "worker", + "platform": {}, + } + ] + +for machine_pool in cfg["compute"]: + machine_pool["replicas"] = 0 + +with open(output_file, "w") as f: + yaml.safe_dump(cfg, f) +' "${SHARED_DIR}/install-config.yaml" + diff --git a/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.metadata.json b/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.metadata.json new file mode 100644 index 0000000000000..90fbe58534282 --- /dev/null +++ b/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.metadata.json @@ -0,0 +1,13 @@ +{ + "path": "single-node/conf/gcp/single-node-conf-gcp-ref.yaml", + "owners": { + "approvers": [ + "romfreiman", + "eranco74", + "tsorya", + "osherdp", + "yuvigold", + "omertuc" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.yaml b/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.yaml new file mode 100644 index 0000000000000..c71d0d86ef70d --- /dev/null +++ b/ci-operator/step-registry/single-node/conf/gcp/single-node-conf-gcp-ref.yaml @@ -0,0 +1,10 @@ +ref: + as: single-node-conf-gcp + from: installer + commands: single-node-conf-gcp-commands.sh + resources: + requests: + cpu: 10m + memory: 100Mi + documentation: |- + Modifies install-config.yaml to use a single control-plane node and without any workers.