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

use envoy version with segfault fix #216

Merged
merged 4 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EnvoyAdmin(

fun isIngressReady() = statValue("http.ingress_http.rq_total") != "-1"

fun statValue(statName: String): String? = get("stats?filter=$statName").body()?.use {
fun statValue(statName: String): String? = get("stats?filter=^$statName$").body()?.use {
val splitedStats = it.string().lines().first().split(":")
if (splitedStats.size != 2) {
return "-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class EnvoyContainer(
image: String = DEFAULT_IMAGE
) : SSLGenericContainer<EnvoyContainer>(dockerfileBuilder = DockerfileBuilder()
.from(image)
.run("apk --no-cache add curl iproute2")
.run("apt-get update && apt-get install -y curl iproute2 iptables")
) {

companion object {
Expand All @@ -32,7 +32,7 @@ class EnvoyContainer(

const val EGRESS_LISTENER_CONTAINER_PORT = 5000
const val INGRESS_LISTENER_CONTAINER_PORT = 5001
const val DEFAULT_IMAGE = "envoyproxy/envoy-alpine:v1.14.3"
const val DEFAULT_IMAGE = "marcinfalkowski/envoy-dev:v1.16.1-dev-lua-segfault-fix-1-16-0-backport-20201118-df9dc819"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we fork it on official allegro account not to use your personal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it in next PR, when our official fork will be ready

private const val ADMIN_PORT = 10000
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ open class GenericContainer<SELF : GenericContainer<SELF>> : BaseGenericContaine
val result = execInContainer(HOST_IP_SCRIPT_DEST)

if (result.stderr.isNotEmpty() or result.stdout.isEmpty()) {
throw ContainerUnableToObtainHostIpException()
throw ContainerUnableToObtainHostIpException("stderr: ${result.stderr}")
}

return result.stdout.trim()
Expand Down Expand Up @@ -123,7 +123,10 @@ open class GenericContainer<SELF : GenericContainer<SELF>> : BaseGenericContaine

fun runCommands(commands: Array<String>) {
commands.forEach { command ->
execInContainer(*(command.split(" ").toTypedArray()))
val result = execInContainer(*(command.split(" ").toTypedArray()))
if (result.exitCode != 0) {
throw CommandFailedException(command, result.exitCode, result.stdout, result.stderr, this.containerName())
}
}
}

Expand All @@ -143,4 +146,13 @@ open class GenericContainer<SELF : GenericContainer<SELF>> : BaseGenericContaine
fun containerName() = containerId.substring(0, 12)
}

class ContainerUnableToObtainHostIpException : RuntimeException()
class ContainerUnableToObtainHostIpException(msg: String) : RuntimeException(msg)
class CommandFailedException(
cmd: String,
exitCode: Int,
stdout: String,
stderr: String,
containerName: String
) : RuntimeException(
"Command '$cmd' failed in container $containerName with exit code $exitCode; stderr: $stderr, stdout: $stdout"
)
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ open class ReliabilityTest : EnvoyControlTestConfiguration() {
fun cleanup() {
((consulMastersInDc1 + consulMastersInDc2).map {
it.container
} + listOf(envoyContainer1, echoContainer, echoContainer2)).forEach {
} + listOf(envoyContainer1)).forEach {
it.sigcont()
it.clearAllIptablesRules()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

HOST_IP=$(sh /usr/local/bin/host_ip.sh)
HOST_IP=$(bash /usr/local/bin/host_ip.sh)
HOST_PORT=$1
HOST2_PORT=$2

Expand Down
4 changes: 2 additions & 2 deletions tools/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ services:
dockerfile: Dockerfile
ports:
- "9999:9999"
- "31000:80"
- "31001:8080"
- "31000:31000"
- "31001:31001"

envoy-control:
container_name: envoy-control
Expand Down
6 changes: 3 additions & 3 deletions tools/envoy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM envoyproxy/envoy-alpine:v1.14.3
FROM marcinfalkowski/envoy-dev:v1.16.1-dev-lua-segfault-fix-1-16-0-backport-20201118-df9dc819

ENV PORT=9999:9999
ENV PORT=80:80
ENV ENVOY_NODE_ID=front-proxy-id
ENV ENVOY_NODE_CLUSTER=front-proxy
ENV ENVOY_EGRESS_LISTENER_PORT=80
ENV ENVOY_INGRESS_LISTENER_PORT=8080
ENV ENVOY_EGRESS_LISTENER_PORT=31000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the port change relevant / needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, new envoy container versions launch envoy from user envoy, not root, which has no access to low ports

ENV ENVOY_INGRESS_LISTENER_PORT=31001
ENV ENVOY_ADMIN_PORT=9999
ENV ENVOY_XDS_PORT=50000
ENV ENVOY_XDS_HOST=host.docker.internal
Expand Down
2 changes: 1 addition & 1 deletion tools/envoy/envoy-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static_resources:
access_log:
name: envoy.file_access_log
config:
path: "./envoy/ingress-access.log"
path: "/home/envoy/ingress-access.log"
format: >
[%START_TIME%] %PROTOCOL% %REQ(:METHOD)% %REQ(:authority)% %REQ(:PATH)% %RESPONSE_CODE% %RESPONSE_FLAGS%
%BYTES_RECEIVED%b %BYTES_SENT%b %DURATION%ms "%DOWNSTREAM_REMOTE_ADDRESS%" -> "%UPSTREAM_HOST%"
Expand Down