Skip to content

Istio proxy 1.0.0 release

Guirish Salgaonkar edited this page Aug 29, 2018 · 4 revisions

Building Istio Proxy

The DRAFT instructions provided below specify the steps to build Istio Proxy version 1.0.0 on Linux on IBM Z for following distributions:

  • RHEL (7.3, 7.4, 7.5)
  • SLES 12 SP3
  • Ubuntu (16.04, 18.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Step 1: Install dependencies

  • RHEL (7.3, 7.4, 7.5)

    sudo yum install -y git tar java-1.8.0-openjdk java-1.8.0-openjdk-devel zip gcc-c++ unzip python libtool automake cmake golang curl wget gcc vim patch binutils-devel bzip2 make
    
    • Build GCC 6.3.0:

      cd /<source_root>/
      wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-6.3.0/gcc-6.3.0.tar.gz  
      tar -xvzf gcc-6.3.0.tar.gz  
      cd gcc-6.3.0/  
      ./contrib/download_prerequisites  
      cd /<source_root>/  
      mkdir gcc_build  
      cd gcc_build/  
      ../gcc-6.3.0/configure --prefix="/opt/gcc" --enable-shared --with-system-zlib --enable-threads=posix --enable-__cxa_atexit --enable-checking --enable-gnu-indirect-function --enable-languages="c,c++" --disable-bootstrap --disable-multilib  
      make  
      sudo make install  
      export PATH=/opt/gcc/bin:$PATH  
      sudo ln -sf /opt/gcc/bin/gcc /usr/bin/gcc
      export C_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-ibm-linux-gnu/6.3.0/include  
      export CPLUS_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-ibm-linux-gnu/6.3.0/include
      sudo ln -sf /opt/gcc/lib64/libstdc++.so.6.0.22 /lib64/libstdc++.so.6
      export LD_LIBRARY_PATH='/opt/gcc/$LIB'
    • Build Cmake 3.7.2:

      cd /<source_root>
      wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz
      tar xzf cmake-3.7.2.tar.gz
      cd cmake-3.7.2
      ./configure --prefix=/usr/local
      make && sudo make install
  • SLES 12 SP3

    sudo zypper install -y java-1_8_0-openjdk java-1_8_0-openjdk-devel wget git tar pkg-config zip unzip python libtool automake cmake zlib-devel gcc6 gcc6-c++ binutils-devel patch which curl   
    sudo ln -sf /usr/bin/gcc-6 /usr/bin/gcc
    sudo ln -sf /usr/bin/g++-6 /usr/bin/g++
    sudo ln -sf /usr/bin/gcc /usr/bin/cc
    
  • Ubuntu 16.04

     sudo apt-get update
     sudo apt-get install -y git tar openjdk-8-jdk pkg-config zip g++ zlib1g-dev unzip python libtool automake cmake curl wget build-essential realpath ninja-build clang-format-5.0  
    
    • Build GCC 6.3.0:
      cd /<source_root>/
      wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-6.3.0/gcc-6.3.0.tar.gz  
      tar -xvzf gcc-6.3.0.tar.gz  
      cd gcc-6.3.0/  
      ./contrib/download_prerequisites  
      cd /<source_root>/  
      mkdir gcc_build  
      cd gcc_build/  
      ../gcc-6.3.0/configure --prefix="/opt/gcc" --enable-shared --with-system-zlib --enable-threads=posix --enable-__cxa_atexit --enable-checking --enable-gnu-indirect-function --enable-languages="c,c++" --disable-bootstrap --disable-multilib  
      make  
      sudo make install  
      export PATH=/opt/gcc/bin:$PATH  
      sudo ln -sf /opt/gcc/bin/gcc /usr/bin/gcc
      export C_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-ibm-linux-gnu/6.3.0/include  
      export CPLUS_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-ibm-linux-gnu/6.3.0/include
      sudo ln -sf /opt/gcc/lib64/libstdc++.so.6.0.22 /usr/lib/s390x-linux-gnu/libstdc++.so.6
      export LD_LIBRARY_PATH='/opt/gcc/$LIB'
  • Ubuntu 18.04

     sudo apt-get update
     sudo apt-get install -y git openjdk-8-jdk pkg-config zip zlib1g-dev unzip python libtool automake cmake curl wget build-essential rsync clang g++-6 libgtk2.0-0 ninja-build clang-format-5.0  
     sudo rm -rf /usr/bin/gcc /usr/bin/g++ /usr/bin/cc
     sudo ln -sf /usr/bin/gcc-6 /usr/bin/gcc
     sudo ln -sf /usr/bin/g++-6 /usr/bin/g++
     sudo ln -sf /usr/bin/gcc /usr/bin/cc		
    
  • Install Go - v1.10.1

    • Ubuntu 18.04

      sudo apt-get install -y golang-1.10
      export PATH=/usr/lib/go-1.10/bin:$PATH	
      
    • RHEL, SLES and Ubuntu 16.04

      cd /<source_root>/
      wget https://storage.googleapis.com/golang/go1.10.1.linux-s390x.tar.gz
      tar -xzf go1.10.1.linux-s390x.tar.gz
      export PATH=/<source_root>/go/bin:$PATH
      export GOROOT=/<source_root>/go
      go version
      

Step 2: Build dependencies

2.1) Build Bazel version 0.15.2

  • Download Bazel

     cd /<source_root>/
     mkdir bazel && cd bazel
     wget https://github.com/bazelbuild/bazel/releases/download/0.15.2/bazel-0.15.2-dist.zip
     unzip bazel-0.15.2-dist.zip
     chmod -R +w .
  • Build Bazel

    bash ./compile.sh
    export PATH=$PATH:/<source_root>/bazel/output/

    Note: While building Bazel, if build fails with an error java.lang.OutOfMemoryError: Java heap space , add below java options in scripts/bootstrap/compile.sh:

    @@ -114,7 +114,7 @@
         cat "$paramfile" >&2
       fi
    
    -  run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \
    +  run "${JAVAC}" -J-Xms1g -J-Xmx1g -classpath "${classpath}" -sourcepath "${sourcepath}" \
           -d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \
           -encoding UTF-8 "@${paramfile}"  

2.2) Build Ninja (Only on RHEL and SLES)

 cd /<source_root>/  
 git clone git://github.com/ninja-build/ninja.git && cd ninja
 git checkout v1.8.2
 ./configure.py --bootstrap
 export PATH=$PATH:/<source_root>/ninja/
 ninja --version       

2.3) Download Envoy

 cd /<source_root>/  
 git clone https://github.com/linux-on-ibm-z/envoy.git  
 cd envoy  
 git checkout envoy-istio-s390x      

2.4) Download BoringSSL

 cd /<source_root>/  
 git clone https://github.com/google/boringssl  
 cd boringssl && git reset --hard "372daf7042ffe3da1335743e7c93d78f1399aba7"  
  • Edit file /<source_root>/boringssl/src/CMakeLists.txt:

    @@ -330,6 +330,8 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "mips")  
     set(ARCH "generic")  
    elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64le")  
     set(ARCH "ppc64le")  
    +elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "s390x")  
    +  set(ARCH "s390x")  
    else()  
     message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})  
    endif()  
    
  • Edit file /<source_root>/boringssl/src/include/openssl/base.h:

    @@ -110,6 +110,8 @@ extern "C" {
     #define OPENSSL_32_BIT
     #elif defined(__myriad2__)
     #define OPENSSL_32_BIT
    +#elif defined(__s390x__)
    +#define OPENSSL_64_BIT
     #else
     // Note BoringSSL only supports standard 32-bit and 64-bit two's-complement,
     // little-endian architectures. Functions will not produce the correct answer

Step 3: Building Istio-proxy

3.1) Download source code of Istio Proxy version 1.0.0

 cd /<source_root>/
 git clone https://github.com/istio/proxy.git
 cd proxy && git checkout 1.0.0  
  • Edit file /<source_root>/proxy/WORKSPACE:

    Note: Substitute for /<source_root>/ in the below diff.

    @@ -28,14 +28,20 @@ bind(
     name = "boringssl_crypto",
     actual = "//external:ssl",
    )
    +local_repository(
    +    name = "boringssl",
    +    path = "/<source_root>/boringssl",
    +)
    
    -# When updating envoy sha manually please update the sha in istio.deps file also
    -ENVOY_SHA = "280baee6dc45e48a4bf38ac03d32711fe5eaeee1"
    +bind(
    +    name = "ssl",
    +    actual = "@boringssl//:ssl",
    +)
    
    -http_archive(
    -    name = "envoy",
    -    strip_prefix = "envoy-" + ENVOY_SHA,
    -    url = "https://github.com/envoyproxy/envoy/archive/" + ENVOY_SHA + ".zip",
    +# When updating envoy sha manually please update the sha in istio.deps file also
    +local_repository(
    +  name = "envoy",
    +  path = "/<source_root>/envoy",
    )
    
    load("@envoy//bazel:repositories.bzl", "envoy_dependencies")
    

3.2) Build Istio Proxy

Proxy binaries should be built in both debug and release mode. Once the build completes, the binary file named envoy will be created under /<source_root>/proxy/bazel-bin/src/envoy/. Take backup of the debug binary before proceeding with release mode.

  • In DEBUG mode

    • On Ubuntu and RHEL

      cd /<source_root>/proxy
      make build
    • On SLES 12 SP3

      • Edit file /<source_root>/proxy/Makefile as:
      @@ -24,7 +24,7 @@ HUB ?=  
      TAG ?=  
      
      build:  
      -       @bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //...  
      +       @bazel $(BAZEL_STARTUP_ARGS) build --copt "-DENVOY_IGNORE_GLIBCXX_USE_CXX11_ABI_ERROR=1" $(BAZEL_BUILD_ARGS) //...  
      
      # Build only envoy - fast  
      build_envoy:    
  • In RELEASE mode

    • Edit file /<source_root>/proxy/Makefile as:

      • On Ubuntu 16.04 and RHEL
      @@ -24,7 +24,7 @@    
      TAG ?=    
      
      build:  
      -       @bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //...    
      +       @bazel $(BAZEL_STARTUP_ARGS) build -c opt $(BAZEL_BUILD_ARGS) //...    
      
      # Build only envoy - fast    
      build_envoy:	    
      • On Ubuntu 18.04
      @@ -24,7 +24,7 @@  
      TAG ?=  
      
      build:  
      -       @bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //...  
      +       @bazel $(BAZEL_STARTUP_ARGS) build -c opt --copt="-fno-strict-aliasing" --cxxopt="-fno-strict-aliasing"  $(BAZEL_BUILD_ARGS) //...  
      
      # Build only envoy - fast  
      build_envoy:	 
      • On SLES 12 SP3
      @@ -24,7 +24,7 @@ HUB ?=  
      TAG ?=  
      
      build:  
      -       @bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //...  
      +       @bazel $(BAZEL_STARTUP_ARGS) build -c opt  --copt "-DENVOY_IGNORE_GLIBCXX_USE_CXX11_ABI_ERROR=1" $(BAZEL_BUILD_ARGS) //...   
      	
      
      # Build only envoy - fast  
      build_envoy:    
    • Build Proxy

      cd /<source_root>/proxy
      make build

      Note: While building Istio Proxy, if build fails with an error java.lang.OutOfMemoryError: Java heap space, add below options in /<source_root>/proxy/Makefile:

      build:
      -       @bazel $(BAZEL_STARTUP_ARGS) build $(BAZEL_BUILD_ARGS) //...
      +       @bazel $(BAZEL_STARTUP_ARGS) --host_jvm_args="-Xms512m" --host_jvm_args="-Xmx2g"  build $(BAZEL_BUILD_ARGS) //...

Step 4: Execute Test Suite (Optional)

  • Edit file /<source_root>/proxy/Makefile to run only ipv4 test cases as ipv6 ones are not supported:

    • On Ubuntu and RHEL
    @@ -34,7 +34,7 @@ clean:
            @bazel clean
    
     test:
    -       bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) //...
    +       bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) //... --test_env=ENVOY_IP_TEST_VERSIONS=v4only
    
     test_asan:
            CC=clang-5.0 CXX=clang++-5.0 bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) --config=clang-asan //...
    • On SLES 12 SP3
    @@ -34,7 +34,7 @@ clean:
            @bazel clean
    
     test:
    -       bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) //...
    +       bazel $(BAZEL_STARTUP_ARGS) test --copt "-DENVOY_IGNORE_GLIBCXX_USE_CXX11_ABI_ERROR=1" $(BAZEL_TEST_ARGS) //... --test_env=ENVOY_IP_TEST_VERSIONS=v4only
    
     test_asan:
            CC=clang-5.0 CXX=clang++-5.0 bazel $(BAZEL_STARTUP_ARGS) test $(BAZEL_TEST_ARGS) --config=clang-asan //...
  • Run the test suite

    cd /<source_root>/proxy
    make test

    Note: Below test failures are seen on IBM Z platform:

    //src/envoy/http/jwt_auth:http_filter_integration_test 
    //src/envoy/http/authn:authenticator_base_test  
    //src/envoy/http/authn:authn_utils_test 
    //src/envoy/http/authn:http_filter_integration_test
    //src/envoy/http/jwt_auth:jwt_authenticator_test
    //src/envoy/http/jwt_auth:jwt_test 
    //src/istio/mixerclient:referenced_test  
    

References:

https://github.com/istio/proxy
https://github.com/istio/istio/wiki/Dev-Guide