Skip to content

Commit

Permalink
use kubeconfig instead of oc login for scaleup
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit-sheth authored and chaitanyaenr committed Apr 23, 2020
1 parent 5d9eeee commit 7a6f21d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 47 deletions.
43 changes: 12 additions & 31 deletions jjb/dynamic/scale-ci_scale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,25 @@
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
export PBENCH_SSH_PUBLIC_KEY_FILE=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf.pub
export PBENCH_SSH_PRIVATE_KEY_FILE=${WORKSPACE}/perf-dept/ssh_keys/id_rsa_perf
export OPTIONS="-o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o ServerAliveCountMax=1200"
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
unset PBENCH_SSH_PRIVATE_KEY_FILE
unset PBENCH_SSH_PUBLIC_KEY_FILE
export ANSIBLE_FORCE_COLOR=true
ansible --version
time ansible-playbook -vv -i inventory workloads/scale.yml
Expand Down Expand Up @@ -64,34 +61,18 @@
name: ATS-SCALE-CI-SCALE
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"
description: The machine intended to run the oc commands and launch the workload.
name: ORCHESTRATION_HOST
- string:
default: "root"
description: The user for the Orchestration host.
name: ORCHESTRATION_USER
- string:
default: ""
description: Token to access private repo containing ssh keys.
name: SSHKEY_TOKEN
- string:
default: "quay.io/openshift-scale/scale-ci-workload"
description: Container image that runs the workload script.
Expand Down
14 changes: 3 additions & 11 deletions pipeline-scripts/openshiftv4_scale.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

def pipeline_id = env.BUILD_ID
def node_label = NODE_LABEL.toString()
def scale = OPENSHIFTv4_SCALE.toString().toUpperCase()
def property_file_name = "scale.properties"
def ocpv4_scale = OPENSHIFTv4_SCALE.toString().toUpperCase()
def property_file_name = "openshiftv4_scale.properties"

println "Current pipeline job build id is '${pipeline_id}'"

// 4.x scale cluster
stage ('4.x scale cluster') {
if (scale == "TRUE") {
if (ocpv4_scale == "TRUE") {
currentBuild.result = "SUCCESS"
node(node_label) {
// get properties file
Expand All @@ -21,10 +21,6 @@ stage ('4.x scale cluster') {
sh "wget ${OPENSHIFTv4_SCALE_PROPERTY_FILE} -O ${property_file_name}"
sh "cat ${property_file_name}"
def scale_properties = readProperties file: property_file_name
def skip_tls = scale_properties['SKIP_TLS_VERIFICATION']
def cluster_user = scale_properties['CLUSTER_USER']
def cluster_password = scale_properties['CLUSTER_PASSWORD']
def cluster_api_url = scale_properties['CLUSTER_API_URL']
def sshkey_token = scale_properties['SSHKEY_TOKEN']
def orchestration_host = scale_properties['ORCHESTRATION_HOST']
def orchestration_user = scale_properties['ORCHESTRATION_USER']
Expand All @@ -48,10 +44,6 @@ stage ('4.x scale cluster') {
try {
scale_build = build job: 'ATS-SCALE-CI-SCALE',
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 ],
Expand Down
7 changes: 2 additions & 5 deletions properties-files/openshiftv4_scale.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
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=true
WORKLOAD_JOB_TAINT=true
Expand Down

0 comments on commit 7a6f21d

Please sign in to comment.