From 5dda02f08e58d45b35c21de02fa19552a5554b00 Mon Sep 17 00:00:00 2001 From: Mohit Sheth Date: Tue, 31 Mar 2020 19:47:22 +0000 Subject: [PATCH] Use kubeconfig instead of oc login for router test --- jjb/dynamic/scale-ci_http.yml | 39 ++++++++------------------------ pipeline-scripts/http.groovy | 18 ++++----------- properties-files/http.properties | 8 ++----- 3 files changed, 16 insertions(+), 49 deletions(-) diff --git a/jjb/dynamic/scale-ci_http.yml b/jjb/dynamic/scale-ci_http.yml index aa1760ee..7254abd0 100644 --- a/jjb/dynamic/scale-ci_http.yml +++ b/jjb/dynamic/scale-ci_http.yml @@ -5,18 +5,8 @@ - shell: |+ set -o pipefail set -eux - - # Disable logging - set +x - if [[ $SKIP_TLS_VERIFICATION ]]; then - oc login -u ${CLUSTER_USER} -p ${CLUSTER_PASSWORD} ${CLUSTER_API_URL} --insecure-skip-tls-verify - else - oc login -u ${CLUSTER_USER} -p ${CLUSTER_PASSWORD} ${CLUSTER_API_URL} - fi - - # Re-enable logging - set -x - + + # get perf keys to access orchestration host and set ssh session options git clone https://${SSHKEY_TOKEN}@github.com/redhat-performance/perf-dept.git export PUBLIC_KEY=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf.pub export PRIVATE_KEY=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf @@ -24,6 +14,11 @@ export PBENCH_SSH_PRIVATE_KEY_FILE=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf chmod 600 ${PRIVATE_KEY} + # fetch the kubeconfig from the orchestration host + echo "Fetching the kubeconfig from the orchestration host" + scp ${OPTIONS} -i ${PRIVATE_KEY} ${ORCHESTRATION_USER}@${ORCHESTRATION_HOST}:$HOME/.kube/config ${WORKSPACE}/kubeconfig + export KUBECONFIG=${WORKSPACE}/kubeconfig +  # Create inventory File: echo "[orchestration]" > inventory echo "${ORCHESTRATION_HOST}" >> inventory @@ -61,31 +56,15 @@ This test is a data-plane workload generator that runs http requests through HAProxy into deployed pods. This job is managed by https://github.com/openshift-scale/scale-ci-pipeline disabled: false - name: ATS-SCALE-CI-HTTP + name: SCALE-CI-HTTP node: scale-ci parameters: - - bool: - default: true - description: skips tls verification during oc login - name: SKIP_TLS_VERIFICATION - - string: - default: "kubeadmin" - description: User name to access cluster. - name: CLUSTER_USER - - string: - default: "" - description: Password for CLUSTER_USER to access cluster. - name: CLUSTER_PASSWORD - - string: - default: "" - description: The URL address to the openshift cluster to login to. - name: CLUSTER_API_URL - string: default: "" description: Token to access private repo containing ssh keys. name: SSHKEY_TOKEN - string: - default: "localhost" + default: "" description: The machine intended to run the oc commands and launch the workload. name: ORCHESTRATION_HOST - string: diff --git a/pipeline-scripts/http.groovy b/pipeline-scripts/http.groovy index 0c63e5f3..1f9b6569 100644 --- a/pipeline-scripts/http.groovy +++ b/pipeline-scripts/http.groovy @@ -21,10 +21,6 @@ stage ('http_scale_test') { sh "wget ${HTTP_TEST_PROPERTY_FILE} -O ${property_file_name}" sh "cat ${property_file_name}" def http_properties = readProperties file: property_file_name - def skip_tls = http_properties['SKIP_TLS_VERIFICATION'] - def cluster_user = http_properties['CLUSTER_USER'] - def cluster_password = http_properties['CLUSTER_PASSWORD'] - def cluster_api_url = http_properties['CLUSTER_API_URL'] def sshkey_token = http_properties['SSHKEY_TOKEN'] def orchestration_host = http_properties['ORCHESTRATION_HOST'] def orchestration_user = http_properties['ORCHESTRATION_USER'] @@ -58,12 +54,8 @@ stage ('http_scale_test') { def http_test_server_container_image = http_properties['HTTP_TEST_SERVER_CONTAINER_IMAGE'] try { - http_build = build job: 'ATS-SCALE-CI-HTTP', + http_build = build job: 'SCALE-CI-HTTP', parameters: [ [$class: 'LabelParameterValue', name: 'node', label: node_label ], - [$class: 'BooleanParameterValue', name: 'SKIP_TLS_VERIFICATION', value: Boolean.valueOf(skip_tls) ], - [$class: 'StringParameterValue', name: 'CLUSTER_USER', value: cluster_user ], - [$class: 'StringParameterValue', name: 'CLUSTER_PASSWORD', value: cluster_password ], - [$class: 'StringParameterValue', name: 'CLUSTER_API_URL', value: cluster_api_url ], [$class: 'StringParameterValue', name: 'SSHKEY_TOKEN', value: sshkey_token ], [$class: 'StringParameterValue', name: 'ORCHESTRATION_HOST', value: orchestration_host ], [$class: 'StringParameterValue', name: 'ORCHESTRATION_USER', value: orchestration_user ], @@ -96,12 +88,12 @@ stage ('http_scale_test') { [$class: 'StringParameterValue', name: 'HTTP_TEST_STRESS_CONTAINER_IMAGE', value: http_test_stress_container_image ], [$class: 'StringParameterValue', name: 'HTTP_TEST_SERVER_CONTAINER_IMAGE', value: http_test_server_container_image ]] } catch ( Exception e) { - echo "ATS-SCALE-CI-HTTP Job failed with the following error: " + echo "SCALE-CI-HTTP Job failed with the following error: " echo "${e.getMessage()}" echo "Sending an email" mail( - to: 'nelluri@redhat.com', - subject: 'ATS-SCALE-CI-HTTP job failed', + to: 'msheth@redhat.com', + subject: 'SCALE-CI-HTTP job failed', body: """\ Encoutered an error while running the ats-scale-ci-http job: ${e.getMessage()}\n\n Jenkins job: ${env.BUILD_URL} @@ -109,7 +101,7 @@ stage ('http_scale_test') { currentBuild.result = "FAILURE" sh "exit 1" } - println "ATS-SCALE-CI-HTTP build ${http_build.getNumber()} completed successfully" + println "SCALE-CI-HTTP build ${http_build.getNumber()} completed successfully" } } } diff --git a/properties-files/http.properties b/properties-files/http.properties index 60a5afff..8d4b9522 100644 --- a/properties-files/http.properties +++ b/properties-files/http.properties @@ -1,10 +1,6 @@ -SKIP_TLS_VERIFICATION=true -CLUSTER_USER=kubeadmin -CLUSTER_PASSWORD= -CLUSTER_API_URL= -SSHKEY_TOKEN= -ORCHESTRATION_HOST=localhost +ORCHESTRATION_HOST= ORCHESTRATION_USER=root +SSHKEY_TOKEN= WORKLOAD_IMAGE=quay.io/openshift-scale/scale-ci-workload WORKLOAD_JOB_NODE_SELECTOR=false WORKLOAD_JOB_TAINT=false