[CONSUL-424] Replace pkill in kill_envoy function (#52)

pull/15235/head
Ezequiel Fernández Ponce 2 years ago committed by Jose Ignacio Lorenzo
parent 146347f31b
commit 2a3b325824

@ -4,7 +4,7 @@
- [About](#about-this-file)
- [Consul-windows](#consul-windows)
- [Dockerfile-consul-dev-windows](#dockerfile-consul-dev-windows)
- [Dockerfile-consul-local-windows](#dockerfile-consul-local-windows)
- [Dockerfile-openzipkin-windows](#dockerfile-openzipkin-windows)
- [Dockerfile-socat-windows](#dockerfile-socat-windows)
- [Build images](#build-images)
@ -31,22 +31,22 @@ docker run --rm -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8500:8500 -p 8600:8600
If everything works properly you should openning the browser and check the Consul UI running on: `http://localhost:8500`
## Dockerfile-consul-dev-windows
## Dockerfile-consul-local-windows
The Consul-dev custom image deployed in the "Dockerfile-consul-dev-windows" DockerFile is generated by the sh script of the same name.
The Consul:local custom image deployed in the "Dockerfile-consul-local-windows" DockerFile is generated by the shell script of the same name.
When executing it, the compilation of Consul is carried out and it is saved in the _"dist"_ directory, this file is then copied to a container created from the _"windows/consul"_ image.
It is necessary that the _"windows/consul"_ image has been built first.
To build this image you need to run the following command on your terminal:
```shell
./Dockerfile-consul-dev-windows.sh
./Dockerfile-consul-local-windows.sh
```
You can test the built file by running the following command:
```shell
docker run --rm -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8500:8500 -p 8600:8600 --name consul-dev --hostname "consul-primary-server" --network-alias "consul-primary-server" windows/consul-dev agent -dev -datacenter "primary" -grpc-port -1 -client "0.0.0.0" -bind "0.0.0.0"
docker run --rm -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8500:8500 -p 8600:8600 --name consul-local --hostname "consul-primary-server" --network-alias "consul-primary-server" windows/consul:local agent -dev -datacenter "primary" -grpc-port -1 -client "0.0.0.0" -bind "0.0.0.0"
```
If everything works properly you should openning the browser and check the Consul UI running on: `http://localhost:8500`

@ -1,45 +0,0 @@
ARG ENVOY_VERSION=v1.19.5
ARG CONSUL_IMAGE_VERSION=latest
FROM envoyproxy/envoy-windows:${ENVOY_VERSION} as envoy
FROM windows/consul:${CONSUL_IMAGE_VERSION}
COPY dist/ C:\\consul
# Fortio binary downloaded
RUN mkdir fortio
ENV FORTIO_URL=https://github.com/fortio/fortio/releases/download/v1.33.0/fortio_win_1.33.0.zip
RUN curl %FORTIO_URL% -L -o fortio.zip
RUN tar -xf fortio.zip -C fortio
# Copy envoy.exe from FROM envoyproxy/envoy-windows:${ENVOY_VERSION}
COPY --from=envoy ["C:/Program Files/envoy/", "C:/envoy/"]
RUN choco install openssl -yf
RUN choco install jq -yf
# Install Bats
ENV BATS_URL=https://github.com/bats-core/bats-core/archive/refs/tags/v1.7.0.zip
RUN curl %BATS_URL% -L -o bats.zip
RUN mkdir bats-core
RUN tar -xf bats.zip -C bats-core --strip-components=1
RUN cd "C:\\Program Files\\Git\\bin" && bash.exe -c "/c/bats-core/install.sh /c/bats"
# Install Jaeger
ENV JAEGER_URL=https://github.com/jaegertracing/jaeger/releases/download/v1.11.0/jaeger-1.11.0-windows-amd64.tar.gz
RUN curl %JAEGER_URL% -L -o jaeger.tar.gz
RUN mkdir jaeger
RUN tar -xf jaeger.tar.gz -C jaeger --strip-components=1
# Copy test-sds-server binary and certs
COPY --from=test-sds-server ["C:/go/src/", "C:/test-sds-server/"]
EXPOSE 8300
EXPOSE 8301 8301/udp 8302 8302/udp
EXPOSE 8500 8600 8600/udp
EXPOSE 8502
EXPOSE 19000 19001 19002 19003 19004
EXPOSE 21000 21001 21002 21003 21004
EXPOSE 5000 1234 2345
RUN SETX /M path "%PATH%;C:\consul;C:\envoy;C:\fortio;C:\jaeger;C:\Program Files\Git\bin;C:\Program Files\OpenSSL-Win64\bin;C:\bats\bin\bats;C:\ProgramData\chocolatey\lib\jq\tools;"

@ -1,14 +0,0 @@
#!/usr/bin/env bash
cd ../
rm -rf dist
export GOOS=windows GOARCH=amd64
CONSUL_VERSION=1.12.0
CONSUL_BUILDDATE=$(date +"%Y-%m-%dT%H:%M:%SZ")
GIT_IMPORT=github.com/hashicorp/consul/version
GOLDFLAGS=" -X $GIT_IMPORT.Version=$CONSUL_VERSION -X $GIT_IMPORT.VersionPrerelease=local -X $GIT_IMPORT.BuildDate=$CONSUL_BUILDDATE "
go build -ldflags "$GOLDFLAGS" -o ./dist/ .
docker build -t windows/consul-dev -f ./build-support-windows/Dockerfile-consul-dev-windows .

@ -1,4 +1,4 @@
ARG ENVOY_VERSION=v1.23.0
ARG ENVOY_VERSION=v1.19.5
ARG CONSUL_IMAGE_VERSION=latest
FROM envoyproxy/envoy-windows:${ENVOY_VERSION} as envoy

@ -12,12 +12,11 @@ echo " "
echo "Build Windows Consul Image"
docker build -t "windows/consul" -f ../Dockerfile-windows ../
# Build Windows Consul-Dev Image
# Build Windows Consul:local Image
echo " "
echo "Build Windows Consul-Dev Image"
./Dockerfile-consul-dev-windows.sh
echo "Build Windows Consul:local Image"
./Dockerfile-consul-local-windows.sh
# TODO: Check if this image is required
# Pull Windows Nanoserver image
echo " "
echo "Pull Windows Nanoserver image"
@ -25,7 +24,8 @@ docker pull mcr.microsoft.com/windows/nanoserver:1809
# Tag Windows Nanoserver image
echo " "
echo "Tag Windows Nanoserver image"
# docker tag mcr.microsoft.com/windows/nanoserver:1809 "${HASHICORP_DOCKER_PROXY}/windows/nanoserver"
docker tag mcr.microsoft.com/windows/nanoserver:1809 "${HASHICORP_DOCKER_PROXY}/windows/nanoserver"
# Pull Kubernetes/pause image
echo " "

@ -608,7 +608,10 @@ function kill_envoy {
local BOOTSTRAP_NAME=$1
local DC=${2:-primary}
pkill -TERM -f "envoy -c /workdir/$DC/envoy/${BOOTSTRAP_NAME}-bootstrap.json"
PORT=$( cat /c/workdir/$DC/envoy/${BOOTSTRAP_NAME}-bootstrap.json | jq .admin.address.socket_address.port_value )
PID=$( netstat -qo | grep "127.0.0.1:$PORT" | sed -r "s/.* //g" )
KILL=$( tskill $PID )
}
function must_match_in_statsd_logs {

@ -17,7 +17,7 @@ DEBUG=${DEBUG:-}
XDS_TARGET=${XDS_TARGET:-server}
# ENVOY_VERSION to run each test against
ENVOY_VERSION=${ENVOY_VERSION:-"1.23.0"}
ENVOY_VERSION=${ENVOY_VERSION:-"1.19.5"}
export ENVOY_VERSION
export DOCKER_BUILDKIT=0

Loading…
Cancel
Save