From 3ee962f1ac38f31d346f6af237fe9084c14d7860 Mon Sep 17 00:00:00 2001 From: Eddie Arrage Date: Wed, 11 Apr 2018 02:44:51 +0000 Subject: Modified validation script for tracing to support CI - Changed default Jaeger ports to 16686 for use with basic kubernetes port-forward and CI scripts - Added CLI to validate script to disable istio service check by default. This requires at least a single http request to istio-ingress after Jaeger deployment. It can be enabled with 'python validate.py -s'. Port and IP address for Jaeger can optionally be specified with '-ip' and '-port' options - Modified tracing doc to add k8s port-forward example in addition to k8s expose Change-Id: I10fb4d3cccfa50370d44ed7446f67a49c538bba9 Signed-off-by: Eddie Arrage --- clover/tracing/tracing.py | 2 +- clover/tracing/validate.py | 39 +++++++++++++++++++++++++++---------- docs/development/design/tracing.rst | 19 ++++++++++++------ 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/clover/tracing/tracing.py b/clover/tracing/tracing.py index 16b952c..f646268 100644 --- a/clover/tracing/tracing.py +++ b/clover/tracing/tracing.py @@ -10,7 +10,7 @@ import time import redis TRACING_IP = "localhost" -TRACING_PORT = "30888" +TRACING_PORT = "16686" class Tracing: diff --git a/clover/tracing/validate.py b/clover/tracing/validate.py index 9cbfdd0..0f6f0a8 100644 --- a/clover/tracing/validate.py +++ b/clover/tracing/validate.py @@ -6,12 +6,11 @@ # http://www.apache.org/licenses/LICENSE-2.0 from kubernetes import client, config +import argparse from clover.tracing.tracing import Tracing +# from tracing import Tracing -JAEGER_IP = "localhost" -# JAEGER_IP = "1.1.1.1" -JAEGER_PORT = "30888" JAEGER_DEPLOYMENT = "jaeger-deployment" ISTIO_NAMESPACE = "istio-system" ISTIO_SERVICES = ["istio-ingress", "istio-mixer"] @@ -36,10 +35,12 @@ def validateDeploy(): validate = True return validate -# Services in Jaeger will only be present when traffic passes through Istio -# Requires a deployment in Istio service mesh with some traffic targeting nodes -def validateServices(): - t = Tracing(JAEGER_IP, JAEGER_PORT) + +# Services in Jaeger will only be present when traffic targets istio-ingress +# Even a failed HTTP GET request to istio-ingress will add istio-ingress and +# istio-mixer services +def validateServices(args): + t = Tracing(args['ip'], args['port']) services = t.getServices() validate = True if services: @@ -47,14 +48,20 @@ def validateServices(): if s in services: print("Service in tracing: {} present".format(s)) else: + print("Service in tracing: {} not present".format(s)) validate = False else: validate = False return validate -def main(): - if validateDeploy() and validateServices(): +def main(args): + vdeploy = validateDeploy() + if args['s']: + vservice = validateServices(args) + else: + vservice = True + if vdeploy and vservice: print"Jaeger tracing validation has passed" return True else: @@ -63,4 +70,16 @@ def main(): if __name__ == '__main__': - main() + parser = argparse.ArgumentParser() + parser.add_argument( + '-s', action='store_true', + help='Validate istio services, \ + which requires at least one http request to istio-ingress') + parser.add_argument( + '-ip', default='localhost', + help='IP address to access Jaeger') + parser.add_argument( + '-port', default='16686', + help='Port to acccess Jaeger') + args = parser.parse_args() + main(vars(args)) diff --git a/docs/development/design/tracing.rst b/docs/development/design/tracing.rst index 79d686c..b83274c 100644 --- a/docs/development/design/tracing.rst +++ b/docs/development/design/tracing.rst @@ -13,20 +13,26 @@ following command:: kubectl apply -n istio-system -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml The standard Jaeger REST port is at 16686. To make this service available outside of the -Kubernetes cluster, use the following command:: +Kubernetes cluster via any node IP in the cluster, use the following command:: kubectl expose -n istio-system deployment jaeger-deployment --port=16686 --type=NodePort -Kubernetes will expose the Jaeger service on another port, which can be found with:: +Kubernetes will expose the Jaeger service on another port from 30000-32767 and the assignment can +be found with:: kubectl get svc -n istio-system An example listing from the command above is shown below where the Jaeger service is exposed -externally on port 30888:: +externally on port 30888 in this case:: istio-system jaeger-deployment NodePort 10.104.113.94 16686:30888/TCP -Jaeger will be accessible using the host IP of the Kubernetes cluster and port provided. +Jaeger will be accessible using the host IP of any node in Kubernetes cluster and port provided. +With this method, the Jaeger UI will also be available from a remote host. If external access is +required to Jaeger but restricted to cluster localhost(s), an alternate method is to use the +**port-forward** command in the foreground, as shown below:: + + kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=jaeger -o jsonpath='{.items[0].metadata.name}') 16686:16686 ******** Validate @@ -40,5 +46,6 @@ It validates the installation with the following criteria: #. Existence of Jaeger all-in-one deployment using Kubernetes #. Jaeger service is accessible using IP address and port configured in installation steps -#. Jaeger can retrieve default service listing for default Istio components -#. TBD - consider installation of production setup with cassandra or elastic search +#. Optionally, if Jaeger can retrieve service listing for default Istio components + (istio-ingress, istio-mixer). At least one HTTP request must be sent to istio-ingress + after initial Jaeger deployment for this validation to function. -- cgit 1.2.3-korg