Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update nginx-opentracing and jaeger-client-cpp #1883

Merged
merged 8 commits into from
Aug 25, 2021
Merged
27 changes: 24 additions & 3 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode

############################################# Build image for Opentracing Builder #############################################
FROM debian as opentracing-builder
ARG NGINX_OPENTRACING=0.10.0
ARG NGINX_OPENTRACING=0.19.0
ARG OPENTRACING_VERSION=1.6.0

RUN apt-get update && apt-get install -y -q --fix-missing --no-install-recommends \
Expand All @@ -181,7 +181,7 @@ RUN apt-get update && apt-get install -y -q --fix-missing --no-install-recommend
RUN curl -sS -O -L http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
&& tar zxvf nginx-${NGINX_VERSION}.tar.gz && rm -f nginx-${NGINX_VERSION}.tar.gz \
&& git clone --branch v${NGINX_OPENTRACING} https://github.com/opentracing-contrib/nginx-opentracing.git \
&& git clone --branch v${OPENTRACING_VERSION} https://github.com/opentracing/opentracing-cpp.git
&& git clone --branch v${OPENTRACING_VERSION} https://github.com/opentracing/opentracing-cpp.git

WORKDIR /opentracing-cpp/.build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_STATIC_LIBS=OFF -DBUILD_MOCKTRACER=OFF -DENABLE_LINTING=OFF .. && \
Expand All @@ -193,6 +193,7 @@ RUN ./configure \
--add-dynamic-module=/nginx-opentracing/opentracing && \
make modules

WORKDIR /

############################################# Build image for Trace downloader #############################################
FROM debian AS tracer-downloader
Expand All @@ -203,14 +204,34 @@ RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y ca-certificates apt-transport-https wget \
&& wget -nv https://github.com/jaegertracing/jaeger-client-cpp/releases/download/${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so

############################################# Build image for Trace downloader #############################################
FROM opentracing-builder AS tracer-builder

ARG JAEGER_VERSION=0.7.0
# Jaeger version matched based on: https://github.com/opentracing-contrib/nginx-opentracing/blob/master/Dockerfile

RUN git clone --branch v${JAEGER_VERSION} https://github.com/jaegertracing/cpp-client.git

WORKDIR /cpp-client/.build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DJAEGERTRACING_WITH_YAML_CPP=ON .. && \
make && make install \
&& export HUNTER_INSTALL_DIR=$(cat _3rdParty/Hunter/install-root-dir) \
&& cp $HUNTER_INSTALL_DIR/lib/libyaml*so /usr/local/lib/

############################################# Build image for Opentracing #############################################
FROM debian as opentracing
ARG OPENTRACING_VERSION=1.6.0

COPY --from=opentracing-builder /nginx-${NGINX_VERSION}/objs/ngx_http_opentracing_module.so /usr/lib/nginx/modules/ngx_http_opentracing_module.so
COPY --from=opentracing-builder /usr/local/lib/libopentracing.so.${OPENTRACING_VERSION} /usr/local/lib/libopentracing.so.1
COPY --from=tracer-downloader /usr/local/lib/libjaegertracing_plugin.so /usr/local/lib/libjaegertracing_plugin.so

# If tracer version is available through tracer downloader
# COPY --from=tracer-downloader /usr/local/lib/libjaegertracing_plugin.so /usr/local/lib/libjaegertracing_plugin.so

# If tracer version is avilable through tracer builder
ARG JAEGER_VERSION=0.7.0
COPY --from=tracer-builder /usr/local/lib/libjaegertracing.so.${JAEGER_VERSION} /usr/local/lib/libjaegertracing_plugin.so
MatyRi marked this conversation as resolved.
Show resolved Hide resolved
COPY --from=tracer-builder /usr/local/lib/libyaml*so /usr/local/lib/

RUN ldconfig

Expand Down
2 changes: 1 addition & 1 deletion docs/content/technical-specifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The supported architecture is x86-64.
| ---| ---| ---| --- |
|Debian-based image | ``nginx:1.21.0``, which is based on ``debian:buster-slim`` | | ``nginx/nginx-ingress:1.12.0`` |
|Alpine-based image | ``nginx:1.21.0-alpine``, which is based on ``alpine:3.13`` | | ``nginx/nginx-ingress:1.12.0-alpine`` |
|Debian-based image with Opentracing | ``nginx:1.21.0``, which is based on ``debian:buster-slim`` | OpenTracing API for C++ 1.5.1, NGINX plugin for OpenTracing, C++ OpenTracing binding for Jaeger 0.4.2 | |
|Debian-based image with Opentracing | ``nginx:1.21.0``, which is based on ``debian:buster-slim`` | OpenTracing API for C++ 1.6.0, NGINX plugin for OpenTracing 0.19.0, C++ OpenTracing binding for Jaeger 0.7.0 | |
|Ubi-based image | ``registry.access.redhat.com/ubi8/ubi:8.3`` | | ``nginx/nginx-ingress:1.12.0-ubi`` |
{{% /table %}}

Expand Down
18 changes: 12 additions & 6 deletions docs/content/third-party-modules/opentracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ The Ingress Controller supports [OpenTracing](https://opentracing.io/) with the
This document explains how to use OpenTracing with the Ingress Controller.

## Prerequisites
1. **Use the Ingress Controller image with OpenTracing.** The default Ingress Controller images don’t include the OpenTracing module. To use OpenTracing, you need to build the image with that module. Follow the build instructions to build the image using `openshift-image` for NGINX or `openshift-image-plus` for NGINX Plus.
By default, the Dockerfiles install Jaeger as a tracer. However, it is possible to replace Jaeger with other supported [tracers](https://github.com/opentracing-contrib/nginx-opentracing#building-from-source). For that, please modify the Dockerfile accordingly:
1. Change the download line in the tracer-downloader stage of the Dockerfile to download the right tracer.
1. Edit the COPY line of the final image to copy the previously downloaded tracer to the image

1. **Load the OpenTracing module.** You need to load the module with the configuration for the chosen tracer using the following ConfigMap keys:
1. **Use the Ingress Controller image with OpenTracing.** The default Ingress Controller images don’t include the OpenTracing module. To use OpenTracing, you need to build the image with that module. Follow the build instructions to build the image using `debian-image-opentracing` for NGINX or `debian-image-opentracing-plus` for NGINX Plus.
By default, the Dockerfiles build & install Jaeger as a tracer. However, it is possible to replace Jaeger with other supported [tracers](https://github.com/opentracing-contrib/nginx-opentracing#building-from-source). For that, please modify the Dockerfile accordingly:
1. Find out which version of supported tracer you will need based on the current OpenTracing C++ API
2. If direct download of that version is avilable:
1. Change the download line in the `tracer-downloader` stage of the Dockerfile to download the right tracer.
2. Edit the COPY line of the final image to copy the previously downloaded tracer to the image
2. If tracer needs to be built:
1. Change the content the `tracer-builder` stage of the Dockerfile to build the right tracer. Build steps can be found in [Nginx Opentracing Dockerfile](https://github.com/opentracing-contrib/nginx-opentracing/blob/master/Dockerfile)
2. Edit the COPY line of the final image to copy the previously built tracer to the image

2. **Load the OpenTracing module.** You need to load the module with the configuration for the chosen tracer using the following ConfigMap keys:
* `opentracing-tracer`: sets the path to the vendor tracer binary plugin. This is the path you used in the COPY line of step *ii* above.
* `opentracing-tracer-config`: sets the tracer configuration in JSON format.

Expand All @@ -29,6 +34,7 @@ By default, the Dockerfiles install Jaeger as a tracer. However, it is possible
opentracing-tracer-config: |
{
"service_name": "nginx-ingress",
"propagation_format": "w3c",
"sampler": {
"type": "const",
"param": 1
Expand Down