From c0986f4a1403b494b096179a2c064707913a922c Mon Sep 17 00:00:00 2001 From: rnburn Date: Thu, 19 Oct 2017 17:59:36 -0700 Subject: [PATCH] Update to use the latest version of nginx-opentracing. --- README.md | 2 +- docs/user-guide/opentracing.md | 4 ++-- images/nginx-slim/build.sh | 29 ++++++++++++++-------------- rootfs/etc/nginx/template/nginx.tmpl | 12 +++++++++++- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index e52a401d4..4d9de36bb 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ An Ingress Controller is a daemon, deployed as a Kubernetes Pod, that watches th - [Exposing TCP and UDP Services](docs/user-guide/exposing-tcp-udp-services.md) - [Proxy Protocol](#proxy-protocol) - [ModSecurity Web Application Firewall](docs/user-guide/modsecurity.md) -- [Opentracing](docs/user-guide/opentracing.md) +- [OpenTracing](docs/user-guide/opentracing.md) - [Custom errors](docs/user-guide/custom-errors.md) - [NGINX status page](docs/user-guide/nginx-status-page.md) - [Running multiple ingress controllers](#running-multiple-ingress-controllers) diff --git a/docs/user-guide/opentracing.md b/docs/user-guide/opentracing.md index bff2221f2..0318e0f80 100644 --- a/docs/user-guide/opentracing.md +++ b/docs/user-guide/opentracing.md @@ -1,6 +1,6 @@ -# Opentracing +# OpenTracing -Using the third party module [rnburn/nginx-opentracing](https://github.com/rnburn/nginx-opentracing) the NGINX ingress controller can configure NGINX to enable [OpenTracing](http://opentracing.io) instrumentation. +Using the third party module [opentracing-contrib/nginx-opentracing](https://github.com/opentracing-contrib/nginx-opentracing) the NGINX ingress controller can configure NGINX to enable [OpenTracing](http://opentracing.io) instrumentation. By default this feature is disabled. To enable the instrumentation we just need to enable the instrumentation in the configuration configmap and set the host where we should send the traces. diff --git a/images/nginx-slim/build.sh b/images/nginx-slim/build.sh index 521dbe853..946f8b5a1 100755 --- a/images/nginx-slim/build.sh +++ b/images/nginx-slim/build.sh @@ -27,9 +27,9 @@ export STICKY_SESSIONS_VERSION=08a395c66e42 export MORE_HEADERS_VERSION=0.32 export NGINX_DIGEST_AUTH=7955af9c77598c697ac292811914ce1e2b3b824c export NGINX_SUBSTITUTIONS=bc58cb11844bc42735bbaef7085ea86ace46d05b -export NGINX_OPENTRACING=fcc2e822c6dfc7d1f432c16b07dee9437c24236a -export OPENTRACING_CPP=42cbb358b68e53145c5b479efa09a25dbc81a95a -export ZIPKIN_CPP=8eae512bd750b304764d96058c65229f9a7712a9 +export NGINX_OPENTRACING_VERSION=0.1.0 +export OPENTRACING_CPP_VERSION=1.0.0 +export ZIPKIN_CPP_VERSION=0.1.0 export MODSECURITY=a2a5858d249222938c2f5e48087a922c63d7f9d8 export BUILD_PATH=/tmp/build @@ -117,14 +117,14 @@ get_src 9b1d0075df787338bb607f14925886249bda60b6b3156713923d5d59e99a708b \ get_src 618551948ab14cac51d6e4ad00452312c7b09938f59ebff4f93875013be31f2d \ "https://github.com/yaoweibin/ngx_http_substitutions_filter_module/archive/$NGINX_SUBSTITUTIONS.tar.gz" -get_src d48c83e81aeeaebbf894adc5557cb8d027fb336d2afe95b68b2aa75920a3be74 \ - "https://github.com/rnburn/nginx-opentracing/archive/$NGINX_OPENTRACING.tar.gz" +get_src 624bdcade5da12cc5bae52f0190155a6ff519e86209c6b3c9f5ca3baa5096aec \ + "https://github.com/opentracing-contrib/nginx-opentracing/archive/v$NGINX_OPENTRACING_VERSION.tar.gz" -get_src d1afc7c38bef055ac8a3759f117281b9d9287785e044a7d4e79134fa6ea99324 \ - "https://github.com/opentracing/opentracing-cpp/archive/$OPENTRACING_CPP.tar.gz" +get_src 9543f66790ba65810869a29b3aaef5286f1c446cb498a304d0d8b153c289cae8 \ + "https://github.com/opentracing/opentracing-cpp/archive/v$OPENTRACING_CPP_VERSION.tar.gz" -get_src c9961b503da1119eaeb15393bac804a303d49d86f701dbfd31c425d2214354d5 \ - "https://github.com/rnburn/zipkin-cpp-opentracing/archive/$ZIPKIN_CPP.tar.gz" +get_src 3d91e866819986f5dda00549694c4eaca16f1209d1f87aecc8aca3b42aa72e08 \ + "https://github.com/rnburn/zipkin-cpp-opentracing/archive/v$ZIPKIN_CPP_VERSION.tar.gz" get_src 3abdecedb5bf544eeba8c1ce0bef2da6a9f064b216ebbe20b68894afec1d7d80 \ "https://github.com/SpiderLabs/ModSecurity-nginx/archive/$MODSECURITY.tar.gz" @@ -133,18 +133,18 @@ get_src 3abdecedb5bf544eeba8c1ce0bef2da6a9f064b216ebbe20b68894afec1d7d80 \ curl -sSL -o nginx__dynamic_tls_records.patch https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__1.11.5_dynamic_tls_records.patch # build opentracing lib -cd "$BUILD_PATH/opentracing-cpp-$OPENTRACING_CPP" +cd "$BUILD_PATH/opentracing-cpp-$OPENTRACING_CPP_VERSION" mkdir .build cd .build -cmake -DCMAKE_BUILD_TYPE=Release .. +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. make make install # build zipkin lib -cd "$BUILD_PATH/zipkin-cpp-opentracing-$ZIPKIN_CPP" +cd "$BUILD_PATH/zipkin-cpp-opentracing-$ZIPKIN_CPP_VERSION" mkdir .build cd .build -cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 .. +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DBUILD_TESTING=OFF .. make make install @@ -207,7 +207,8 @@ WITH_MODULES="--add-module=$BUILD_PATH/ngx_devel_kit-$NDK_VERSION \ --add-module=$BUILD_PATH/nginx-goodies-nginx-sticky-module-ng-$STICKY_SESSIONS_VERSION \ --add-module=$BUILD_PATH/nginx-http-auth-digest-$NGINX_DIGEST_AUTH \ --add-module=$BUILD_PATH/ngx_http_substitutions_filter_module-$NGINX_SUBSTITUTIONS \ - --add-module=$BUILD_PATH/nginx-opentracing-$NGINX_OPENTRACING" + --add-dynamic-module=$BUILD_PATH/nginx-opentracing-$NGINX_OPENTRACING_VERSION/opentracing + --add-dynamic-module=$BUILD_PATH/nginx-opentracing-$NGINX_OPENTRACING_VERSION/zipkin" if [[ ${ARCH} == "x86_64" ]]; then WITH_MODULES+=" --add-dynamic-module=$BUILD_PATH/ModSecurity-nginx-$MODSECURITY" diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index cdcce1a1a..89c1c2434 100644 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -11,6 +11,14 @@ load_module /etc/nginx/modules/ngx_http_modsecurity_module.so; {{ end }} +{{ if $cfg.EnableOpentracing }} +load_module modules/ngx_http_opentracing_module.so; +{{ end }} + +{{ if (and $cfg.EnableOpentracing (ne $cfg.ZipkinCollectorHost "")) }} +load_module modules/ngx_http_zipkin_module.so; +{{ end }} + daemon off; worker_processes {{ $cfg.WorkerProcesses }}; @@ -92,9 +100,11 @@ http { underscores_in_headers {{ if $cfg.EnableUnderscoresInHeaders }}on{{ else }}off{{ end }}; ignore_invalid_headers {{ if $cfg.IgnoreInvalidHeaders }}on{{ else }}off{{ end }}; - {{ if (and $cfg.EnableOpentracing (ne $cfg.ZipkinCollectorHost "")) }} + {{ if $cfg.EnableOpentracing }} opentracing on; + {{ end }} + {{ if (and $cfg.EnableOpentracing (ne $cfg.ZipkinCollectorHost "")) }} zipkin_collector_host {{ $cfg.ZipkinCollectorHost }}; zipkin_collector_port {{ $cfg.ZipkinCollectorPort }}; zipkin_service_name {{ $cfg.ZipkinServiceName }};