Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #29 from jkandasa/es_image_change
Browse files Browse the repository at this point in the history
Es image change
  • Loading branch information
jkandasa authored Aug 17, 2018
2 parents 15dfd04 + 9934985 commit 2e2728f
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 85 deletions.
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<fabric8.openshift.client.version>3.1.12</fabric8.openshift.client.version>
<glassfish.jersey.client.version>2.27</glassfish.jersey.client.version>
<jackson.version>2.9.5</jackson.version>
<jaeger.version>0.30.2</jaeger.version>
<jaeger.version>0.30.1.redhat-00004</jaeger.version>
<javax.ws.rs.version>2.1</javax.ws.rs.version>
<junit.version>4.12</junit.version>
<log4j.version>1.2.17</log4j.version>
Expand Down Expand Up @@ -252,5 +252,18 @@
</plugins>
</reporting>

<repositories>
<repository>
<id>indy</id>
<name>indy</name>
<url>http://indy.cloud.pnc.engineering.redhat.com/api/content/maven/group/pnc-builds</url>
</repository>
<repository>
<id>rhrepo-ea</id>
<name>rhrepo-ea</name>
<url>http://maven.repository.redhat.com/earlyaccess/all</url>
</repository>
</repositories>


</project>
80 changes: 35 additions & 45 deletions standalone/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ pipeline {
ELASTICSEARCH_PORT = "9200"
CASSANDRA_CLUSTER_IP = "cassandra"
CASSANDRA_KEYSPACE_NAME="jaeger_v1_dc1"
DEPLOYMENT_PARAMETERS="-pIMAGE_VERSION=latest -pCOLLECTOR_QUEUE_SIZE=${COLLECTOR_QUEUE_SIZE} -pCOLLECTOR_PODS=${COLLECTOR_PODS}"
DEPLOYMENT_PARAMETERS="-pIMAGE_VERSION=latest -pCOLLECTOR_PODS=${COLLECTOR_PODS}"
LOGS_COLLECTED="false"
}
parameters {
choice(choices: 'COLLECTOR\nAGENT', name: 'USE_AGENT_OR_COLLECTOR')
Expand All @@ -28,21 +29,28 @@ pipeline {
string(name: 'DELAY', defaultValue: '100', description: 'delay in milliseconds between each span creation')
string(name: 'WORKER_PODS', defaultValue: '1', description: 'The number of pods to run client threads in')
string(name: 'TRACERS_PER_POD', defaultValue: '1')
string(name: 'COLLECTOR_PODS', defaultValue: '1')
string(name: 'COLLECTOR_QUEUE_SIZE', defaultValue: '3000000')
string(name: 'ES_MEMORY', defaultValue: '2Gi', description: 'Memory for each elasticsearch pod')
string(name: 'ES_BULK_SIZE', defaultValue: '10000000', description: '--es.bulk.size')
string(name: 'ES_BULK_WORKERS', defaultValue: '10', description: '--es.bulk.workers')
string(name: 'ES_BULK_FLUSH_INTERVAL', defaultValue: '1s', description: '--es.bulk.flush-interval')

string(name: 'COLLECTOR_PODS', defaultValue: '1', description: 'The number of collector pods')
string(name: 'COLLECTOR_QUEUE_SIZE', defaultValue: '2000', description: '--collector.queue-size')
string(name: 'COLLECTOR_NUM_WORKERS', defaultValue: '50', description: '--collector.num-workers')

string(name: 'ES_IMAGE', defaultValue: 'registry.centos.org/rhsyseng/elasticsearch:5.5.2', description: 'ElasticSearch image.')
string(name: 'ES_IMAGE_INSECURE', defaultValue: 'false', description: 'If image location not-secured(for HTTP) change to true')
string(name: 'ES_MEMORY', defaultValue: '1Gi', description: 'Memory for each elasticsearch pod')
string(name: 'ES_BULK_SIZE', defaultValue: '5000000', description: '--es.bulk.size')
string(name: 'ES_BULK_WORKERS', defaultValue: '1', description: '--es.bulk.workers')
string(name: 'ES_BULK_FLUSH_INTERVAL', defaultValue: '200ms', description: '--es.bulk.flush-interval')

string(name: 'QUERY_STATIC_FILES', defaultValue: '', description: '--query.static-files')

booleanParam(name: 'RUN_SMOKE_TESTS', defaultValue: false, description: 'Run smoke tests in addition to the performance tests')
booleanParam(name: 'DELETE_JAEGER_AT_END', defaultValue: true, description: 'Delete Jaeger instance at end of the test')
booleanParam(name: 'DELETE_JOB_AT_END', defaultValue: true, description: 'Delete test pods at end of the test')

string(name: 'JAEGER_SAMPLING_RATE', defaultValue: '1.0', description: '0.0 to 1.0 percent of spans to record')
string(name: 'JAEGER_AGENT_IMAGE', defaultValue: 'jaegertracing/jaeger-agent:latest', description: 'Agent Image NOTE: Do NOT quote backslashes')
string(name: 'JAEGER_COLLECTOR_IMAGE', defaultValue: 'jaegertracing\\/jaeger-collector:latest', description: 'Collector image NOTE: quote backslashes')
string(name: 'JAEGER_QUERY_IMAGE', defaultValue: 'jaegertracing\\/jaeger-query:latest', description: 'Query image NOTE: quote backslashes')
string(name: 'JAEGER_AGENT_IMAGE', defaultValue: 'jaegertracing/jaeger-agent:latest', description: 'Jaeger agent Image')
string(name: 'JAEGER_COLLECTOR_IMAGE', defaultValue: 'jaegertracing/jaeger-collector:latest', description: 'Jaeger collector image')
string(name: 'JAEGER_QUERY_IMAGE', defaultValue: 'jaegertracing/jaeger-query:latest', description: 'Jaeger query image')
}
stages {
stage('Set name and description') {
Expand Down Expand Up @@ -88,17 +96,7 @@ pipeline {
expression { params.SPAN_STORAGE_TYPE == 'elasticsearch'}
}
steps {
sh '''
curl https://raw.githubusercontent.com/RHsyseng/docker-rhel-elasticsearch/5.x/es-cluster-deployment.yml --output es-cluster-deployment.yml
sed -i 's/512Mi/'${ES_MEMORY}'/g' es-cluster-deployment.yml
oc create -f es-cluster-deployment.yml
while true; do
replicas=$(oc get statefulset/elasticsearch -o=jsonpath='{.status.readyReplicas}')
((replicas > 1)) && break
sleep 1
done
'''

sh ' ./standalone/scripts/execute-es-cluster-deployment.sh'
}
}
stage('deploy Jaeger with Cassandra') {
Expand All @@ -113,7 +111,7 @@ pipeline {
sed -i 's/jaegertracing\\/jaeger-collector:${IMAGE_VERSION}/'${JAEGER_COLLECTOR_IMAGE}'/g' jaeger-production-template.yml
sed -i 's/jaegertracing\\/jaeger-query:${IMAGE_VERSION}/'${JAEGER_QUERY_IMAGE}'/g' jaeger-production-template.yml
grep "image:" jaeger-production-template.yml
./standalone/updateTemplateForCassandra.sh
./standalone/scripts/updateTemplateForCassandra.sh
oc process ${DEPLOYMENT_PARAMETERS} -f jaeger-production-template.yml | oc create -n ${PROJECT_NAME} -f -
'''
}
Expand All @@ -123,17 +121,7 @@ pipeline {
expression { params.SPAN_STORAGE_TYPE == 'elasticsearch'}
}
steps {
sh '''
curl https://raw.githubusercontent.com/jaegertracing/jaeger-openshift/master/production/configmap-elasticsearch.yml --output configmap-elasticsearch.yml
oc create -f configmap-elasticsearch.yml
rm configmap-elasticsearch.yml
curl https://raw.githubusercontent.com/jaegertracing/jaeger-openshift/master/production/jaeger-production-template.yml --output jaeger-production-template.yml
sed -i 's/jaegertracing\\/jaeger-collector:${IMAGE_VERSION}/'${JAEGER_COLLECTOR_IMAGE}'/g' jaeger-production-template.yml
sed -i 's/jaegertracing\\/jaeger-query:${IMAGE_VERSION}/'${JAEGER_QUERY_IMAGE}'/g' jaeger-production-template.yml
grep "image:" jaeger-production-template.yml
./standalone/updateTemplateForElasticSearch.sh
oc process ${DEPLOYMENT_PARAMETERS} -pES_BULK_SIZE=${ES_BULK_SIZE} -pES_BULK_WORKERS=${ES_BULK_WORKERS} -pES_BULK_FLUSH_INTERVAL=${ES_BULK_FLUSH_INTERVAL} -f jaeger-production-template.yml | oc create -n ${PROJECT_NAME} -f -
'''
sh './standalone/scripts/deploy_jaeger_elasticsearch.sh'
}
}
stage('Wait for Jaeger Deployment') {
Expand All @@ -148,10 +136,8 @@ pipeline {
pwd
git status
mvn clean install
oc logs -f elasticsearch-0 > es0.txt &
oc logs -f elasticsearch-1 > es1.txt &
oc logs -f elasticsearch-2 > es2.txt &
cd standalone
mvn dependency:tree
mvn --activate-profiles openshift clean install fabric8:deploy -Djaeger.agent.image=${JAEGER_AGENT_IMAGE} -Dtracers.per.pod=${TRACERS_PER_POD} -Dpod.count=${WORKER_PODS} -Dduration.in.minutes=${DURATION_IN_MINUTES} -Dthread.count=${THREAD_COUNT} -Ddelay=${DELAY} -Djaeger.sampling.rate=${JAEGER_SAMPLING_RATE} -Djaeger.agent.host=${JAEGER_AGENT_HOST} -Duse.agent.or.collector=${USE_AGENT_OR_COLLECTOR} -Djaeger.collector.port=${JAEGER_COLLECTOR_PORT} -Djaeger.collector.host=${JAEGER_COLLECTOR_HOST}
mvn --activate-profiles validate clean verify
'''
Expand All @@ -177,13 +163,22 @@ pipeline {
git clone https://github.com/Kiali-QE/jaeger-java-test.git
cd jaeger-java-test
mvn dependency:tree
export USE_COLLECTOR_OR_AGENT=collector
mvn -Dfailsafe.rerunFailingTestsCount=2 clean test
cd ..
rm -rf jaeger-java-test
'''
}
}
stage('Collect logs'){
steps{
sh '''
./standalone/scripts/collect_logs.sh
export LOGS_COLLECTED="true"
'''
}
}
stage('Delete Jaeger at end') {
when {
expression { params.DELETE_JAEGER_AT_END }
Expand Down Expand Up @@ -223,15 +218,10 @@ pipeline {
}
failure {
script {
sh '''
echo "--------------------------------- ES0 ---------------------------------"
cat es0.txt
echo "--------------------------------- ES1 ---------------------------------"
cat es1.txt
echo "--------------------------------- ES2 ---------------------------------"
cat es2.txt
'''
if (env.LOGS_COLLECTED == 'false') {
sh './standalone/scripts/collect_logs.sh'
}
}
}
}
}
}
29 changes: 29 additions & 0 deletions standalone/scripts/collect_logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
#
# Copyright 2018 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#

# enable set -x if you want to print commands on console
# set -x

echo -e "\n\n------------------------- Logs -------------------------"

echo -e "\n----------------------- Elasticsearch logs -----------------------"
oc get pods -l app=elasticsearch -o name | xargs -n1 -I@ sh -c 'echo "---------------------- @ --------------------------"; oc logs @; echo -e "------------------------------------------------------------------\n"'

echo -e "\n---------------------- Jaeger logs --------------------------"
oc get pods -l app=jaeger -o name | xargs -n1 -I@ sh -c 'echo "---------------------- @ --------------------------"; oc logs @; echo -e "------------------------------------------------------------------\n"'

echo -e "\n---------------------- oc describe pods,services,events,configmaps,deployments -l name!=jenkins--------------------------"
oc describe pods,services,events,configmaps,deployments -l name!=jenkins
echo -e "------------------------------------------------------------------\n\n"
57 changes: 57 additions & 0 deletions standalone/scripts/deploy_jaeger_elasticsearch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
#
# Copyright 2018 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#

#
# Need to add // --collector.num-workers=50 --collector.queue-size=2000
#
set -x

# download config map from master branch
cp standalone/templates/configmap-elasticsearch.yml configmap-elasticsearch.yml
# update configmap
sed -i 's;${COLLECTOR_NUM_WORKERS};'${COLLECTOR_NUM_WORKERS}';g' configmap-elasticsearch.yml
sed -i 's;${COLLECTOR_QUEUE_SIZE};'${COLLECTOR_QUEUE_SIZE}';g' configmap-elasticsearch.yml
sed -i 's;${ES_BULK_SIZE};'${ES_BULK_SIZE}';g' configmap-elasticsearch.yml
sed -i 's;${ES_BULK_WORKERS};'${ES_BULK_WORKERS}';g' configmap-elasticsearch.yml
sed -i 's;${ES_BULK_FLUSH_INTERVAL};'${ES_BULK_FLUSH_INTERVAL}';g' configmap-elasticsearch.yml
if [ ${#QUERY_STATIC_FILES} -gt 0 ]
then
sed -i 's;${QUERY_STATIC_FILES};'${QUERY_STATIC_FILES}';g' configmap-elasticsearch.yml
else
sed -i '/${QUERY_STATIC_FILES}/d' configmap-elasticsearch.yml
fi
# create configmap
oc create -f configmap-elasticsearch.yml
rm configmap-elasticsearch.yml

# download jaeger production template from master branch
curl https://raw.githubusercontent.com/jaegertracing/jaeger-openshift/master/production/jaeger-production-template.yml --output jaeger-production-template.yml
# update jaeger collector image
sed -i 's;jaegertracing/jaeger-collector:${IMAGE_VERSION};'${JAEGER_COLLECTOR_IMAGE}';g' jaeger-production-template.yml
# update jaeger query image
sed -i 's;jaegertracing/jaeger-query:${IMAGE_VERSION};'${JAEGER_QUERY_IMAGE}';g' jaeger-production-template.yml
# print selected images on the console
grep "image:" jaeger-production-template.yml

#
# HACK alert. Change the number of replicas for the collector here if desired. This script currently depends
# on the entry for the jaeger-collector occuring in the template (and specifically the line 'replicas: 1'
# occuring before the 'replicas: 1' entry for anything else, such as the jaeger-ui
# update parameters
sed -i 's;parameters:.*$;\0\n- description: Number of collector pods\n displayName: Jaeger Collector Pods\n name: COLLECTOR_PODS\n required: false\n value: "1";g' jaeger-production-template.yml
sed -i '0,/replicas: 1/s/replicas: 1/replicas: ${COLLECTOR_PODS}/' jaeger-production-template.yml

# deploy jaeger template
oc process ${DEPLOYMENT_PARAMETERS} -f jaeger-production-template.yml | oc create -n ${PROJECT_NAME} -f -
31 changes: 31 additions & 0 deletions standalone/scripts/execute-es-cluster-deployment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# Copyright 2018 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#


# Unable to add multiline sed replace with Jenkins pipeline file, hence created this script as a workaround,
# and moved all the commands to this file.

set -x
curl https://raw.githubusercontent.com/RHsyseng/docker-rhel-elasticsearch/5.x/es-cluster-deployment.yml --output es-cluster-deployment.yml
sed -i 's/512Mi/'${ES_MEMORY}'/g' es-cluster-deployment.yml
sed -i 's/registry.centos.org\/rhsyseng\/elasticsearch:5.6.10/'${ES_IMAGE//\//\\/}' \
importPolicy: \
insecure: '${ES_IMAGE_INSECURE}'/g' es-cluster-deployment.yml
oc create -f es-cluster-deployment.yml
while true; do
replicas=$(oc get statefulset/elasticsearch -o=jsonpath='{.status.readyReplicas}')
((replicas > 1)) && break
sleep 1
done
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public String getStringReport() {
builder.append(" Tracers per pod : ").append(CreateTraces.TRACERS_PER_POD).append("\n");
builder.append(" Collector pod count : ").append(envs.get("COLLECTOR_PODS")).append("\n");
builder.append(" Collector queue size : ").append(envs.get("COLLECTOR_QUEUE_SIZE")).append("\n");
builder.append(" Collector workers nums : ").append(envs.get("COLLECTOR_NUM_WORKERS")).append("\n");
builder.append(" Query static files : ").append(envs.get("QUERY_STATIC_FILES")).append("\n");
builder.append(" Storage type : ").append(envs.get("SPAN_STORAGE_TYPE")).append("\n");
builder.append(" ES memory : ").append(envs.get("ES_MEMORY")).append("\n");
builder.append(" ES bulk size : ").append(envs.get("ES_BULK_SIZE")).append("\n");
Expand All @@ -81,14 +83,15 @@ public String getStringReport() {
builder.append(" Agent image : ").append(envs.get("JAEGER_AGENT_IMAGE")).append("\n");
builder.append(" Collector image : ").append(envs.get("JAEGER_COLLECTOR_IMAGE")).append("\n");
builder.append(" Query image : ").append(envs.get("JAEGER_QUERY_IMAGE")).append("\n");
builder.append(" Elasticsearch image : ").append(envs.get("ES_IMAGE")).append("\n");

builder.append("-----------------------------------------------------------------------\n\n");

final double dropPercentage = 100.0 - (((double) spanCountFound / spanCountSent) * 100.0);
final int tracesPersecond = ((int) CreateTraces.THREAD_COUNT * (1000 / CreateTraces.DELAY))
* new Integer(envs.getOrDefault("WORKER_PODS", "1"));
final int tracesPersecond = Double.valueOf(((CreateTraces.THREAD_COUNT * (1000.0 / CreateTraces.DELAY))
* new Integer(envs.getOrDefault("WORKER_PODS", "1")))).intValue();

builder.append("Span count status: \n");
builder.append("Traces count status: \n");
builder.append("-----------------------------------------------------------------------\n");
builder.append(" Traces sent to : ").append(CreateTraces.USE_AGENT_OR_COLLECTOR).append("\n");
builder.append(" Traces / second : ").append(tracesPersecond).append(" (aprox)\n");
Expand Down
45 changes: 45 additions & 0 deletions standalone/templates/configmap-elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright 2017-2018 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#

apiVersion: v1
kind: ConfigMap
metadata:
name: jaeger-configuration
labels:
app: jaeger
jaeger-infra: configuration
data:
span-storage-type: elasticsearch
collector: |
collector:
num-workers: ${COLLECTOR_NUM_WORKERS}
queue-size: ${COLLECTOR_QUEUE_SIZE}
zipkin:
http-port: 9411
es:
server-urls: http://elasticsearch:9200
bulk:
size: ${ES_BULK_SIZE}
workers: ${ES_BULK_WORKERS}
flush-interval: ${ES_BULK_FLUSH_INTERVAL}
query: |
query:
static-files: ${QUERY_STATIC_FILES}
port: 16686
es:
server-urls: http://elasticsearch:9200
bulk:
size: ${ES_BULK_SIZE}
workers: ${ES_BULK_WORKERS}
flush-interval: ${ES_BULK_FLUSH_INTERVAL}
Loading

0 comments on commit 2e2728f

Please sign in to comment.